Reputation: 7798
I need to have different variants of a device tree passed to my linux kernel dependant on a board revision that can only be determined at run time.
What's the established way of setting up the boot of the kernel to deal with various hardware layouts that can only be determined at boot time from within u-boot?
Upvotes: 1
Views: 5575
Reputation: 2211
Late answer, but i recently add to deal with the same problem.
Using u-boot , you can actually write a macro for that.
The u-boot environment variable for the device tree file is "fdtfile
".
From there, you can define a macro that set this variable according to your specific need for example :
setenv findfdt '
if test $mycondition = value1; then setenv fdtfile devicetree1.dtb; fi;
if test $mycondition = value2; then setenv fdtfile devicetree2.dtb; fi;
..'
Then you can just create a .txt file to register this macro and then use mkimage
tool to create a binary image .img for u-boot to load :
mkimage -T script -d macros.txt macros.img
You can of course wrap this macro with a more sophisticated one that will be executed at each boot.
Upvotes: 2
Reputation: 18299
The bootm
command is taking three parameters:
bootm ${kernel_addr} ${ramdisk_addr} ${fdt_addr}
While the third one is the address of the flattened device tree blob in the memory. So if you have different device trees, either load them into different memory addresses and pass them to bootm
, or load that memory address with different blobs.
Upvotes: 3