Skip to content

Instantly share code, notes, and snippets.

@arobb
Last active January 17, 2019 07:08
Show Gist options
  • Save arobb/2f905eaa3904a212c553d7d8fdf4630f to your computer and use it in GitHub Desktop.
Save arobb/2f905eaa3904a212c553d7d8fdf4630f to your computer and use it in GitHub Desktop.
Setting up Debian to build Raspbian images
# Done on Debian Stretch
# Configure local user as 'pi'
# Source for build process: https://github.com/RPi-Distro/pi-gen/blob/master/README.md
# Install sudo
# /etc/sudoers.d/010-pi
pi ALL=(ALL) ALL
# Dependencies
# Install instructions: https://wiki.debian.org/VirtualBox
# https://virtualboxes.org/doc/installing-guest-additions-on-debian/
# These lines may not be necessary
echo "deb http://ftp.debian.org/debian stretch-backports main" > /etc/apt/sources.list.d/stretch-backports.list
apt-get install build-essential module-assistant
m-a prepare
# Install VirtualBox additions from virtual cd
# In "Devices" menu, click "Insert Guest Additions CD image..."
sh /mount/cdrom/autorun.sh
# Cache packages locally
# Install as daemon
apt-get install apt-cacher
# Tweak overscan settings
# Add Pimoroni OnOff Shim daemon to build process
patch << 'EOF' ./stage2/01-sys-tweaks/01-run.sh
diff --git a/stage2/01-sys-tweaks/01-run.sh b/stage2/01-sys-tweaks/01-run.sh
index 8d28adc..aabfb5a 100755
--- a/stage2/01-sys-tweaks/01-run.sh
+++ b/stage2/01-sys-tweaks/01-run.sh
@@ -54,3 +54,34 @@ usermod --pass='*' root
EOF
rm -f "${ROOTFS_DIR}/etc/ssh/"ssh_host_*_key*
+
+on_chroot << EOF
+patch << 'EOG' /boot/config.txt
+--- config.txt 2019-01-17 06:23:28.000000000 -0800
++++ config copy.txt 2019-01-16 22:56:44.000000000 -0800
+@@ -11,10 +11,10 @@
+
+ # uncomment the following to adjust overscan. Use positive numbers if console
+ # goes off screen, and negative if there is too much border
+-#overscan_left=16
+-#overscan_right=16
+-#overscan_top=16
+-#overscan_bottom=16
++overscan_left=16
++overscan_right=16
++overscan_top=16
++overscan_bottom=16
+
+ # uncomment to force a console size. By default it will be display's size minus
+ # overscan.
+EOG
+EOF
+
+on_chroot << EOF
+# Shim doesn't install as root
+su pi
+curl https://raw.githubusercontent.com/arobb/pimoroni-onoffshim-headless/master/onoffshim.sh | bash -s -- -y
+if [[ "$(whoami)" != "root" ]]; then
+ exit # Drop su
+fi
+EOF
EOF
# Build configuration
echo "IMG_NAME='Raspbian'" > config
echo "APT_PROXY=http://127.0.0.1:3142" >> config
touch ./stage3/SKIP ./stage4/SKIP ./stage5/SKIP
touch ./stage4/SKIP_IMAGES ./stage5/SKIP_IMAGES
# Build
sudo ./build.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment