On Wed, May 20, 2020 at 10:50 PM Patrice CHOTARD <patrice.chot...@st.com> wrote: > > Hi Masahiro > > As indicated into doc/README.fdt-control, it's possible build U-boot with > specifying dts-file-name using > $ make DEVICE_TREE=<dts-file-name>
I think this doc might be misleading. The intended usage is like this. If you see arch/arm/dts/Makefile, each platform typically has multiple DTBs. dtb-$(CONFIG_ARCH_FOO) += \ foo-board1.dtb \ foo-board2.dtb \ foo-board3.dtb When you build for CONFIG_ARCH_FOO, all of the three are compiled, but U-Boot needs to pick one to bind. If you have CONFIG_DEFAULT_DEVICE_TREE=foo-board1.dtb in the configuration, foo-board1.dtb is appended to the final u-boot binary. If you want to choose a different DTB, you can also do "make DEVICE_TREE=foo-board2.dtb" from the command line, but it must be chosen from the DTBs added to dtb-y. DEVICE_TREE=foo-board4.dtb just fails because there is no dtb-y entry for that. > But since your commit a3444bd09af9 ("Revert "Ensure device tree DTS is > compiled") it's no more possible: Right. Before a3444bd09af9, you was able to build whichever device tree without having the correct entry to Makefile. As 89c2b5c02049aea pointed out, people really did not care (or even notice) whether arch/arm/dts/Makefile is correct or not. That was why DEVICE_TREE=trial was previously working. > make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE -j 16 DEVICE_TREE="trial" > > Device Tree Source is not correctly specified. > Please define 'CONFIG_DEFAULT_DEVICE_TREE' > or build with 'DEVICE_TREE=<device_tree>' argument > > dts/Makefile:28: recipe for target 'arch/arm/dts/trial.dtb' failed > make[1]: *** [arch/arm/dts/trial.dtb] Error 1 > Makefile:1087: recipe for target 'dts/dt.dtb' failed This is because there is no entry for trial.dtb in arch/arm/dts/Makefile. You need to add "dtb-y += trial.dtb" to arch/arm/dts/Makefile. Please let me know what you want to do. Your device tree is not upstreamed. You want to drop it in the tree, and build it without modifying the source tree. Is this correct? The current U-Boot cannot do that. Each device tree needs to be wired up to arch/<arch>/dts/Makefile. I know a counter approach was proposed in the past. See this patch: http://patchwork.ozlabs.org/project/uboot/patch/1451223875-20914-3-git-send-email-tho...@wytron.com.tw/ It stops maintaining arch/<arch>/dts/Makefile, then people can set CONFIG_DEFAULT_DEVICE_TREE to compile whatever device tree. I think it was one idea, but not adopted. If you want to separate your DT from upstream code, EXT_DTB might be used to append externally built DTB. See these commits: 63b4b5bae52e48528876e13e858ef934ac2e4a3b d18926af30d111362c6262c356feb768d7a367a3 > make: *** [dts/dt.dtb] Error 2 > > By reverting the above patch, it's restoring the attended behavior. But In > your commit you indicated several issues. > > Unfortunately, i am not a Makefile "expert", can anybody have a look at it ? > > Thanks > > Patrice -- Best Regards Masahiro Yamada