-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Writing eeprom with secure boot on RPi5 make the device unbootable #259
Comments
Not sure what you are asking for here. |
It might be helpful for you to explain:
|
|
If you are able to revert the change and use recovery5 then it suggests that secure-boot was never enabled. Please can you post the full sequence of rpiboot commands and corresponding UART logs from Pi5 for each stage. |
The full sequence of rpiboot command is in |
Pi 5 debug output is on the 3-pin connector labelled UART (between the two HDMI connectors). |
I forgot to add, when designing a secure-boot system we recommend using the higher level sb-provisioner tool because it supports provisioning of LUKS encrypted file-systems. It's built on top of these low level tools and is open-source shell script if a bespoke solution is required. |
Add debug UART log to initial report.
|
What OS is being booted at step (3) and how was it signed and provisioned? Please can you also check that you have uncommented in secure-boot-recovery5/config.txt EDIT: Please could you re-run step (2) and paste the contents of the UART log |
I have the OS that successfully boots on RPi4 with a secure boot. I plan to boot it on RPi5 using the same key for secure boot. But no OS can boot on step 3. The system is constantly in nRPIBOOT after power is on. If I connect the system to my laptop by USB cable I see the next lines in dmesg: |
Here is the log after the re-run of step (2) 1031.75 RPi: RECOVERY release VERSION:951e1cc9 DATE: 2024/10/21 TIME: 15:27:49 |
It doesn't look at though it's enabling secure-boot. Please can you confirm the contents of secure-boot-recovery5/config.txt |
No difference from the github repo.
|
I think the problem is that this line is still commented out in your config.txt file so it won't enable secure-boot but will flash a signed binary which will fail to boot because bootrom is still expected unsigned. You have to explicitly enable this in this config to ensure that the docs have been read first before potentially bricking the device (sb-provisioner wraps these operations) From readme
There's an additional commit that I've just pushed to fixup a stale link which might cause a problem
For reference success should look like this
|
According to the docs, the secure boot is switched on in two steps:
From readme
So on RPi4 I can enable signed boot, test it by booting the signed images, clear it if something goes wrong, or after everything is OK lock it. Can I test the secure boot images before the lock on RPi5? The documentation https://github.com/raspberrypi/usbboot/tree/master/secure-boot-recovery5#locking-secure-boot-mode said I could, but you just told me I can't. |
On Pi5 it’s possible to verify unsigned ramdisk boot and offline rpi-eeprom-digest can be used to check the signature of the ramdisk. However, unlike Pi4 it’s not possible to program the key digest to OTP without enabling secure boot. This is because on Pi5 the chip Rom now verifies the customer key digest if non zero. |
I confirm that with So, in summary, my problems were:
Now these questions are clearer for me. Thank you for your support. |
Describe the bug
The recovery procedure is applied to the Raspberry Pi 5 8GB. It is described in secure-boot-recovery5/readme.md and ends with success (green HDMI display, green LED flashes rapidly). After the power is off and on again the board LED flashes 1 long 2 short. The hardware doesn't boot images but is still in nRPIBOOT mode. Applying the same eeprom image again produces the same results (eeprom flashing with success indication). Applying the recovery5 without the secure boot makes the device bootable again.
This behavior repeats on three different RPi5 boards.
Steps to reproduce the behaviour
git clone --recurse-submodules --shallow-submodules --depth=1 https://github.com/raspberrypi/usbboot
cd usbboot
make
cd secure-boot-recovery5
_# fix the wrong symlink recovery.original.bin -> ../recovery5/recovery.bin
rm recovery.original.bin
ln -s ../firmware/2712/recovery.bin recovery.original.bin
../tools/update-pieeprom.sh -f -k ../secure-boot-example/example-private.pem
../rpiboot -d .
Device(s)
Other
Compute Module IO board.
No response
RPIBOOT logs
No response
Kernel logs
No response
Device UART logs
29.05 RPi: RECOVERY release VERSION:951e1cc9 DATE: 2024/10/21 TIME: 15:27:49
29.09 BOOTMODE: 0x07 partition 0 build-ts BUILD_TIMESTAMP=1729520869 serial 0088dae0 boardrev d04170 stc 29109977
29.20 AON_RESET: 00000003 PM_RSTS 00001000
29.72 BOOT_ORDER: 0xf3
29.72 USB-OTG disconnect
31.01 Read config.txt bytes 1385 hnd 0x0
31.04 pieeprom.sig
31.04 hash: e2b3acef58f800097906a37f4a920c6c18e5c508f309f4298e1c6ec0a85d7c56
31.11 ts: 1731947243
32.19 Reading EEPROM: 2097152 bytes 0xc1160000
34.04 2483ms
35.81 Writing EEPROM
+................+........................................................................................................................................................+++..................................................................................................................................................................................................................................................................................................................................................+ 36.50
36.50 768ms
36.50 Verify BOOT EEPROM
36.52 Reading EEPROM: 2097152 bytes 0xc1160000
38.06 2550ms
39.84 BOOT-EEPROM: UPDATED
39.84 USB-OTG disconnect
39.86 RECOVERY: COMPLETE: REBOOT 0
The text was updated successfully, but these errors were encountered: