Skip to contentSkip to conversation

boot/uboot: fix uboot build failure with UBOOT_CUSTOM_DTS_PATH on uboot version >= 2020.x

RFC PATCH New Giulio Benetti 2 participants 4 messages Dec 24, 2020 – Jan 14, 2021

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 boot/uboot: fix uboot build failure with UBOOT_CUSTOM_DTS_PATH on uboot version >= 2020.x

Starting from version 2020.x uboot can't build .dts files not listed in dts/Makefile leading to a build failure when trying to pass a .dts file to UBOOT_CUSTOM_DTS_PATH. So let's prepend that file(s) to dts/Makefile if UBOOT_CUSTOM_DTS_PATH is used.

---
 boot/uboot/uboot.mk | 3 +++
 1 file changed, 3 insertions(+)
boot/uboot/uboot.mk +3 -0
index d2b4e8dc60..1f5ef4b9d2 100644
@@ -296,6 +296,9 @@ endif # BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY
 UBOOT_CUSTOM_DTS_PATH = $(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_DTS_PATH))
 
 define UBOOT_BUILD_CMDS
+	$(if $(UBOOT_CUSTOM_DTS_PATH),
+		$(Q)$(SED) '1s;^;dtb-y += $(subst .dts,.dtb,$(call notdir,$(UBOOT_CUSTOM_DTS_PATH)))\n;' $(@D)/arch/$(UBOOT_ARCH)/dts/Makefile
+	)
 	$(if $(UBOOT_CUSTOM_DTS_PATH),
 		cp -f $(UBOOT_CUSTOM_DTS_PATH) $(@D)/arch/$(UBOOT_ARCH)/dts/
 	)
Signature · 1 line
2.25.1
#1 lore raw

RFC PATCH 1/1 boot/uboot: fix uboot build failure with UBOOT_CUSTOM_DTS_PATH on uboot version >= 2020.x

Hello everybody,

Quoted 15 lines · Giulio Benetti

Starting from version 2020.x uboot can't build .dts files not listed in dts/Makefile leading to a build failure when trying to pass a .dts file to UBOOT_CUSTOM_DTS_PATH. So let's prepend that file(s) to dts/Makefile if UBOOT_CUSTOM_DTS_PATH is used.

---
  boot/uboot/uboot.mk | 3 +++
  1 file changed, 3 insertions(+)
boot/uboot/uboot.mk +0 -0
index d2b4e8dc60..1f5ef4b9d2 100644

boot/uboot/uboot.mk endif # BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY · line 301

Quoted 6 lines
boot/uboot/uboot.mk +3 -0
@@ -296,6 +296,9 @@ endif # BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY
  UBOOT_CUSTOM_DTS_PATH = $(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_DTS_PATH))
 
  define UBOOT_BUILD_CMDS
+	$(if $(UBOOT_CUSTOM_DTS_PATH),
+		$(Q)$(SED) '1s;^;dtb-y += $(subst .dts,.dtb,$(call notdir,$(UBOOT_CUSTOM_DTS_PATH)))\n;' $(@D)/arch/$(UBOOT_ARCH)/dts/Makefile
+	)

This is only a proposal to understand if this is the best way to fix the problem.
The other way I see is to add a patch for uboot which does the same thing. What do you all prefer?
I've got into this because I'm adding a board that is not mainlined and while in Linux it works correctly, in uboot doesn't.

The only board that uses UBOOT_CUSTOM_DTS_PATH I see is nanopi-r1 and it builds correctly because it's based on uboot v2019.01

Kind regards

Signature · 2 lines
Giulio Benetti
Benetti Engineering sas
Quoted 4 lines
boot/uboot/uboot.mk +0 -0
  	$(if $(UBOOT_CUSTOM_DTS_PATH),
  		cp -f $(UBOOT_CUSTOM_DTS_PATH) $(@D)/arch/$(UBOOT_ARCH)/dts/
  	)
#2 lore raw

RFC PATCH 1/1 boot/uboot: fix uboot build failure with UBOOT_CUSTOM_DTS_PATH on uboot version >= 2020.x

Hi,

I ran into the same problem and your patch was useful to fix it. My UBOOT_CUSTOM_DTS_PATH contains also .dtsi files so I had to do a small change to filter those out:

$(Q)$(SED) '1s;^;dtb-y += $(subst .dts,.dtb,$(*filter %.dts*,$(call notdir,$(UBOOT_CUSTOM_DTS_PATH))))\n;' $(@D)/arch/$(UBOOT_ARCH)/dts/Makefile

Not sure if this is the "buildroot way" to fix this kind of issue, but I consider it a useful hack ;-).

Best regards,

Johan

Op do 24 dec. 2020 om 13:37 schreef Giulio Benetti < [email protected]>:

Quoted 46 lines

Hello everybody,

Quoted 2 lines · Giulio Benetti

Starting from version 2020.x uboot can't build .dts files not listed in dts/Makefile leading to a build failure when trying to pass a .dts file

to

Quoted 13 lines

UBOOT_CUSTOM_DTS_PATH. So let's prepend that file(s) to dts/Makefile if UBOOT_CUSTOM_DTS_PATH is used.

---
  boot/uboot/uboot.mk | 3 +++
  1 file changed, 3 insertions(+)
boot/uboot/uboot.mk +0 -0
index d2b4e8dc60..1f5ef4b9d2 100644

boot/uboot/uboot.mk endif # BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY · line 296

Quoted 1 line
boot/uboot/uboot.mk +0 -0
@@ -296,6 +296,9 @@ endif # BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY
  UBOOT_CUSTOM_DTS_PATH = $(call

qstrip,$(BR2_TARGET_UBOOT_CUSTOM_DTS_PATH))

boot/uboot/uboot.mk endif # BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY

Quoted 4 lines
boot/uboot/uboot.mk +2 -0
  define UBOOT_BUILD_CMDS
+     $(if $(UBOOT_CUSTOM_DTS_PATH),
+             $(Q)$(SED) '1s;^;dtb-y += $(subst .dts,.dtb,$(call

notdir,$(UBOOT_CUSTOM_DTS_PATH)))\n;' $(@D)/arch/$(UBOOT_ARCH)/dts/Makefile

boot/uboot/uboot.mk endif # BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY · line 301

Quoted 1 line
boot/uboot/uboot.mk +1 -0
+     )

This is only a proposal to understand if this is the best way to fix the problem.
The other way I see is to add a patch for uboot which does the same thing. What do you all prefer?
I've got into this because I'm adding a board that is not mainlined and while in Linux it works correctly, in uboot doesn't.

The only board that uses UBOOT_CUSTOM_DTS_PATH I see is nanopi-r1 and it builds correctly because it's based on uboot v2019.01

Kind regards
--
Giulio Benetti
Benetti Engineering sas

boot/uboot/uboot.mk endif # BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY · line 302

Quoted 2 lines
boot/uboot/uboot.mk +0 -0
      $(if $(UBOOT_CUSTOM_DTS_PATH),
              cp -f $(UBOOT_CUSTOM_DTS_PATH)

$(@D)/arch/$(UBOOT_ARCH)/dts/

Quoted 9 lines

boot/uboot/uboot.mk endif # BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY · line 304

Quoted 2 lines
boot/uboot/uboot.mk +0 -0
      )
 

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20210113/48b6219a/attachment.html>

#3 lore raw

RFC PATCH 1/1 boot/uboot: fix uboot build failure with UBOOT_CUSTOM_DTS_PATH on uboot version >= 2020.x

Hi Johan,

Cc+ Thomas

Quoted 8 lines · Johan Derycke

Hi,

I ran into the same problem and your patch was useful to fix it. My UBOOT_CUSTOM_DTS_PATH contains also .dtsi files so I had to do a small change to filter those out:

$(Q)$(SED) '1s;^;dtb-y += $(subst .dts,.dtb,$(*filter %.dts*,$(call notdir,$(UBOOT_CUSTOM_DTS_PATH))))\n;' $(@D)/arch/$(UBOOT_ARCH)/dts/Makefile

Ah yes, good idea, so also .dtsi can be copied but not compiled

Quoted 2 lines

Not sure if this is the "buildroot way" to fix this kind of issue, but I consider it a useful hack ;-).

Here is where I ask Thomas or someone else to comment, because I don't even know if my patch is decent enough to be committed(for sure there is a more elegant and more clear way to achieve this).

Is there some way to improve code readibility?

Thanks in advance
Best regards

Signature · 2 lines
Giulio Benetti
Benetti Engineering sas
Quoted 79 lines

Best regards,

Johan

Op do 24 dec. 2020 om 13:37 schreef Giulio Benetti <[email protected] <mailto:[email protected]>>:

    Hello everybody,

    On 12/24/20 1:27 PM, Giulio Benetti wrote:
     > Starting from version 2020.x uboot can't build .dts files not
    listed in
     > dts/Makefile leading to a build failure when trying to pass a
    .dts file to
     > UBOOT_CUSTOM_DTS_PATH. So let's prepend that file(s) to
    dts/Makefile if
     > UBOOT_CUSTOM_DTS_PATH is used.
     >
     > Signed-off-by: Giulio Benetti
    <[email protected]
    <mailto:[email protected]>>
     > ---
     >? ?boot/uboot/uboot.mk <http://uboot.mk> | 3 +++
     >? ?1 file changed, 3 insertions(+)
     >
     > diff --git a/boot/uboot/uboot.mk <http://uboot.mk>
    b/boot/uboot/uboot.mk <http://uboot.mk>
     > index d2b4e8dc60..1f5ef4b9d2 100644
     > --- a/boot/uboot/uboot.mk <http://uboot.mk>
     > +++ b/boot/uboot/uboot.mk <http://uboot.mk>
     > @@ -296,6 +296,9 @@ endif # BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY
     >? ?UBOOT_CUSTOM_DTS_PATH = $(call
    qstrip,$(BR2_TARGET_UBOOT_CUSTOM_DTS_PATH))
     >
     >? ?define UBOOT_BUILD_CMDS
     > +? ? ?$(if $(UBOOT_CUSTOM_DTS_PATH),
     > +? ? ? ? ? ? ?$(Q)$(SED) '1s;^;dtb-y += $(subst .dts,.dtb,$(call
    notdir,$(UBOOT_CUSTOM_DTS_PATH)))\n;'
    $(@D)/arch/$(UBOOT_ARCH)/dts/Makefile
     > +? ? ?)

    This is only a proposal to understand if this is the best way to fix
    the
    problem.
    The other way I see is to add a patch for uboot which does the same
    thing.
    What do you all prefer?
    I've got into this because I'm adding a board that is not mainlined and
    while in Linux it works correctly, in uboot doesn't.

    The only board that uses UBOOT_CUSTOM_DTS_PATH I see is nanopi-r1
    and it
    builds correctly because it's based on uboot v2019.01

    Kind regards
    -- 
    Giulio Benetti
    Benetti Engineering sas

     >? ? ? ?$(if $(UBOOT_CUSTOM_DTS_PATH),
     >? ? ? ? ? ? ? ?cp -f $(UBOOT_CUSTOM_DTS_PATH)
    $(@D)/arch/$(UBOOT_ARCH)/dts/
     >? ? ? ?)
     >


    _______________________________________________
    buildroot mailing list
    buildroot at busybox.net <mailto:[email protected]>
    http://lists.busybox.net/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot