Understanding DeviceTree in Linux Systems
DeviceTree, a tree data structure describing system hardware, is used in booting processes. It simplifies and speeds up hardware configuration without involving firmware like ACPI or UEFI. This introduction covers topics such as basic syntax, booting procedures, and its significance in Linux systems.
Download Presentation
Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
E N D
Presentation Transcript
Introduction to DeviceTree Introduction to DeviceTree Saurabh Singh Sengar Saurabh Singh Sengar Linux Systems Group, Microsoft ssengar@microsoft.com
Agenda Agenda What is DeviceTree Booting with DeviceTree Basic DeviceTree Syntax DeviceTree Compiler Upstreaming DTS DeviceTree on x86
What is DeviceTree (DT) What is DeviceTree (DT) A tree data structure with nodes that describe the system hardware. Open Firmware Flattened Device Tree (FDT) Support 6 arch (arm, microblaze, mips, powerpc, sparc, and x86) No firmware involved. Contrary to ACPI/UEFI/ATAGS/OpenFirmware. Simpler & faster.
Booting with DeviceTree Booting with DeviceTree The kernel no longer contains the description of the hardware, it is located in a separate binary: the device tree blob. The bootloader loads two binaries: the kernel image and the DTB. The bootloader passes the DTB address through r2. U-Boot command: bootm <kernel img addr> - <dtb addr> Some boot loaders doesn t have support for DT.
Basic Device Tree Syntax Basic Device Tree Syntax
Basic Device Tree Syntax Basic Device Tree Syntax reg #address-cells #size-cells interrupt-controller #interrupt-cells interrupt-parent interrupts
Basic Device Tree Syntax Basic Device Tree Syntax cpus: Its each node describing each CPU in the system. memory : Defines location and size of the RAM. chosen : Defines parameters chosen. aliases: shortcuts to certain nodes. phandle: link to other nodes in DT. / root node
Basic Device Tree Syntax Basic Device Tree Syntax
Basic Device Tree Syntax Basic Device Tree Syntax Maintain hierarchy 'compatible' property represents a device. Platform Devices can be anywhere.
Device Tree Compiler Device Tree Compiler scripts/dtc/dtc Compiles the DTS (DeviceTree Source) to binary blob DTB (DeviceTree blob). dtc -I dts -O dtb -o my_tree.dtb my_tree.dts Compiles back DTB to DTS as well. dtc -I dtb -O dts -o my_tree.dts my_tree.dtb One .dts & many .dtsi
Device Tree Compiler Device Tree Compiler
Getting the resources from DTB Getting the resources from DTB of_address_to_resource irq_of_parse_and_map of_find_property of_property_read_bool of_get_parent of_property_read_*
Upstreaming DTS Upstreaming DTS DT bindings: Documentation/devicetree/bindings/ dt_binding_check: The DT schema binding documents must be validated using the meta-schema to ensure they are both valid json-schema and valid binding schema. make dt_binding_check DT_SCHEMA_FILES=trivial-devices.yaml dtbs_check: Validation of DT source files. make dtbs_check make CHECK_DTBS=y qcom/sm8450-hdk.dtb make CHECK_DTBS=y DT_SCHEMA_FILES=/gpio/ qcom/sm8450-hdk.dtb
DeviceTree on x86 DeviceTree on x86 x86 DT is not very common. DT support for Hyper-V VMBus driver. x86/of: Move the x86_flattree_get_config() call out of x86_dtb_init(). x86/numa: Add DT support. SMT enablement.
DT enablement for Hyper DT enablement for Hyper- -V V
DT enablement for Hyper DT enablement for Hyper- -V V
DT enablement for Hyper DT enablement for Hyper- -V V
DT enablement for Hyper DT enablement for Hyper- -V V
References References o https://saurabhsengarblog.wordpress.com/2015/11/28/device-tree-tutorial-arm/ o https://elinux.org/Device_Tree_Usage o https://docs.kernel.org/devicetree/usage-model.html o https://www.kernel.org/doc/Documentation/devicetree/writing-schema.md