raspberrypi/rpi-update

[Update bootloader bug] Possibly wrong path for lib on aarch64 armv8+

jgabriel98 opened this issue · 5 comments

Uppon running sudo rpi-update, i receive the following error:
Path /lib/firmware/raspberrypi/bootloader-2711/latest not found. Please install the rpi-eeprom package first

[spoiler] full sudo rpi-update output
 *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
 *** Performing self-update
 *** Relaunching after update
 *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
FW_REV:7ca14294c4bf09fda8d138f9987cd031ced61f7c
BOOTLOADER_REV:72cedfe5eea64bb8509b7d0fec68f5df5dd22f9e
WANT_32BIT:1 WANT_64BIT:1 WANT_PI4:1 WANT_PI5:0
#############################################################
WARNING: This update bumps to rpi-6.1.y linux tree
See: https://forums.raspberrypi.com/viewtopic.php?t=344246

'rpi-update' should only be used if there is a specific
reason to do so - for example, a request by a Raspberry Pi
engineer or if you want to help the testing effort
and are comfortable with restoring if there are regressions.

DO NOT use 'rpi-update' as part of a regular update process.
##############################################################
Would you like to proceed? (y/N)
Downloading bootloader tools
Downloading bootloader images
Path /lib/firmware/raspberrypi/bootloader-2711/latest not found. Please install the rpi-eeprom package first

But when inspecting /lib/firmware/raspberrypi/, the lib exists(but on another path):

pi@raspberrypi:~ $ ls /lib/firmware/raspberrypi
bootloader
pi@raspberrypi:~ $ ls /lib/firmware/raspberrypi/bootloader/
beta  critical  default  latest  release-notes.md  stable

So it seems that the script is looking for the wrong path? (or my system is using a different path? since it's on aarch64)


My system info:

pi@raspberrypi:~ $ uname -m
aarch64
pi@raspberrypi:~ $ uname -r
6.1.53-v8+

(feel free to ask any other information about my system)

It seems the cause is here:

rpi-update/rpi-update

Lines 260 to 262 in e85c4b6

fw_path="/lib/firmware/raspberrypi/bootloader-${bcm_chip}/latest"
if [[ ! -d "${fw_path}" ]]; then
echo "Path ${fw_path} not found. Please install the rpi-eeprom package first"

Full uname output:

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 6.1.53-v8+ #1680 SMP PREEMPT Wed Sep 13 18:09:06 BST 2023 aarch64 GNU/Linux

I'm no expert on embedded systems, but after looking at the repo history, it seems this behavior was introduced on this commit 62ef428.
Or more precisely, it's new code and was not accounted for different scenarios/machines.

So maybe a check for the kernel arch would solve as a workarround?
I'm tempted to edit te script and try it myself, but the chances of bricking my Pi4 due to lack of self expertise turns me off..

/lib/firmware/raspberrypi/bootloader/ is the directory structure for bootloader updates on Bullseye (or equivalent). The bootloader update part of rpi-update requires the new chip-specific directory structure.
We could make that a warning (if not already) or just less chatty.

For curiosity: why does rpi-update requires the chip_name in the directory structure?