summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcustom-scripts/modify-raspi.sh37
1 files changed, 19 insertions, 18 deletions
diff --git a/custom-scripts/modify-raspi.sh b/custom-scripts/modify-raspi.sh
index 73b5f22..695c6e7 100755
--- a/custom-scripts/modify-raspi.sh
+++ b/custom-scripts/modify-raspi.sh
@@ -10,7 +10,7 @@ TARGET_DIR="$1"
(rm "$TARGET_DIR/etc/dropbear" && mkdir "$TARGET_DIR/etc/dropbear") || true
# add a data partition mount
-if ! grep -q LABEL "$TARGET_DIR/etc/fstab"; then
+if ! grep -ql LABEL "$TARGET_DIR/etc/fstab"; then
printf "LABEL=data\t/data/\text4\trw,noatime,noauto\t0\t0\n" >> "$TARGET_DIR/etc/fstab"
fi
@@ -24,25 +24,26 @@ sed -i -e "s/BOOT_UART=0/BOOT_UART=1/" "${BINARIES_DIR}/rpi-firmware/bootcode.bi
# https://kittenlabs.de/blog/2024/09/01/extreme-pi-boot-optimization/
cfgfile="${BINARIES_DIR}/rpi-firmware/cmdline.txt"
-grep -q earlycon "$cfgfile" || sed -i -e '1 s/$/ earlycon=pl011,mmio32,0x3f201000/' "$cfgfile"
+grep -ql earlycon "$cfgfile" || sed -i -e '1 s/$/ earlycon=pl011,mmio32,0x3f201000/' "$cfgfile"
cfgfile="${BINARIES_DIR}/rpi-firmware/config.txt"
sed -i -e "/start_file/ s/^.*$/start_file=start_cd.elf/" "$cfgfile"
-grep -q miniuart-bt "$cfgfile" || sed -i -e '/dtoverlay/ s/miniuart-bt/disable-bt/' "$cfgfile"
-grep -q nohdmi "$cfgfile" || sed -i -e '/dtoverlay/ s/$/,nohdmi/' "$cfgfile"
-grep -q disable_fw_kms_setup "$cfgfile" || echo "disable_fw_kms_setup=1" >> "$cfgfile"
-grep -q enable_tvout "$cfgfile" || echo "enable_tvout=0" >> "$cfgfile"
-grep -q force_turbo "$cfgfile" || echo "force_turbo=0" >> "$cfgfile"
-grep -q initial_turbo "$cfgfile" || echo "initial_turbo=10" >> "$cfgfile"
-grep -q hdmi_blanking "$cfgfile" || echo "hdmi_blanking=1" >> "$cfgfile"
-grep -q hdmi_ignore_edid "$cfgfile" || echo "hdmi_ignore_edid=0xa5000080" >> "$cfgfile"
-grep -q hdmi_ignore_cec_init "$cfgfile" || echo "hdmi_ignore_cec_init=1" >> "$cfgfile"
-grep -q hdmi_ignore_cec "$cfgfile" || echo "hdmi_ignore_cec=1" >> "$cfgfile"
-grep -q force_eeprom_read "$cfgfile" || echo "force_eeprom_read=0" >> "$cfgfile"
-grep -q disable_poe_fan "$cfgfile" || echo "disable_poe_fan=1" >> "$cfgfile"
-grep -q ignore_lcd "$cfgfile" || echo "ignore_lcd=1" >> "$cfgfile"
-grep -q disable_touchscreen "$cfgfile" || echo "disable_touchscreen=1" >> "$cfgfile"
-grep -q camera_auto_detect "$cfgfile" || echo "camera_auto_detect=0" >> "$cfgfile"
-grep -q display_auto_detect "$cfgfile" || echo "display_auto_detect=0" >> "$cfgfile"
+grep -ql miniuart-bt "$cfgfile" && sed -i -e '/dtoverlay/ s/miniuart-bt/disable-bt/' "$cfgfile"
+grep -ql krnbt=on "$cfgfile" && sed -i -e '/krnbt=on/ d' "$cfgfile"
+grep -ql nohdmi "$cfgfile" || sed -i -e '/dtoverlay/ a dtoverlay=vc4-kms-v3d,nohdmi' "$cfgfile"
+grep -ql disable_fw_kms_setup "$cfgfile" || echo "disable_fw_kms_setup=1" >> "$cfgfile"
+grep -ql enable_tvout "$cfgfile" || echo "enable_tvout=0" >> "$cfgfile"
+grep -ql force_turbo "$cfgfile" || echo "force_turbo=0" >> "$cfgfile"
+grep -ql initial_turbo "$cfgfile" || echo "initial_turbo=10" >> "$cfgfile"
+grep -ql hdmi_blanking "$cfgfile" || echo "hdmi_blanking=1" >> "$cfgfile"
+grep -ql hdmi_ignore_edid "$cfgfile" || echo "hdmi_ignore_edid=0xa5000080" >> "$cfgfile"
+grep -ql hdmi_ignore_cec_init "$cfgfile" || echo "hdmi_ignore_cec_init=1" >> "$cfgfile"
+grep -ql hdmi_ignore_cec "$cfgfile" || echo "hdmi_ignore_cec=1" >> "$cfgfile"
+grep -ql force_eeprom_read "$cfgfile" || echo "force_eeprom_read=0" >> "$cfgfile"
+grep -ql disable_poe_fan "$cfgfile" || echo "disable_poe_fan=1" >> "$cfgfile"
+grep -ql ignore_lcd "$cfgfile" || echo "ignore_lcd=1" >> "$cfgfile"
+grep -ql disable_touchscreen "$cfgfile" || echo "disable_touchscreen=1" >> "$cfgfile"
+grep -ql camera_auto_detect "$cfgfile" || echo "camera_auto_detect=0" >> "$cfgfile"
+grep -ql display_auto_detect "$cfgfile" || echo "display_auto_detect=0" >> "$cfgfile"
exit 0