Skip to content
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

[tryboot] in EEPROM config to change BOOT_ORDER does not seem to work #454

Open
mvirkkunen opened this issue Nov 27, 2022 · 5 comments
Open
Labels
enhancement New feature or request

Comments

@mvirkkunen
Copy link

Describe the bug

The [tryboot] conditional does not seem to work in the EEPROM configuration to change BOOT_ORDER. The documentation suggests that "Conditional filters are also supported except for EDID", but at least in my case this particular one doesn't seem to do anything. Does the EEPROM configuration not count as a "configuration file", or am I doing something wrong?

Steps to reproduce the behaviour

Using the bootloader configuration below, I was hoping to be able to temporarily boot from USB while keeping the SD card as the primary boot device, in order to boot faster. However even though the bootloader reports that it noticed the TRYBOOT flag, the first boot mode tried is SD, and it does not even try to enumerate USB devices before booting from SD.

Device (s)

Raspberry Pi 4 Mod. B

Bootloader configuration.

[all]
NET_INSTALL_ENABLED=0
DISABLE_HDMI=1
BOOT_UART=1
BOOT_ORDER=0xf41

[tryboot]
BOOT_ORDER=0xf14

System

vcgencmd bootloader_version

2022/11/25 10:54:13
version 850fab5f087c6c1b257d394d12e746503eb7bded (release)
timestamp 1669373653
update-time 0
capabilities 0x0000007f

Bootloader logs

[ 23.938204] reboot: Restarting system with command '0 tryboot'

RPi: BOOTLOADER release VERSION:850fab5f DATE: 2022/11/25 TIME: 10:54:13
BOOTMODE: 0x06 partition 0 build-ts BUILD_TIMESTAMP=1669373653 serial d2c5e564 boardrev b03115 stc 622769
PM_RSTS: 0x00000020
part 00000000 reset_info 00000001
uSD voltage 3.3V
Initialising SDRAM 'Samsung' 16Gb x1 total-size: 16 Gbit 3200
DDR 3200 0 0 16 152
TRYBOOT

TRYBOOT
Boot mode: SD (01) order f4
SD HOST: 200000000 CTL0: 0x00800000 BUS: 400000 Hz actual: 390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
SD HOST: 200000000 CTL0: 0x00800f00 BUS: 400000 Hz actual: 390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
OCR c0ff8000 [316]
CID: 009f5449534436344761672006300137
CSD: 400e00325b590001d0ff7f800a400000
SD: bus-width: 4 spec: 2 SCR: 0x02058483 0x01000000
SD HOST: 200000000 CTL0: 0x00800f04 BUS: 50000000 Hz actual: 50000000 HZ div: 4 (2) status: 0x1fff0000 delay: 2
MBR: 0x00000008, 4194304 type: 0x0c
MBR: 0x00400008,10485760 type: 0x83
MBR: 0x00000000, 0 type: 0x00
MBR: 0x00000000, 0 type: 0x00
Trying partition: 0
type: 16 lba: 8 oem: 'mkfs.fat' volume: ' V ^ '
rsc 4 fat-sectors 120 c-count 1048507 c-size 4
root dir cluster 1 sectors 32 entries 512
FAT16 clusters 1048507
Trying partition: 0
type: 16 lba: 8 oem: 'mkfs.fat' volume: ' V ^ '
rsc 4 fat-sectors 120 c-count 1048507 c-size 4
root dir cluster 1 sectors 32 entries 512
FAT16 clusters 1048507
Read tryboot.txt bytes 737 hnd 0x6bd8
Read system/start4.elf bytes 2250688 hnd 0x6766
Read system/fixup4.dat bytes 5398 hnd 0x6763
0x00b03115 0x00000000 0x00001fff
MEM GPU: 100 ARM: 924 TOTAL: 1024
Firmware: 1a79bba5cc84ea52d15809fff557479fdf084529 Nov 11 2022 11:13:01
Starting system/start4.elf @ 0xfec00200 partition 0
+

MESS:00:00:02.577081:0: arasan: arasan_emmc_open
MESS:00:00:02.735908:0: brfs: File read: /mfs/sd/tryboot.txt
MESS:00:00:02.739038:0: brfs: File read: 737 bytes

USB boot

No response

NVMe boot

No response

Network (TFTP boot)

No response

@timg236
Copy link
Collaborator

timg236 commented Nov 27, 2022

It's not supported in the EEPROM config because it's loaded earlier. I'll update the docs.

@mvirkkunen
Copy link
Author

Aw, that's too bad. I guess there is no real way to only temporarily change the boot order to boot from USB then?

A hack I came up with was to have "tryboot.txt" only exist on the USB drive and not on SD, so the SD card will be ignored in tryboot mode because the file doesn't exist, but it feels like.. a hack.

@timg236 timg236 added the enhancement New feature or request label Nov 27, 2022
@timg236
Copy link
Collaborator

timg236 commented Nov 28, 2022

It's not trivial to change it, and [tryboot] wasn't intended for this purpose. However, it's use-case seems reasonable so moved this to an 'feature', there might be a more generic boot-flag that we can do if space can be found in the partition number field etc.

@mvirkkunen
Copy link
Author

Yes, tryboot definitely wasn't meant for this, but if it had worked it would have been a convenient way to set a temporary boot device. Of course, if there could be an option to set the boot mode (or some other flag) besides tryboot, that would be even better.

The specific usecase I was hoping to use this for is firmware updates on USB drives for offline devices that have an internal SD card. I want the drive to be bootable so that it can install firmware even onto a blank SD card, and I thought it would be simpler to reboot to it in the normal update case as well, in order to not have two different update paths to verify. I'm using the "tryboot.txt only exists on USB" hack for now, and it seems to work.

timg236 added a commit to timg236/rpi-eeprom that referenced this issue May 17, 2024
… (latest)

  * Add timestamps to UART log messages.
  * Add support for [tryboot] conditional the bootloader EEPROM
    config file.
    See: raspberrypi#454
  * Fix MAX_RESTARTS parameter
    See: raspberrypi#576
  * Add recovery_reboot option to config.txt for rpiboot which causes
    the system to reboot after updating the bootloader.
  * Improve secure-boot OTP provisioning logging.
  * Fix setting to enable secure-boot mode on Pi4B
timg236 added a commit that referenced this issue May 17, 2024
… (latest)

  * Add timestamps to UART log messages.
  * Add support for [tryboot] conditional the bootloader EEPROM
    config file.
    See: #454
  * Fix MAX_RESTARTS parameter
    See: #576
  * Add recovery_reboot option to config.txt for rpiboot which causes
    the system to reboot after updating the bootloader.
  * Improve secure-boot OTP provisioning logging.
  * Fix setting to enable secure-boot mode on Pi4B
@lurch
Copy link
Contributor

lurch commented May 17, 2024

@mvirkkunen Would you like to test #579 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants