raspberrypi / rpi-update

An easier way to update the firmware of your Raspberry Pi
MIT License
132 stars 18 forks source link

rpi-update: Add support for updating the bootloader EEPROM #24

Closed timg236 closed 6 months ago

timg236 commented 7 months ago
timg236 commented 7 months ago

@popcornmix I think the bootloader update is ok, might be missing some integration bits for rpi-update but seems to work

timg236 commented 7 months ago

@popcornmix I think this is ok now!

popcornmix commented 7 months ago

I tested this and:

pi@pi5:~/projects/rpi-update $ sudo UPDATE_SELF=0 SKIP_BOOTLOADER=0 ./rpi-update 
 *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
FW_REV:d16727d5c99846538e1996b709e31470e6412e46
BOOTLOADER_REV:7e22b8ff470c813d0331f8ef64b6c08125b179cc
WANT_32BIT:0 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)
Downloadng bootloader tools

Downloading bootloader images
BOOTLOADER: up to date
   CURRENT: Wed 29 Nov 12:53:31 UTC 2023 (1701262411)
    LATEST: Mon 20 Nov 19:40:17 UTC 2023 (1700509217)
   RELEASE: latest (/lib/firmware/raspberrypi/bootloader-2712/latest)
            Use raspi-config to change the release.
 *** As requested, not updating kernel
 *** As requested, not updating kernel modules
 *** As requested, not updating VideoCore libraries
 *** As requested, not updating SDK
 *** Running ldconfig
 *** Storing current firmware revision
 *** Deleting downloaded files
 *** Syncing changes to disk
 *** If no errors appeared, your firmware was successfully updated to d16727d5c99846538e1996b709e31470e6412e46
 *** A reboot is needed to activate the new firmware

Should I have got this update?

timg236 commented 7 months ago

WANT_PI5 says zero ?

timg236 commented 7 months ago

Fixed the typo and added a small enhancement to refresh recovery.bin if bootloader_rev has changed.

@popcornmix Is WANT_PI5 supposed to be specific to the kernel_2712 stuff i.e. should we not gate bootloader updates on WANT_PI4 / WANT_PI5?

popcornmix commented 7 months ago

Ah - WANT_PI5 is set automatically only if kernel_2712.img exists on /boot/firmware/os_prefix.

I currently have kernel8.img but not kernel_2712.img. Possibly using /proc/cpuinfo and Model: would be more reliable, but I guess my setup is an edge case.

Adding WANT_Pi5=1 did update to d16727d5c99 as desired.

pi@pi5:~ $ vcgencmd bootloader_version 
2023/12/06 18:29:25
version e02d33b3122450accf9dea471a177d3b5623f5ad (release)
timestamp 1701887365
update-time 1701961238
capabilities 0x0000007f
popcornmix commented 7 months ago

@pelwell mentions that detecting Pi model may be better done with:

pi@pi5:~ $ cat /proc/device-tree/compatible 
raspberrypi,5-model-bbrcm,bcm2712

which should work with upstream and downstream kernel. (/proc/cpuinfo revision and model may not be available with non-downstream kernels).

Not necessarily something for this PR, but worth considering generally (raspi-config would be another example which could use this).

timg236 commented 7 months ago

Ok, I'll do the proc-device-tree thing

timg236 commented 7 months ago

Merged change to look for bcm2711 / bcm2712 in the compatible string

timg236 commented 6 months ago

Updated to force upgrade/downgrade if BOOTLOADER_REV_IN != master

popcornmix commented 6 months ago

Down and up-grade worked for me. Let's merge (and consider making the bootloader part enabled by default as a subsequent change).