rpi-eeprom icon indicating copy to clipboard operation
rpi-eeprom copied to clipboard

Pi 4 conditional configs seem parsed before halt and get confusing when booting later

Open jheeks opened this issue 2 years ago • 4 comments

Describe the bug

It seems that bootloader conditional configurations are evaluated and stored when entering halt mode. Later, when starting from halt mode it seems that the conditionals are not re-evaluated but the stored status is used.

The expectation is that the conditionals are evaluated when starting from halt mode.

Steps to reproduce the behaviour

I have described this observation in forum post The key points:

  • The configuration allows halt mode.
  • Based on state of a GPIO some boot options are changed.
  • It works as expected in power on reset case and in reboot case but not in halt mode case.

Device (s)

Raspberry Pi 4 Mod. B

Bootloader configuration.

$ vcgencmd bootloader_config [all] BOOT_UART=0 WAKE_ON_GPIO=1 POWER_OFF_ON_HALT=0 [gpio3=1] BOOT_ORDER=0xf14 [all]

System

raspinfo.txt

Bootloader logs

No response

USB boot

No response

NVMe boot

No response

Network (TFTP boot)

No response

jheeks avatar Oct 27 '23 20:10 jheeks

I have captured a UART log from bootloader bootloaderLog.txt With following steps:

  • power off to halt mode with button not pressed, means GPIO3=1
  • start with button always pressed, means GPIO3=0 -> boots from USB, which fits to the condition GPIO3=1
  • power off to halt mode with button pressed, means GPIO3=0
  • start with very short button press, means GPIO3=1 afterwards -> boots from SD, which fits to the condition GPIO3=0

Unfortunately, i cannot see any indication of the conditional's evaluation in the UART log. But the log shows that first boot is using USB and second boot is using SD.

jheeks avatar Oct 29 '23 18:10 jheeks

The EEPROM config is not re-evaulated after coming out of vpu-HALT (WAKE_ON_GPIO) so this is the expected behaviour.

timg236 avatar Oct 30 '23 14:10 timg236

Ok, I understand that this behaviour is expected and will not be changed. Is it then reasonable to make this clear in the documentation with a small note at WAKE_ON_GPIO ? Or is it already documented elsewhere?

jheeks avatar Oct 30 '23 19:10 jheeks

Ok, I understand that this behaviour is expected and will not be changed. Is it then reasonable to make this clear in the documentation with a small note at WAKE_ON_GPIO ? Or is it already documented elsewhere?

It's not documented, but I would agree that it's non-obvious so tagging this bug as documentation as a reminder to update the docs.

N.B. The underlying reasons are due to some slightly complex dependencies on whether you read the config before/after halt before/after DDR init before/after secure-boot verification.

Pi5 has an early config pass so if we release a 2711 update for top of tree then it might get nicer, too much churn right now though!

timg236 avatar Oct 30 '23 21:10 timg236