passing FDT(flattened device tree) to kernel during booting

Martin Kaiser lists at kaiser.cx
Sat Oct 24 05:41:52 EDT 2020


Thus wrote 김찬 (ckim at etri.re.kr):

> I read here
> (https://www.kernel.org/doc/Documentation/arm64/booting.txt
> https://www.kernel.org/doc/Documentation/arm64/booting.txt) the device
> tree blob location should be passed to the kernel during  arm64
> booting through x0 register. But  I see many .dts files under
> arch/arm64/boot/dts for many commercial boards. Does this mean that 1)
> we are supposed to use one of these files in the bootloader program to
> setup the device tree and pass it to kernel?

That depends on your specific hardware.

If your board is already supported, you can use the device tree that
comes with the kernel sources.

If you built your own hardware, you have to write a device tree for it
that describes all the components on your board.

> or 2) we can embed the device tree inside the kernel during kernel
> building and just use it during the boot? 

Usually, the bootloader will load kernel and device tree into ram and
set everything up for the kernel to run and to use the device tree.

If your bootloader can't do this or if you use no bootloader at all,
it's possible to append the device tree directly to the kernel image.
Search for "config ARM_APPENDED_DTB" in arch/arm/Kconfig for details
about this.

Best regards,
Martin



More information about the Kernelnewbies mailing list