Skip to content

Commit fe0d22c

Browse files
author
Alasdair Allan
authored
Merge pull request raspberrypi#2554 from timg236/device-tree-chosen
configuration: Describe the RPi specific /chosen DT parameters
2 parents ad6558f + d4fc0b9 commit fe0d22c

File tree

1 file changed

+127
-8
lines changed

1 file changed

+127
-8
lines changed

documentation/asciidoc/computers/configuration/device-tree.adoc

Lines changed: 127 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ In the event that a platform is not listed for an overlay, one of the special di
512512

513513
Remember: only exceptions need to be listed - the absence of a node for an overlay means that the default file should be used for all platforms.
514514

515-
Accessing diagnostic messages from the firmware is covered in <<part4.1,Debugging>>.
515+
Accessing diagnostic messages from the firmware is covered in <<part5.1,Debugging>>.
516516

517517
The `dtoverlay` and `dtmerge` utilities have been extended to support the map file:
518518

@@ -798,9 +798,127 @@ The loading of overlays at runtime is a recent addition to the kernel, and so fa
798798
As it is too time-consuming to document the individual overlays here, please refer to the https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README[README] file found alongside the overlay `.dtbo` files in `/boot/overlays`. It is kept up-to-date with additions and changes.
799799

800800
[[part4]]
801+
=== Firmware parameters
802+
The firmware uses the special https://www.kernel.org/doc/html/latest/devicetree/usage-model.html#runtime-configuration[/chosen] node to pass parameters between the bootloader and/or firmware and the operating system.
803+
804+
`boot-mode` - 32-bit integer
805+
806+
The boot-mode used to load the kernel. See xref:raspberry-pi.adoc#BOOT_ORDER[BOOT_ORDER].
807+
808+
`overlay_prefix` - string
809+
810+
The xref:config_txt.adoc#overlay_prefix[overlay_prefix] string selected by `config.txt`.
811+
812+
`os_prefix` - string
813+
814+
The xref:config_txt.adoc#os_prefix[os_prefix] string selected by `config.txt`.
815+
816+
`partition` - 32-bit integer
817+
818+
The partition number used during boot.
819+
820+
`pm_rsts` - 32-bit integer
821+
822+
The value of the `PM_RSTS` register during boot.
823+
824+
`rpi-boardrev-ext` - 32-bit integer
825+
826+
The extended board revision code from xref:raspberry-pi.adoc#otp-register-and-bit-definitions[OTP row 33].
827+
828+
`rpi-country-code` - 32-bit integer
829+
830+
The country code used used by https://github.com/raspberrypi-ui/piwiz[PiWiz] - Pi400 only.
831+
832+
==== BCM2711 bootloader properties `/chosen/bootloader`
833+
The following properties are specific to BCM2711 SPI EEPROM bootloader.
834+
835+
`build_timestamp` - 32-bit integer
836+
837+
The UTC build time for the EEPROM bootloader.
838+
839+
`capabilities` - 32-bit integer
840+
841+
This bit field, which describes the features supported by the current bootloader. This may be used to check whether a feature (e.g. USB boot) is supported before enabling it in the bootloader EEPROM config.
842+
843+
|===
844+
| Bit | Feature
845+
846+
| 0
847+
| xref:raspberry-pi.adoc#usb-mass-storage-boot[USB boot] using the VLI USB host controller.
848+
849+
| 1
850+
| xref:remote-access.adoc#network-boot-your-raspberry-pi[Network boot]
851+
852+
| 2
853+
| xref:raspberry-pi.adoc#fail-safe-os-updates-tryboot[TRYBOOT]
854+
855+
| 3
856+
| xref:raspberry-pi.adoc#usb-mass-storage-boot[USB boot] using the BCM2711 USB host controller.
857+
858+
| 4
859+
| xref:raspberry-pi.adoc#boot_ramdisk[RAM disk - boot.img]
860+
861+
| 5
862+
| xref:raspberry-pi.adoc#nvme-ssd-boot[NVMe boot]
863+
864+
| 6
865+
| https://github.com/raspberrypi/usbboot/blob/master/Readme.md#secure-boot[Secure Boot]
866+
|===
867+
868+
`update_timestamp` - 32-bit integer
869+
870+
The UTC update timestamp set by `rpi-eeprom-update`.
871+
872+
`signed_boot` - 32-bit integer
873+
874+
If secure-boot is enabled then this bit field will be non-zero. The individual bits indicate the current secure-boot configuration.
875+
876+
|===
877+
| Bit | Description
878+
879+
| 0
880+
| `SIGNED_BOOT` was defined in the EEPROM config file.
881+
882+
| 1
883+
| Reserved.
884+
885+
| 2
886+
| The ROM development key has been revoked. See xref:raspberry-pi.adoc#revoke_devkey[revoke_devkey].
887+
888+
| 3
889+
| The customer public key digest has been written to OTP. See xref:raspberry-pi.adoc#program_pubkey[program_pubkey].
890+
891+
| 4..31
892+
| Reserved.
893+
|===
894+
895+
`version` - string
896+
897+
The Git version string for the bootloader.
898+
899+
==== BCM2711 USB boot properties `/chosen/bootloader/usb`
900+
The following properties are defined if the system was booted from USB. These may be used to uniquely identify the USB boot device.
901+
902+
`usb-version` - 32-bit integer
903+
904+
The USB major protocol version (2 or 3).
905+
906+
`route-string` - 32-bit integer
907+
The USB route-string identifier for the device as defined by the USB 3.0 specification.
908+
909+
`root-hub-port-number` - 32-bit integer
910+
911+
The root hub port number that the boot device is connected to - possibly via other USB hubs.
912+
913+
`lun` - 32-bit integer
914+
915+
The Logical Unit Number for the mass-storage device.
916+
917+
918+
[[part5]]
801919
=== Troubleshooting
802920

803-
[[part4.1]]
921+
[[part5.1]]
804922
==== Debugging
805923

806924
The loader will skip over missing overlays and bad parameters, but if there are serious errors, such as a missing or corrupt base DTB or a failed overlay merge, then the loader will fall back to a non-DT boot. If this happens, or if your settings don't behave as you expect, it is worth checking for warnings or errors from the loader:
@@ -833,7 +951,7 @@ MODULE_DEVICE_TABLE(of, xxx_of_match);
833951

834952
Failing that, `depmod` has failed or the updated modules haven't been installed on the target filesystem.
835953

836-
[[part4.2]]
954+
[[part5.2]]
837955
==== Testing overlays using dtmerge, dtdiff and ovmerge
838956

839957
Alongside the `dtoverlay` and `dtparam` commands is a utility for applying an overlay to a DTB - `dtmerge`. To use it you first need to obtain your base DTB, which can be obtained in one of two ways:
@@ -929,7 +1047,7 @@ to get:
9291047

9301048
The https://github.com/raspberrypi/utils[Utils] repo includes another DT utility - `ovmerge`. Unlike `dtmerge`, `ovmerge` combines file and applies overlays in source form. Because the overlay is never compiled, labels are preserved and the result is usually more readable. It also has a number of other tricks, such as the ability to list the order of file inclusion.
9311049

932-
[[part4.3]]
1050+
[[part5.3]]
9331051
==== Forcing a specific Device Tree
9341052

9351053
If you have very specific needs that aren't supported by the default DTBs, or if you just want to experiment with writing your own DTs, you can tell the loader to load an alternate DTB file like this:
@@ -938,7 +1056,7 @@ If you have very specific needs that aren't supported by the default DTBs, or if
9381056
device_tree=my-pi.dtb
9391057
----
9401058

941-
[[part4.4]]
1059+
[[part5.4]]
9421060
==== Disabling Device Tree usage
9431061

9441062
Since the switch to the 4.4 kernel and the use of more upstream drivers, Device Tree usage is required in Raspberry Pi Linux kernels. However, for bare metal and other OSs, the method of disabling DT usage is to add:
@@ -949,7 +1067,7 @@ device_tree=
9491067

9501068
to `config.txt`.
9511069

952-
[[part4.5]]
1070+
[[part5.5]]
9531071
==== Shortcuts and syntax variants
9541072

9551073
The loader understands a few shortcuts:
@@ -967,7 +1085,7 @@ dtparam=i2c,i2s
9671085

9681086
(`i2c` is an alias of `i2c_arm`, and the `=on` is assumed). It also still accepts the long-form versions: `device_tree_overlay` and `device_tree_param`.
9691087

970-
[[part4.6]]
1088+
[[part5.6]]
9711089
==== Other DT commands available in config.txt
9721090

9731091
`device_tree_address`
@@ -987,7 +1105,8 @@ Specifies a subdirectory/prefix from which to load overlays - defaults to "overl
9871105

9881106
Further ports can be controlled by the DT, for more details see <<part3,section 3>>.
9891107

990-
[[part4.7]]
1108+
[[part5.7]]
9911109
==== Further help
9921110

9931111
If you've read through this document and not found the answer to a Device Tree problem, there is help available. The author can usually be found on Raspberry Pi forums, particularly the https://forums.raspberrypi.com/viewforum.php?f=107[Device Tree] forum.
1112+

0 commit comments

Comments
 (0)