Skip to content

Commit e256da3

Browse files
committed
PARTITION parameters: Preliminary documentation for remapping partition numbers
The latest firmware provides a basic method for remapping a high partition number to a regular partition. This makes it more flexible as generic reboot parameter. E.g. It would be possible reboot into a different boot-order or even network install. This will probably evolve as we use it with rpi-image-gen
1 parent 31f35e7 commit e256da3

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

documentation/asciidoc/computers/config_txt/conditional.adoc

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,34 @@ Some models of Raspberry Pi, including Zero, Compute Module, and Keyboard models
9696

9797
The `[none]` filter prevents any settings that follow from being applied to any hardware. Although there is nothing that you can't do without `[none]`, it can be a useful way to keep groups of unused settings in config.txt without having to comment out every line.
9898

99+
=== The `[partition=N]` filter
100+
This `partition` filter can be be used to select alternate boot flows according to the requested partition number (`sudo reboot N`) or via direct usage of the `PM_RSTS` watchdog register.
101+
102+
[source,ini]
103+
----
104+
# Bootloader EEPROM config.
105+
# If PM_RSTS is partition 62 then set bootloader properties to disable
106+
# SD high speed and show HDMI diagnostics
107+
# Boot from partition 2 with debug option.
108+
[partition=62]
109+
# Only high (>31) partition can be remapped.
110+
PARTITION=2
111+
SD_QUIRKS=0x1
112+
HDMI_DELAY=0
113+
----
114+
115+
Example `config.txt` - (Currently Raspberry Pi 5 onwards)
116+
[source,ini]
117+
----
118+
# config.txt - If the original requested partition number in PM_RSTS was a
119+
# special number then use an alternate cmdline.txt
120+
[partition=62]
121+
cmdline=cmdline-recovery.txt
122+
----
123+
124+
The raw value of the `PM_RSTS` register at bootup is available via `/proc/device-tree/chosen/bootloader/rsts` and the final partition number used for booting is available via `/proc/device-tree/chosen/bootloader/partition`. These are big-endian binary values.
125+
126+
99127
=== The `[tryboot]` filter
100128

101129
This filter succeeds if the `tryboot` reboot flag was set.

documentation/asciidoc/computers/raspberry-pi/eeprom-bootloader.adoc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,19 @@ Max length: 32 characters
499499
The `PARTITION` option may be used to specify the boot partition number, if it has not explicitly been set by the `reboot` command (e.g. `sudo reboot N`) or by `boot_partition=N` in `autoboot.txt`.
500500
This could be used to boot from a rescue partition if the user presses a button.
501501

502+
The latest firmware also allows high partition numbers (> 31) to be overriden. This allows a custom setup of the system hardware watchdog to trigger a reboot with a special high partition number (e.g. 62) which can be detected by the bootloader (using a conditional filter) and remapped to a recovery partition.
503+
504+
Example:
505+
[source,ini]
506+
----
507+
# System watchdog fired - boot the rescue partition with additional options
508+
# Disable SD high speed mode and enable HDMI diagnostics immediately.
509+
[partition=62]
510+
PARTITION=2
511+
HDMI_DELAY=0
512+
SD_QUIRKS=1
513+
----
514+
502515
[source,ini]
503516
----
504517
# Boot from partition 2 if GPIO 7 is pulled low

0 commit comments

Comments
 (0)