A device tree is a hardware description passed on from the boot loader to the kernel. Spec: https://www.devicetree.org/
Parsing is done with libfdt from https://github.com/dgibson/dtc (see kernel/lib/libfdt/readme.txt
for details).
The device tree gets parsed early in the boot process in main(). This defines the memory_map_kernel (total RAM, mapped devices) and a list of devices to init.
To dump the device tree of qemu run:
make PLATFORM=qemu qemu-dump-tree
This will generate tree.dtb
and tree.dts
. Requires the dtc app.
To dump the device tree of Spike run:
make PLATFORM=spike spike-dump-tree
This will print the tree to the console.
On a real device like the VisionFive 2 enter U-Boot and print the device tree with:
StarFive # fdt print /