|
| 1 | +From 5b3c41b3465a98025b6869c4ed14d210b68b7e24 Mon Sep 17 00:00:00 2001 |
| 2 | +From: =?UTF-8?q?Jan=20=C4=8Cerm=C3=A1k?= < [email protected]> |
| 3 | +Date: Tue, 13 May 2025 17:19:59 +0200 |
| 4 | +Subject: [PATCH] rpi-eeprom-update: adjust bootfs discovery for HAOS |
| 5 | +MIME-Version: 1.0 |
| 6 | +Content-Type: text/plain; charset=UTF-8 |
| 7 | +Content-Transfer-Encoding: 8bit |
| 8 | + |
| 9 | +When HAOS boots from SD card, we can rely on /mnt/boot being mounted and |
| 10 | +use it for storing the recovery image. If it's not on an SD card, we can |
| 11 | +only use it to store the image if flashrom is used, otherwise the |
| 12 | +bootloader doesn't pick it up - in that case show an error (e.g. on CM4 |
| 13 | +booting from an NVMe). |
| 14 | + |
| 15 | +Signed-off-by: Jan Čermák < [email protected]> |
| 16 | +Upstream: not applicable |
| 17 | +--- |
| 18 | + rpi-eeprom-update | 22 ++++++++-------------- |
| 19 | + 1 file changed, 8 insertions(+), 14 deletions(-) |
| 20 | + |
| 21 | +diff --git a/rpi-eeprom-update b/rpi-eeprom-update |
| 22 | +index b970142..3e9d75f 100755 |
| 23 | +--- a/rpi-eeprom-update |
| 24 | ++++ b/rpi-eeprom-update |
| 25 | +@@ -725,20 +725,14 @@ findBootFS() |
| 26 | + # If ${BOOTFS} is not writable OR is not on /dev/mmcblk0 then error because the ROM |
| 27 | + # can only load recovery.bin from the on-board SD-CARD slot or the EEPROM. |
| 28 | + |
| 29 | +- if blkid | grep -qE "/dev/mmcblk0p1.*LABEL_FATBOOT.*RECOVERY.*TYPE.*vfat"; then |
| 30 | +- TMP_BOOTFS_MNT="$(mktemp -d)" |
| 31 | +- mount /dev/mmcblk0p1 "${TMP_BOOTFS_MNT}" |
| 32 | +- BOOTFS="${TMP_BOOTFS_MNT}" |
| 33 | +- elif [ -z "$BOOTFS" ]; then |
| 34 | +- if ! BOOTFS=$(/usr/lib/raspberrypi-sys-mods/get_fw_loc 2> /dev/null); then |
| 35 | +- for BOOTFS in /boot/firmware /boot; do |
| 36 | +- if [ -f "${BOOTFS}/config.txt" ]; then |
| 37 | +- break |
| 38 | +- elif findmnt --fstab "$BOOTFS" > /dev/null; then |
| 39 | +- break |
| 40 | +- fi |
| 41 | +- done |
| 42 | +- fi |
| 43 | ++ if blkid | grep -qE "/dev/mmcblk0p1.*LABEL_FATBOOT.*hassos-boot.*TYPE.*vfat"; then |
| 44 | ++ # use HAOS default bootfs location if booting from SD card |
| 45 | ++ BOOTFS="/mnt/boot" |
| 46 | ++ elif [ -z "$BOOTFS" ] && [ "${RPI_EEPROM_USE_FLASHROM}" = "1" ]; then |
| 47 | ++ # image for flashrom will created in bootfs |
| 48 | ++ BOOTFS="/mnt/boot" |
| 49 | ++ elif [ -z "$BOOTFS" ]; then |
| 50 | ++ die "rpi-eeprom-update is only available when booting from an SD card or if flashrom can be used." |
| 51 | + fi |
| 52 | + |
| 53 | + # If BOOTFS is not a directory or doesn't contain any .elf files then |
0 commit comments