Skip to content

Commit

Permalink
pi-gen-sources: updates for building a functional bullseye image
Browse files Browse the repository at this point in the history
  • Loading branch information
marcone committed Oct 16, 2023
1 parent 4dee006 commit 67b8ca2
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
+++ stage_teslausb/rootfs/boot/cmdline.txt
@@ -1 +1 @@
-console=serial0,115200 console=tty1 root=ROOTDEV rootfstype=ext4 fsck.repair=yes rootwait quiet init=/usr/lib/raspberrypi-sys-mods/firstboot
+dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=ROOTDEV rootfstype=ext4 fsck.repair=yes rootwait modules-load=dwc2,g_ether quiet
+dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=ROOTDEV rootfstype=ext4 fsck.repair=yes rootwait modules-load=dwc2,g_ether
17 changes: 14 additions & 3 deletions pi-gen-sources/00-teslausb-tweaks/00-run.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/bin/bash -e
touch "${ROOTFS_DIR}/boot/ssh"
install -m 755 files/rc.local "${ROOTFS_DIR}/etc/"
install -m 666 files/teslausb_setup_variables.conf.sample "${ROOTFS_DIR}/boot/"
install -m 666 files/wpa_supplicant.conf.sample "${ROOTFS_DIR}/boot/"
install -m 666 files/userconf.txt "${ROOTFS_DIR}/boot/"
install -m 755 files/rc.local "${ROOTFS_DIR}/etc/"
install -m 666 files/teslausb_setup_variables.conf.sample "${ROOTFS_DIR}/boot/"
install -m 666 files/wpa_supplicant.conf.sample "${ROOTFS_DIR}/boot/"
install -m 666 files/run_once "${ROOTFS_DIR}/boot/"
install -d "${ROOTFS_DIR}/root/bin"

# work around shortcoming in pi-gen that causes ca-certificates to be
Expand All @@ -13,7 +15,16 @@ EOF

on_chroot << EOF
apt-get remove -y --force-yes --purge triggerhappy bluez alsa-utils
rm -rf /boot/kernel8.img
rm -rf /lib/modules/*-v8+
echo "pi ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/pi-nopassword
systemctl enable ssh
EOF

# disable various interactive setup dialogs
on_chroot << EOF
systemctl disable keyboard-setup
systemctl disable userconfig
EOF

# Below here is the rest of the stage2 (builds the Stretch lite image)
Expand Down
13 changes: 13 additions & 0 deletions pi-gen-sources/00-teslausb-tweaks/files/rc.local
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ then
printf "My IP address is %s\n" "$_IP"
fi

if [ -f /boot/run_once ]
then
cp /boot/run_once /tmp/
chmod +x /tmp/run_once
/tmp/run_once || echo "run_once failed"
mv /boot/run_once /boot/ran_once || true
fi

SETUP_LOGFILE=/boot/teslausb-headless-setup.log

Expand Down Expand Up @@ -94,6 +101,12 @@ function enable_wifi () {
sed -i -e "s/$old_host_name/$new_host_name/g" /etc/hostname
fi

dpkg-reconfigure openssh-server
rfkill unblock wifi
for i in /var/lib/systemd/rfkill/*:wlan ; do
echo 0 > "$i"
done

touch /boot/WIFI_ENABLED
setup_progress "Rebooting..."
exec reboot
Expand Down
8 changes: 8 additions & 0 deletions pi-gen-sources/00-teslausb-tweaks/files/run_once
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash -eu

# This script is executed once at the very beginning of setup.
# After it is run, this script will be renamed to 'ran_once'
# and setup will continue.
# If you make modifications to this script that include rebooting
# the device, you should ensure the script is not run again on
# the next boot, for example by renaming or deleting it.
1 change: 1 addition & 0 deletions pi-gen-sources/00-teslausb-tweaks/files/userconf.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pi:$6$JBQDChgFm34IIoOZ$rmTlqwCpgPwOHwmxAmmBLIlSojxxj8x7JHd9hGlNJ0hxsXVqDKFoP.xXcUPVyi6uXCMXZKqoVqwbL6wa9rLtT0

0 comments on commit 67b8ca2

Please sign in to comment.