[PATCH v3 3/8] scripts/Makefile.lib: Statically define *-u-boot.dtsi files location
Bryan Brattlof
bb at ti.com
Tue Jan 9 02:54:19 CET 2024
On January 8, 2024 thus sayeth Sumit Garg:
> Hi Bryan,
>
> On Sat, 6 Jan 2024 at 02:12, Bryan Brattlof <bb at ti.com> wrote:
> >
> > Hi Sumit!
> >
> > On December 28, 2023 thus sayeth Sumit Garg:
> > > Allow u-boot to build DTB from a different directory tree such that
> > > *-u-boot.dtsi files can be included from a common location. Currently
> > > that location is arch/$(ARCH)/dts/, so statically define that common
> > > location.
> > >
> > > This is needed for platform owners to start building DTB files from
> > > devicetree-rebasing directory but still being able to include
> > > *-u-boot.dtsi files.
> > >
> > > Reviewed-by: Tom Rini <trini at konsulko.com>
> > > Reviewed-by: Simon Glass <sjg at chromium.org>
> > > Reviewed-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> > > Signed-off-by: Sumit Garg <sumit.garg at linaro.org>
> > > ---
> > >
> >
> > ...
> >
> > >
> > > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> > > index 27b9437027c..09330421856 100644
> > > --- a/scripts/Makefile.lib
> > > +++ b/scripts/Makefile.lib
> >
> > ...
> >
> > > # Uncomment for debugging
> > > @@ -190,6 +192,7 @@ dtsi_include_list += $(CONFIG_DEVICE_TREE_INCLUDES)
> > > dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \
> > > $(UBOOTINCLUDE) \
> > > -I$(dir $<) \
> > > + -I$(u_boot_dtsi_loc) \
> > > -I$(srctree)/arch/$(ARCH)/dts/include \
> > > -I$(srctree)/include \
> > > -D__ASSEMBLY__ \
> > > @@ -328,7 +331,7 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
> > > echo '$(pound)include "$(f)"' >> $(pre-tmp);) \
> > > $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \
> > > $(DTC) -O dtb -o $@ -b 0 \
> > > - -i $(dir $<) $(DTC_FLAGS) \
> > > + -i $(dir $<) -i $(u_boot_dtsi_loc) $(DTC_FLAGS) \
> > > -d $(depfile).dtc.tmp $(dtc-tmp) || \
> > > (echo "Check $(shell pwd)/$(pre-tmp) for errors" && false) \
> > > ; \
> >
> > One of the issues I see with having a separate OF_UPSTREAM and U-Boot dt
> > directory is when we have U-Boot board files that use dtsi files in the
> > OF_UPSTREAM folder.
> >
> > For example our reference boards uses the primary bootloader's dtb (eg:
> > k3-am62a7-r5-sk.dts) which #includes the k3-am62a7-sk.dts that will be
> > found in the OF_UPSTREAM directory and modifies it to give it the
> > perspective of the micro-controller it will be running on during boot.
>
> Thanks for bringing this up. I have been playing with the idea to
> reuse DT includes from upstream.
>
> >
> > What do you think if we have both paths included regardless if
> > OF_UPSTREAM is selected or not? IDK if this will break anyone else
>
> Sure, we should be able to do that if we maintain the correct order of
> include paths as per following patch [1]. If this works for you let me
> know and I will include it for v4.
>
This works beautifully.
I did have to hack around to get Makefile.spl working but this is headed
in the right direction for me :)
Thank you
~Bryan
More information about the U-Boot
mailing list