Skip to content

Latest commit

 

History

History
42 lines (21 loc) · 1.11 KB

device_tree.md

File metadata and controls

42 lines (21 loc) · 1.11 KB

Device Tree

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.

Print Device Tree

qemu

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.

Spike

To dump the device tree of Spike run:

make PLATFORM=spike spike-dump-tree

This will print the tree to the console.

Visionfive 2

On a real device like the VisionFive 2 enter U-Boot and print the device tree with:

StarFive # fdt print /

kernel | userspace