Skip to contentSkip to conversation

boot/uboot: allow multiple target selection

Buildroot New Petr Kulhavy 3 participants 10 messages Sep 1, 2016 – Sep 17, 2016

lore
Share & tools
lore
#0 lore raw

Hi,

I'm sending two improvements to boot/uboot.

The first patch is a minor fix to make sure the SPL target is always build by the make process.

The other patch changes the current "choice" type of selection of the U-boot target format to a multi-selection. This might be useful for generating multiple uboot image formats at once. E.g. one for serial load (which typically contains some RBL formatting) and one to be stored on a filesystem or in the flash. So far this was not possible to do.

Any comments are welcome.

Thanks
Petr

#1 lore raw

PATCH 1/2 boot/uboot: add missing SPL build dependency

If SPL installation is selected make does not always build the SPL binary. Add the SPL binary explicitly to the build command.

---
 boot/uboot/uboot.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
boot/uboot/uboot.mk +1 -1
index 7c3512a..a62f7be 100644
@@ -149,7 +149,7 @@ endif # BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY
 define UBOOT_BUILD_CMDS
 	$(TARGET_CONFIGURE_OPTS) 	\
 		$(MAKE) -C $(@D) $(UBOOT_MAKE_OPTS) 		\
-		$(UBOOT_MAKE_TARGET)
+		$(UBOOT_MAKE_TARGET) $(call qstrip,$(BR2_TARGET_UBOOT_SPL_NAME))
 	$(if $(BR2_TARGET_UBOOT_FORMAT_SD),
 		$(@D)/tools/mxsboot sd $(@D)/u-boot.sb $(@D)/u-boot.sd)
 	$(if $(BR2_TARGET_UBOOT_FORMAT_NAND),
Signature · 1 line
2.7.4
#2 lore raw

PATCH 1/2 boot/uboot: add missing SPL build dependency

Quoted 1 line · Petr Kulhavy

If SPL installation is selected make does not always build the SPL binary.

Please give a concrete example of this so people can verify.

Quoted 12 lines

Add the SPL binary explicitly to the build command.

---
 boot/uboot/uboot.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
boot/uboot/uboot.mk +0 -0
index 7c3512a..a62f7be 100644

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

Quoted 5 lines
boot/uboot/uboot.mk +1 -1
@@ -149,7 +149,7 @@ endif # BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY
 define UBOOT_BUILD_CMDS
 	$(TARGET_CONFIGURE_OPTS) 	\
 		$(MAKE) -C $(@D) $(UBOOT_MAKE_OPTS) 		\
-		$(UBOOT_MAKE_TARGET)
+		$(UBOOT_MAKE_TARGET) $(call qstrip,$(BR2_TARGET_UBOOT_SPL_NAME))

Unfortunately, this doesn't work for OMAP3. For OMAP3, the file to be copied is
"MLO", but it is not a target of the top-level Makefile. Instead, it is built while recursing in the spl subdirectory.

A workaround is to use two separate make invocations: the first one for the
normal build, the second one to build any additional SPL images. Since MLO already exists during the second invocation, make won't complain anymore.

Note BTW that the current situation is already broken for OMAP3 when using a
recent U-Boot. We only call the 'u-boot.img' target, and this _doesn't_ build MLO. We should also 'make all'. I guess we don't do 'make all' to avoid doing redundant work when SPL isn't required, but it's kind of useless :-)

You can test with this defconfig:

BR2_arm=y
BR2_cortex_a8=y
BR2_ARM_EABI=y
BR2_ARM_FPU_VFPV3=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TARGET_UBOOT=y
BR2_TARGET_UBOOT_BOARDNAME="omap3_evm"
BR2_TARGET_UBOOT_FORMAT_IMG=y
BR2_TARGET_UBOOT_SPL=y
BR2_TARGET_UBOOT_SPL_NAME="MLO"

Regards,
Arnout

Quoted 4 lines
boot/uboot/uboot.mk +0 -0
 	$(if $(BR2_TARGET_UBOOT_FORMAT_SD),
 		$(@D)/tools/mxsboot sd $(@D)/u-boot.sb $(@D)/u-boot.sd)
 	$(if $(BR2_TARGET_UBOOT_FORMAT_NAND),
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#3 lore raw

PATCH 1/2 boot/uboot: add missing SPL build dependency

Hello,

Quoted 4 lines · Arnout Vandecappelle

Note BTW that the current situation is already broken for OMAP3 when using a
recent U-Boot. We only call the 'u-boot.img' target, and this _doesn't_ build MLO. We should also 'make all'. I guess we don't do 'make all' to avoid doing redundant work when SPL isn't required, but it's kind of useless :-)

Is there a reason to not do "make all" ?

There might some image formats that are *not* produced by default (I'm thinking things like .kwb images). But maybe we need to use "make all" by default, and only in specific case use a special target.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#4 lore raw

PATCH 1/2 boot/uboot: add missing SPL build dependency

In reply to Arnout Vandecappelle
Quoted 4 lines · Arnout Vandecappelle
Quoted 1 line · Petr Kulhavy

If SPL installation is selected make does not always build the SPL binary.

Please give a concrete example of this so people can verify.

Hi Arnout

It doesn't work with the iMX "SPL" target.

Regards
Petr

Quoted 52 lines
Quoted 13 lines

Add the SPL binary explicitly to the build command.

---
  boot/uboot/uboot.mk | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
boot/uboot/uboot.mk +0 -0
index 7c3512a..a62f7be 100644

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

Quoted 5 lines
boot/uboot/uboot.mk +1 -1
@@ -149,7 +149,7 @@ endif # BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY
  define UBOOT_BUILD_CMDS
  	$(TARGET_CONFIGURE_OPTS) 	\
  		$(MAKE) -C $(@D) $(UBOOT_MAKE_OPTS) 		\
-		$(UBOOT_MAKE_TARGET)
+		$(UBOOT_MAKE_TARGET) $(call qstrip,$(BR2_TARGET_UBOOT_SPL_NAME))

Unfortunately, this doesn't work for OMAP3. For OMAP3, the file to be copied is
"MLO", but it is not a target of the top-level Makefile. Instead, it is built while recursing in the spl subdirectory.

A workaround is to use two separate make invocations: the first one for the
normal build, the second one to build any additional SPL images. Since MLO already exists during the second invocation, make won't complain anymore.

Note BTW that the current situation is already broken for OMAP3 when using a
recent U-Boot. We only call the 'u-boot.img' target, and this _doesn't_ build MLO. We should also 'make all'. I guess we don't do 'make all' to avoid doing redundant work when SPL isn't required, but it's kind of useless :-)

You can test with this defconfig:

BR2_arm=y
BR2_cortex_a8=y
BR2_ARM_EABI=y
BR2_ARM_FPU_VFPV3=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TARGET_UBOOT=y
BR2_TARGET_UBOOT_BOARDNAME="omap3_evm"
BR2_TARGET_UBOOT_FORMAT_IMG=y
BR2_TARGET_UBOOT_SPL=y
BR2_TARGET_UBOOT_SPL_NAME="MLO"

Regards,
Arnout

Quoted 4 lines
boot/uboot/uboot.mk +0 -0
  	$(if $(BR2_TARGET_UBOOT_FORMAT_SD),
  		$(@D)/tools/mxsboot sd $(@D)/u-boot.sb $(@D)/u-boot.sd)
  	$(if $(BR2_TARGET_UBOOT_FORMAT_NAND),
#5 lore raw

PATCH 1/2 boot/uboot: add missing SPL build dependency

Hello,

Quoted 5 lines · Petr Kulhavy
Quoted 3 lines · Petr Kulhavy
Quoted 1 line

If SPL installation is selected make does not always build the SPL binary.

Please give a concrete example of this so people can verify.

It doesn't work with the iMX "SPL" target.

I believe that if we invoke "make all", it will solve your problem as well. What the SPL target does is:

SPL: spl/u-boot-spl.bin FORCE

And what make all does is:

all: $(ALL-y)
ALL-$(CONFIG_SPL) += spl/u-boot-spl.bin

So as soon as CONFIG_SPL=y in the U-Boot configuration, the SPL will be built if we do "make all". So I suggest that we do:

boot/uboot/uboot.mk +2 -2
index 7379a4d..d0dbf6a 100644
@@ -68,7 +68,7 @@ endif
 
 ifeq ($(BR2_TARGET_UBOOT_FORMAT_DTB_IMG),y)
 UBOOT_BINS += u-boot-dtb.img
-UBOOT_MAKE_TARGET += all u-boot-dtb.img
+UBOOT_MAKE_TARGET += u-boot-dtb.img
 endif
 
 ifeq ($(BR2_TARGET_UBOOT_FORMAT_IMG),y)
@@ -179,7 +179,7 @@ endif # BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY
 define UBOOT_BUILD_CMDS
        $(TARGET_CONFIGURE_OPTS)        \
                $(MAKE) -C $(@D) $(UBOOT_MAKE_OPTS)             \
-               $(UBOOT_MAKE_TARGET)
+               all $(UBOOT_MAKE_TARGET)
        $(if $(BR2_TARGET_UBOOT_FORMAT_SD),
                $(@D)/tools/mxsboot sd $(@D)/u-boot.sb $(@D)/u-boot.sd)
        $(if $(BR2_TARGET_UBOOT_FORMAT_NAND),

Petr, does this fix the problem for you? Arnout, what do you think?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#6 lore raw

PATCH 2/2 boot/uboot: allow to build multiple Uboot images

In reply to Petr Kulhavy

Sometimes it is desired to build multiple U-boot images. E.g. one to save into flash memory and one for serial load. This was not possible.

This change allows to select any combination of the target formats. They are all copied to the image folder.

---
 boot/uboot/Config.in |  9 +++--
 boot/uboot/uboot.mk  | 98 +++++++++++++++++++++++++++++++++-------------------
 2 files changed, 67 insertions(+), 40 deletions(-)
boot/uboot/Config.in +4 -5
index b024b66..23af845 100644
@@ -137,9 +137,7 @@ config BR2_TARGET_UBOOT_NEEDS_DTC
 	  Select this option if your U-Boot board configuration
 	  requires the Device Tree compiler to be available.
 
-choice
-	prompt "U-Boot binary format"
-	default BR2_TARGET_UBOOT_FORMAT_BIN
+menu "U-Boot binary format"
 
 config BR2_TARGET_UBOOT_FORMAT_AIS
 	bool "u-boot.ais"
@@ -150,6 +148,7 @@ config BR2_TARGET_UBOOT_FORMAT_AIS
 
 config BR2_TARGET_UBOOT_FORMAT_BIN
 	bool "u-boot.bin"
+	default true
 
 config BR2_TARGET_UBOOT_FORMAT_DTB_IMG
 	bool "u-boot-dtb.img"
@@ -255,8 +254,6 @@ config BR2_TARGET_UBOOT_FORMAT_CUSTOM
 	  you should select this option and specify the correct name
 	  in BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME.
 
-endchoice
-
 config BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME
 	string "U-Boot binary format: custom name"
 	depends on BR2_TARGET_UBOOT_FORMAT_CUSTOM
@@ -265,6 +262,8 @@ config BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME
 	  U-Boot, if it is not one of the default names. For example:
 	  u-boot_magic.bin
 
+endmenu
+
 config BR2_TARGET_UBOOT_OMAP_IFT
 	depends on BR2_TARGET_UBOOT_FORMAT_BIN
 	depends on BR2_arm || BR2_armeb
boot/uboot/uboot.mk +63 -35

119 lines not on this page · raw message

Signature · 1 line
2.7.4
#7 lore raw

PATCH 2/2 boot/uboot: allow to build multiple Uboot images

Quoted 2 lines · Petr Kulhavy

Sometimes it is desired to build multiple U-boot images. E.g. one to save into flash memory and one for serial load. This was not possible.

So this would be u-boot.bin and u-boot.img, right? I guess actually the only
sane combination would be u-boot.bin together with something else. Oh, u-boot.elf might be useful as well.

But anyway, this way is much simpler than if we decide which combinations are sane.

Quoted 26 lines

This change allows to select any combination of the target formats. They are all copied to the image folder.

---
 boot/uboot/Config.in |  9 +++--
 boot/uboot/uboot.mk  | 98 +++++++++++++++++++++++++++++++++-------------------
 2 files changed, 67 insertions(+), 40 deletions(-)
boot/uboot/Config.in +1 -3
index b024b66..23af845 100644
@@ -137,9 +137,7 @@ config BR2_TARGET_UBOOT_NEEDS_DTC
 	  Select this option if your U-Boot board configuration
 	  requires the Device Tree compiler to be available.
 
-choice
-	prompt "U-Boot binary format"
-	default BR2_TARGET_UBOOT_FORMAT_BIN
+menu "U-Boot binary format"
 
 config BR2_TARGET_UBOOT_FORMAT_AIS
 	bool "u-boot.ais"

boot/uboot/Config.in config BR2_TARGET_UBOOT_FORMAT_AIS · line 151

Quoted 4 lines
boot/uboot/Config.in +1 -0
@@ -150,6 +148,7 @@ config BR2_TARGET_UBOOT_FORMAT_AIS
 
 config BR2_TARGET_UBOOT_FORMAT_BIN
 	bool "u-boot.bin"
+	default true

default y, not true.

boot/uboot/Config.in config BR2_TARGET_UBOOT_FORMAT_CUSTOM · line 259

Quoted 12 lines
boot/uboot/Config.in +0 -2
 config BR2_TARGET_UBOOT_FORMAT_DTB_IMG
 	bool "u-boot-dtb.img"
@@ -255,8 +254,6 @@ config BR2_TARGET_UBOOT_FORMAT_CUSTOM
 	  you should select this option and specify the correct name
 	  in BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME.
 
-endchoice
-
 config BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME
 	string "U-Boot binary format: custom name"
 	depends on BR2_TARGET_UBOOT_FORMAT_CUSTOM

Please update the help text here to say that it can be a space-separate list of
custom names. Also change the prompt name -> names.

Quoted 121 lines
boot/uboot/Config.in +2 -0
@@ -265,6 +262,8 @@ config BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME
 	  U-Boot, if it is not one of the default names. For example:
 	  u-boot_magic.bin
 
+endmenu
+
 config BR2_TARGET_UBOOT_OMAP_IFT
 	depends on BR2_TARGET_UBOOT_FORMAT_BIN
 	depends on BR2_arm || BR2_armeb
boot/uboot/uboot.mk +59 -33
index a62f7be..255ae01 100644
@@ -37,47 +37,73 @@ endif
 endif
 
 ifeq ($(BR2_TARGET_UBOOT_FORMAT_ELF),y)
-UBOOT_BIN = u-boot
+UBOOT_BIN += u-boot
 # To make elf usable for debuging on ARC use special target
 ifeq ($(BR2_arc),y)
-UBOOT_MAKE_TARGET = mdbtrick
+UBOOT_MAKE_TARGET += mdbtrick
 endif
-else ifeq ($(BR2_TARGET_UBOOT_FORMAT_KWB),y)
-UBOOT_BIN = u-boot.kwb
-UBOOT_MAKE_TARGET = $(UBOOT_BIN)
-else ifeq ($(BR2_TARGET_UBOOT_FORMAT_AIS),y)
-UBOOT_BIN = u-boot.ais
-UBOOT_MAKE_TARGET = $(UBOOT_BIN)
-else ifeq ($(BR2_TARGET_UBOOT_FORMAT_LDR),y)
-UBOOT_BIN = u-boot.ldr
-else ifeq ($(BR2_TARGET_UBOOT_FORMAT_NAND_BIN),y)
-UBOOT_BIN = u-boot-nand.bin
-else ifeq ($(BR2_TARGET_UBOOT_FORMAT_DTB_IMG),y)
-UBOOT_BIN = u-boot-dtb.img
-UBOOT_MAKE_TARGET = all $(UBOOT_BIN)
-else ifeq ($(BR2_TARGET_UBOOT_FORMAT_IMG),y)
-UBOOT_BIN = u-boot.img
-else ifeq ($(BR2_TARGET_UBOOT_FORMAT_IMX),y)
-UBOOT_BIN = u-boot.imx
-else ifeq ($(BR2_TARGET_UBOOT_FORMAT_SB),y)
-UBOOT_BIN = u-boot.sb
-UBOOT_MAKE_TARGET = $(UBOOT_BIN)
+endif
+
+ifeq ($(BR2_TARGET_UBOOT_FORMAT_KWB),y)
+UBOOT_BIN += u-boot.kwb
+UBOOT_MAKE_TARGET += u-boot.kwb
+endif
+
+ifeq ($(BR2_TARGET_UBOOT_FORMAT_AIS),y)
+UBOOT_BIN += u-boot.ais
+UBOOT_MAKE_TARGET += u-boot.ais
+endif
+
+ifeq ($(BR2_TARGET_UBOOT_FORMAT_LDR),y)
+UBOOT_BIN += u-boot.ldr
+endif
+
+ifeq ($(BR2_TARGET_UBOOT_FORMAT_NAND_BIN),y)
+UBOOT_BIN += u-boot-nand.bin
+endif
+
+ifeq ($(BR2_TARGET_UBOOT_FORMAT_DTB_IMG),y)
+UBOOT_BIN += u-boot-dtb.img
+UBOOT_MAKE_TARGET += all u-boot-dtb.img
+endif
+
+ifeq ($(BR2_TARGET_UBOOT_FORMAT_IMG),y)
+UBOOT_BIN += u-boot.img
+UBOOT_MAKE_TARGET += u-boot.img
+endif
+
+ifeq ($(BR2_TARGET_UBOOT_FORMAT_IMX),y)
+UBOOT_BIN += u-boot.imx
+UBOOT_MAKE_TARGET += u-boot.imx
+endif
+
+ifeq ($(BR2_TARGET_UBOOT_FORMAT_SB),y)
+UBOOT_BIN += u-boot.sb
+UBOOT_MAKE_TARGET += u-boot.sb
 # mxsimage needs OpenSSL
 UBOOT_DEPENDENCIES += host-elftosb host-openssl
-else ifeq ($(BR2_TARGET_UBOOT_FORMAT_SD),y)
+endif
+
+ifeq ($(BR2_TARGET_UBOOT_FORMAT_SD),y)
 # BootStream (.sb) is generated by U-Boot, we convert it to SD format
-UBOOT_BIN = u-boot.sd
-UBOOT_MAKE_TARGET = u-boot.sb
+UBOOT_BIN += u-boot.sd
+UBOOT_MAKE_TARGET += u-boot.sb
 UBOOT_DEPENDENCIES += host-elftosb host-openssl
-else ifeq ($(BR2_TARGET_UBOOT_FORMAT_NAND),y)
-UBOOT_BIN = u-boot.nand
-UBOOT_MAKE_TARGET = u-boot.sb
+endif
+
+ifeq ($(BR2_TARGET_UBOOT_FORMAT_NAND),y)
+UBOOT_BIN += u-boot.nand
+UBOOT_MAKE_TARGET += u-boot.sb
 UBOOT_DEPENDENCIES += host-elftosb host-openssl
-else ifeq ($(BR2_TARGET_UBOOT_FORMAT_CUSTOM),y)
-UBOOT_BIN = $(call qstrip,$(BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME))
-else
-UBOOT_BIN = u-boot.bin
-UBOOT_BIN_IFT = $(UBOOT_BIN).ift
+endif
+
+ifeq ($(BR2_TARGET_UBOOT_FORMAT_CUSTOM),y)
+UBOOT_BIN += $(call qstrip,$(BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME))
+endif
+
+ifeq ($(BR2_TARGET_UBOOT_OMAP_IFT),y)
+UBOOT_BIN += u-boot.bin
+UBOOT_BIN_IFT = u-boot.bin.ift
 endif
 
 # The kernel calls AArch64 'arm64', but U-Boot calls it just 'arm', so

boot/uboot/uboot.mk define UBOOT_BUILD_OMAP_IFT · line 195

Quoted 5 lines
boot/uboot/uboot.mk +1 -1
@@ -166,9 +192,11 @@ define UBOOT_BUILD_OMAP_IFT
 endef
 
 define UBOOT_INSTALL_IMAGES_CMDS
-	cp -dpf $(@D)/$(UBOOT_BIN) $(BINARIES_DIR)/
+	$(foreach f,$(call qstrip,$(UBOOT_BIN)), \

qstrip shouldn't be needed here... All the assignments are unquoted, and custom
name is already qstripped. Did you have a reason to add it?

Regards,
Arnout

Quoted 9 lines
boot/uboot/uboot.mk +3 -1
+			cp -dpf $(@D)/$(f) $(BINARIES_DIR)/
+	)
 	$(if $(BR2_TARGET_UBOOT_FORMAT_NAND),
-		cp -dpf $(@D)/$(UBOOT_MAKE_TARGET) $(BINARIES_DIR))
+		cp -dpf $(@D)/u-boot.sb $(BINARIES_DIR))
 	$(if $(BR2_TARGET_UBOOT_SPL),
 		$(foreach f,$(call qstrip,$(BR2_TARGET_UBOOT_SPL_NAME)), \
 			cp -dpf $(@D)/$(f) $(BINARIES_DIR)/
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#8 lore raw

PATCH 2/2 boot/uboot: allow to build multiple Uboot images

Hi Arnout,

Quoted 9 lines · Arnout Vandecappelle
Quoted 2 lines · Petr Kulhavy

Sometimes it is desired to build multiple U-boot images. E.g. one to save into flash memory and one for serial load. This was not possible.

So this would be u-boot.bin and u-boot.img, right? I guess actually the only
sane combination would be u-boot.bin together with something else. Oh, u-boot.elf might be useful as well.

But anyway, this way is much simpler than if we decide which combinations are sane.

This could be also u-boot.ais and u-boot.bin for TI, u-boot.img and u-boot.imx for iMX, etc.
So it's better to leave it completely open as you say.

Quoted 22 lines
Quoted 22 lines

This change allows to select any combination of the target formats. They are all copied to the image folder.

---
  boot/uboot/Config.in |  9 +++--
  boot/uboot/uboot.mk  | 98 +++++++++++++++++++++++++++++++++-------------------
  2 files changed, 67 insertions(+), 40 deletions(-)
boot/uboot/Config.in +1 -3
index b024b66..23af845 100644
@@ -137,9 +137,7 @@ config BR2_TARGET_UBOOT_NEEDS_DTC
  	  Select this option if your U-Boot board configuration
  	  requires the Device Tree compiler to be available.
 
-choice
-	prompt "U-Boot binary format"
-	default BR2_TARGET_UBOOT_FORMAT_BIN
+menu "U-Boot binary format"
 
Quoted 8 lines

boot/uboot/Config.in config BR2_TARGET_UBOOT_FORMAT_AIS · line 151

Quoted 7 lines
boot/uboot/Config.in +1 -0
  config BR2_TARGET_UBOOT_FORMAT_AIS
  	bool "u-boot.ais"
@@ -150,6 +148,7 @@ config BR2_TARGET_UBOOT_FORMAT_AIS
 
  config BR2_TARGET_UBOOT_FORMAT_BIN
  	bool "u-boot.bin"
+	default true

default y, not true.

Thanks, will correct that.

Quoted 7 lines
Quoted 7 lines
boot/uboot/Config.in +0 -0
  config BR2_TARGET_UBOOT_FORMAT_DTB_IMG
  	bool "u-boot-dtb.img"
@@ -255,8 +254,6 @@ config BR2_TARGET_UBOOT_FORMAT_CUSTOM
  	  you should select this option and specify the correct name
  	  in BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME.
 
Quoted 7 lines

boot/uboot/Config.in config BR2_TARGET_UBOOT_FORMAT_CUSTOM · line 259

Quoted 5 lines
boot/uboot/Config.in +0 -2
-endchoice
-
  config BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME
  	string "U-Boot binary format: custom name"
  	depends on BR2_TARGET_UBOOT_FORMAT_CUSTOM

Please update the help text here to say that it can be a space-separate list of
custom names. Also change the prompt name -> names.

OK.

Quoted 56 lines
Quoted 56 lines
boot/uboot/Config.in +2 -0
@@ -265,6 +262,8 @@ config BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME
  	  U-Boot, if it is not one of the default names. For example:
  	  u-boot_magic.bin
 
+endmenu
+
  config BR2_TARGET_UBOOT_OMAP_IFT
  	depends on BR2_TARGET_UBOOT_FORMAT_BIN
  	depends on BR2_arm || BR2_armeb
boot/uboot/uboot.mk +13 -22
index a62f7be..255ae01 100644
@@ -37,47 +37,73 @@ endif
  endif
 
  ifeq ($(BR2_TARGET_UBOOT_FORMAT_ELF),y)
-UBOOT_BIN = u-boot
+UBOOT_BIN += u-boot
  # To make elf usable for debuging on ARC use special target
  ifeq ($(BR2_arc),y)
-UBOOT_MAKE_TARGET = mdbtrick
+UBOOT_MAKE_TARGET += mdbtrick
  endif
-else ifeq ($(BR2_TARGET_UBOOT_FORMAT_KWB),y)
-UBOOT_BIN = u-boot.kwb
-UBOOT_MAKE_TARGET = $(UBOOT_BIN)
-else ifeq ($(BR2_TARGET_UBOOT_FORMAT_AIS),y)
-UBOOT_BIN = u-boot.ais
-UBOOT_MAKE_TARGET = $(UBOOT_BIN)
-else ifeq ($(BR2_TARGET_UBOOT_FORMAT_LDR),y)
-UBOOT_BIN = u-boot.ldr
-else ifeq ($(BR2_TARGET_UBOOT_FORMAT_NAND_BIN),y)
-UBOOT_BIN = u-boot-nand.bin
-else ifeq ($(BR2_TARGET_UBOOT_FORMAT_DTB_IMG),y)
-UBOOT_BIN = u-boot-dtb.img
-UBOOT_MAKE_TARGET = all $(UBOOT_BIN)
-else ifeq ($(BR2_TARGET_UBOOT_FORMAT_IMG),y)
-UBOOT_BIN = u-boot.img
-else ifeq ($(BR2_TARGET_UBOOT_FORMAT_IMX),y)
-UBOOT_BIN = u-boot.imx
-else ifeq ($(BR2_TARGET_UBOOT_FORMAT_SB),y)
-UBOOT_BIN = u-boot.sb
-UBOOT_MAKE_TARGET = $(UBOOT_BIN)
+endif
+
+ifeq ($(BR2_TARGET_UBOOT_FORMAT_KWB),y)
+UBOOT_BIN += u-boot.kwb
+UBOOT_MAKE_TARGET += u-boot.kwb
+endif
+
+ifeq ($(BR2_TARGET_UBOOT_FORMAT_AIS),y)
+UBOOT_BIN += u-boot.ais
+UBOOT_MAKE_TARGET += u-boot.ais
+endif
Quoted 8 lines

boot/uboot/uboot.mk endif · line 63

Quoted 8 lines
boot/uboot/uboot.mk +8 -0
+
+ifeq ($(BR2_TARGET_UBOOT_FORMAT_LDR),y)
+UBOOT_BIN += u-boot.ldr
+endif
+
+ifeq ($(BR2_TARGET_UBOOT_FORMAT_NAND_BIN),y)
+UBOOT_BIN += u-boot-nand.bin
+endif

Here I'm actually wondering why the UBOOT_MAKE_TARGET was not set. I just transformed the kind of "switch" into independent ifs. Shouldn't the UBOOT_MAKE_TARGET be set for all types?

Quoted 9 lines

boot/uboot/uboot.mk define UBOOT_BUILD_OMAP_IFT · line 195

Quoted 7 lines
boot/uboot/uboot.mk +1 -1
  # The kernel calls AArch64 'arm64', but U-Boot calls it just 'arm', so
@@ -166,9 +192,11 @@ define UBOOT_BUILD_OMAP_IFT
  endef
 
  define UBOOT_INSTALL_IMAGES_CMDS
-	cp -dpf $(@D)/$(UBOOT_BIN) $(BINARIES_DIR)/
+	$(foreach f,$(call qstrip,$(UBOOT_BIN)), \

qstrip shouldn't be needed here... All the assignments are unquoted, and custom
name is already qstripped. Did you have a reason to add it?

Ah, OK. There was no other reason behind. I will remove qstrip then.

Regards
Petr

#9 lore raw

PATCH 2/2 boot/uboot: allow to build multiple Uboot images

Quoted 3 lines · Petr Kulhavy

Here I'm actually wondering why the UBOOT_MAKE_TARGET was not set. I just transformed the kind of "switch" into independent ifs. Shouldn't the UBOOT_MAKE_TARGET be set for all types?

I believe that originally, there was no UBOOT_MAKE_TARGET, so we'd just run the
default target. But when u-boot.kwb was added in 3cd517, it became necessary to pass that target. In all other cases, however, UBOOT_MAKE_TARGET (or U_BOOT_MAKE_OPT as it was called back then) would be empty so we would still call the default target.

We should probably check if that still works when 'all' is added unconditionally.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF