[PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

Sumit Garg sumit.garg at linaro.org
Thu Jan 4 13:23:23 CET 2024


Hi Simon,

On Thu, 28 Dec 2023 at 20:39, Simon Glass <sjg at chromium.org> wrote:
>
> Hi Tom, Sumit,
>
> On Thu, Dec 28, 2023 at 2:03 PM Tom Rini <trini at konsulko.com> wrote:
> >
> > On Thu, Dec 28, 2023 at 01:37:26PM +0000, Simon Glass wrote:
> > > Hi Sumit,
> > >
> > > On Thu, Dec 28, 2023 at 11:58 AM Sumit Garg <sumit.garg at linaro.org> wrote:
> > > >
> > > > Allow platform owners to mirror devicetree files from devitree-rebasing
> > > > directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then
> > > > build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts
> > > > directory. Also add a new Makefile for arm64.
> > > >
> > > > This will help easy migration for platforms which currently are compliant
> > > > with upstream Linux kernel devicetree files.
> > > >
> > > > Signed-off-by: Sumit Garg <sumit.garg at linaro.org>
> > > > ---
> > > >
> > > > Changes in v3:
> > > > --------------
> > > > - Minor commit message update
> > > >
> > > > Changes in v2:
> > > > --------------
> > > > - s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/
> > > >
> > > >  dts/Kconfig             | 11 +++++++++++
> > > >  dts/Makefile            | 17 ++++++++++++++---
> > > >  dts/arch/arm64/Makefile | 14 ++++++++++++++
> > > >  3 files changed, 39 insertions(+), 3 deletions(-)
> > > >  create mode 100644 dts/arch/arm64/Makefile
> > > >
> > > > diff --git a/dts/Kconfig b/dts/Kconfig
> > > > index 00c0aeff893..e58c1c6f2ab 100644
> > > > --- a/dts/Kconfig
> > > > +++ b/dts/Kconfig
> > > > @@ -85,6 +85,17 @@ config OF_LIVE
> > > >           enables a live tree which is available after relocation,
> > > >           and can be adjusted as needed.
> > > >
> > > > +config OF_UPSTREAM
> > > > +       bool "Enable use of devicetree imported from Linux kernel release"
> > > > +       help
> > > > +         Traditionally, U-Boot platforms used to have their custom devicetree
> > > > +         files or copy devicetree files from Linux kernel which are hard to
> > > > +         maintain and can usually get out-of-sync from Linux kernel. This
> > > > +         option enables platforms to migrate to devicetree-rebasing repo where
> > > > +         a regular sync will be maintained every major Linux kernel release
> > > > +         cycle. However, platforms can still have some custom u-boot specific
> > > > +         bits maintained as part of *-u-boot.dtsi files.
> > >
> > > My only other suggestion here is to mention that this should be set in
> > > Kconfig, for the SoC as a whole. So I believe that means that it
> > > should be hidden, with no string for the 'bool':
> > >
> > >       bool  # Enable use of devicetree imported from Linux kernel release
> >
> > I think we can just keep prompting for it now, to make the transition
> > easier, before this option just goes away in time, hopefully.
> >
> > > Also, this doesn't seem to work for me. Before this series I get these
> > > files when building firefly-rk3399:
> > >
> > > rk3399-eaidk-610.dtb            rk3399-khadas-edge-v.dtb
> > > rk3399-orangepi.dtb        rk3399-rock-pi-4a.dtb
> > > rk3399-evb.dtb                  rk3399-leez-p710.dtb
> > > rk3399-pinebook-pro.dtb    rk3399-rock-pi-4c.dtb
> > > rk3399-ficus.dtb                rk3399-nanopc-t4.dtb
> > > rk3399-pinephone-pro.dtb   rk3399-rockpro64.dtb
> > > rk3399-firefly.dtb              rk3399-nanopi-m4-2gb.dtb
> > > rk3399pro-rock-pi-n10.dtb  rk3399-roc-pc.dtb
> > > rk3399-gru-bob.dtb              rk3399-nanopi-m4b.dtb
> > > rk3399-puma-haikou.dtb     rk3399-roc-pc-mezzanine.dtb
> > > rk3399-gru-kevin.dtb            rk3399-nanopi-m4.dtb
> > > rk3399-rock-4c-plus.dtb
> > > rk3399-khadas-edge-captain.dtb  rk3399-nanopi-neo4.dtb    rk3399-rock-4se.dtb
> > > rk3399-khadas-edge.dtb          rk3399-nanopi-r4s.dtb     rk3399-rock960.dtb
> > >
> > > Afterwards I get this:
> > >
> > > make[3]: *** No rule to make target
> > > 'dts/arch/arm64/rk3399-firefly.dtb', needed by 'dtbs'.  Stop.
> > >
> > > So I set this manually for that one board:
> > >
> > > CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-firefly"
> > >
> > > and get:
> > >
> > > make[3]: *** No rule to make target
> > > 'dts/arch/arm64/rockchip/rk3399-firefly.dtb', needed by 'dtbs'.  Stop.
> > >
> > > I am not sure how to fix this, nor how this can be made to build all
> > > the DTs for rk3399, as it does today.
> >
> > Looking at the patch for amlogic boards, you need to make the link to
> > devicetree-rebasing inside dts/...
>
> OK, let me give up on rk3399 for now...that doesn't seem to work even
> with the link.

I went ahead to debug this rk3399 issue. It turned out to be a subtle
Makefile dependency corner case that I missed in v3. Following change
should fix the issue, I will incorporate it in v4. However, while
switching rk3399 to upstream DT I noticed many gaps from upstream DT,
one that occured to me was difference in clk id SCLK_DDRCLK (U-Boot)
vs SCLK_DDRC (upstream DT).

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index bdc1da43e7a..9526eb073f1 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -358,7 +359,7 @@ ifdef CONFIG_EFI_CAPSULE_AUTHENTICATE
 dtsi_include_list += $(capsule_esl_dtsi)
 endif

-dtsi_include_list_deps = $(addprefix $(obj)/,$(subst
$(quote),,$(dtsi_include_list)))
+dtsi_include_list_deps = $(addprefix $(u_boot_dtsi_loc)/,$(subst
$(quote),,$(dtsi_include_list)))

 ifneq ($(CHECK_DTBS),)
 DT_CHECKER ?= dt-validate

-Sumit


More information about the U-Boot-Custodians mailing list