boot/uboot: allow to build multiple U-Boot images

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

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

Signed-off-by: Petr Kulhavy <brain@jikos.cz>
[Thomas:
 - Handle the BR2_TARGET_UBOOT_FORMAT_BIN, which wasn't handled, and
   therefore u-boot.bin was not copied when
   BR2_TARGET_UBOOT_FORMAT_BIN=y.
 - Rename UBOOT_BIN to UBOOT_BINS, since it can now contain multiple
   values.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit is contained in:
Petr Kulhavy 2016-09-02 14:26:26 +02:00 committed by Thomas Petazzoni
parent 373c24cd1b
commit fad58cefa4
2 changed files with 77 additions and 44 deletions

View File

@ -137,9 +137,7 @@ config BR2_TARGET_UBOOT_NEEDS_DTC
Select this option if your U-Boot board configuration Select this option if your U-Boot board configuration
requires the Device Tree compiler to be available. requires the Device Tree compiler to be available.
choice menu "U-Boot binary format"
prompt "U-Boot binary format"
default BR2_TARGET_UBOOT_FORMAT_BIN
config BR2_TARGET_UBOOT_FORMAT_AIS config BR2_TARGET_UBOOT_FORMAT_AIS
bool "u-boot.ais" bool "u-boot.ais"
@ -150,6 +148,7 @@ config BR2_TARGET_UBOOT_FORMAT_AIS
config BR2_TARGET_UBOOT_FORMAT_BIN config BR2_TARGET_UBOOT_FORMAT_BIN
bool "u-boot.bin" bool "u-boot.bin"
default y
config BR2_TARGET_UBOOT_FORMAT_DTB_IMG config BR2_TARGET_UBOOT_FORMAT_DTB_IMG
bool "u-boot-dtb.img" bool "u-boot-dtb.img"
@ -252,19 +251,21 @@ config BR2_TARGET_UBOOT_FORMAT_CUSTOM
help help
On some platforms, the standard U-Boot binary is not called On some platforms, the standard U-Boot binary is not called
u-boot.bin, but u-boot<something>.bin. If this is your case, u-boot.bin, but u-boot<something>.bin. If this is your case,
you should select this option and specify the correct name you should select this option and specify the correct name(s)
in BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME. in BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME.
endchoice
config BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME config BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME
string "U-Boot binary format: custom name" string "U-Boot binary format: custom names"
depends on BR2_TARGET_UBOOT_FORMAT_CUSTOM depends on BR2_TARGET_UBOOT_FORMAT_CUSTOM
help help
Specify the correct name of the output binary created by In case the U-Boot binary for the target platform is not among
U-Boot, if it is not one of the default names. For example: the default names, one or more custom names can be listed here.
Use space to separate multiple names.
Example:
u-boot_magic.bin u-boot_magic.bin
endmenu
config BR2_TARGET_UBOOT_OMAP_IFT config BR2_TARGET_UBOOT_OMAP_IFT
depends on BR2_TARGET_UBOOT_FORMAT_BIN depends on BR2_TARGET_UBOOT_FORMAT_BIN
depends on BR2_arm || BR2_armeb depends on BR2_arm || BR2_armeb

View File

@ -36,48 +36,78 @@ BR_NO_CHECK_HASH_FOR += $(UBOOT_SOURCE)
endif endif
endif endif
ifeq ($(BR2_TARGET_UBOOT_FORMAT_BIN),y)
UBOOT_BINS += u-boot.bin
endif
ifeq ($(BR2_TARGET_UBOOT_FORMAT_ELF),y) ifeq ($(BR2_TARGET_UBOOT_FORMAT_ELF),y)
UBOOT_BIN = u-boot UBOOT_BINS += u-boot
# To make elf usable for debuging on ARC use special target # To make elf usable for debuging on ARC use special target
ifeq ($(BR2_arc),y) ifeq ($(BR2_arc),y)
UBOOT_MAKE_TARGET = mdbtrick UBOOT_MAKE_TARGET += mdbtrick
endif endif
else ifeq ($(BR2_TARGET_UBOOT_FORMAT_KWB),y) endif
UBOOT_BIN = u-boot.kwb
UBOOT_MAKE_TARGET = $(UBOOT_BIN) ifeq ($(BR2_TARGET_UBOOT_FORMAT_KWB),y)
else ifeq ($(BR2_TARGET_UBOOT_FORMAT_AIS),y) UBOOT_BINS += u-boot.kwb
UBOOT_BIN = u-boot.ais UBOOT_MAKE_TARGET += u-boot.kwb
UBOOT_MAKE_TARGET = $(UBOOT_BIN) endif
else ifeq ($(BR2_TARGET_UBOOT_FORMAT_LDR),y)
UBOOT_BIN = u-boot.ldr ifeq ($(BR2_TARGET_UBOOT_FORMAT_AIS),y)
else ifeq ($(BR2_TARGET_UBOOT_FORMAT_NAND_BIN),y) UBOOT_BINS += u-boot.ais
UBOOT_BIN = u-boot-nand.bin UBOOT_MAKE_TARGET += u-boot.ais
else ifeq ($(BR2_TARGET_UBOOT_FORMAT_DTB_IMG),y) endif
UBOOT_BIN = u-boot-dtb.img
UBOOT_MAKE_TARGET = all $(UBOOT_BIN) ifeq ($(BR2_TARGET_UBOOT_FORMAT_LDR),y)
else ifeq ($(BR2_TARGET_UBOOT_FORMAT_IMG),y) UBOOT_BINS += u-boot.ldr
UBOOT_BIN = u-boot.img endif
else ifeq ($(BR2_TARGET_UBOOT_FORMAT_IMX),y)
UBOOT_BIN = u-boot.imx ifeq ($(BR2_TARGET_UBOOT_FORMAT_NAND_BIN),y)
else ifeq ($(BR2_TARGET_UBOOT_FORMAT_SB),y) UBOOT_BINS += u-boot-nand.bin
UBOOT_BIN = u-boot.sb endif
UBOOT_MAKE_TARGET = $(UBOOT_BIN)
ifeq ($(BR2_TARGET_UBOOT_FORMAT_DTB_IMG),y)
UBOOT_BINS += u-boot-dtb.img
UBOOT_MAKE_TARGET += all u-boot-dtb.img
endif
ifeq ($(BR2_TARGET_UBOOT_FORMAT_IMG),y)
UBOOT_BINS += u-boot.img
UBOOT_MAKE_TARGET += u-boot.img
endif
ifeq ($(BR2_TARGET_UBOOT_FORMAT_IMX),y)
UBOOT_BINS += u-boot.imx
UBOOT_MAKE_TARGET += u-boot.imx
endif
ifeq ($(BR2_TARGET_UBOOT_FORMAT_SB),y)
UBOOT_BINS += u-boot.sb
UBOOT_MAKE_TARGET += u-boot.sb
# mxsimage needs OpenSSL # mxsimage needs OpenSSL
UBOOT_DEPENDENCIES += host-elftosb host-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 # BootStream (.sb) is generated by U-Boot, we convert it to SD format
UBOOT_BIN = u-boot.sd UBOOT_BINS += u-boot.sd
UBOOT_MAKE_TARGET = u-boot.sb UBOOT_MAKE_TARGET += u-boot.sb
UBOOT_DEPENDENCIES += host-elftosb host-openssl UBOOT_DEPENDENCIES += host-elftosb host-openssl
else ifeq ($(BR2_TARGET_UBOOT_FORMAT_NAND),y) endif
UBOOT_BIN = u-boot.nand
UBOOT_MAKE_TARGET = u-boot.sb ifeq ($(BR2_TARGET_UBOOT_FORMAT_NAND),y)
UBOOT_BINS += u-boot.nand
UBOOT_MAKE_TARGET += u-boot.sb
UBOOT_DEPENDENCIES += host-elftosb host-openssl UBOOT_DEPENDENCIES += host-elftosb host-openssl
else ifeq ($(BR2_TARGET_UBOOT_FORMAT_CUSTOM),y) endif
UBOOT_BIN = $(call qstrip,$(BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME))
else ifeq ($(BR2_TARGET_UBOOT_FORMAT_CUSTOM),y)
UBOOT_BIN = u-boot.bin UBOOT_BINS += $(call qstrip,$(BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME))
UBOOT_BIN_IFT = $(UBOOT_BIN).ift endif
ifeq ($(BR2_TARGET_UBOOT_OMAP_IFT),y)
UBOOT_BINS += u-boot.bin
UBOOT_BIN_IFT = u-boot.bin.ift
endif endif
# The kernel calls AArch64 'arm64', but U-Boot calls it just 'arm', so # The kernel calls AArch64 'arm64', but U-Boot calls it just 'arm', so
@ -166,9 +196,11 @@ define UBOOT_BUILD_OMAP_IFT
endef endef
define UBOOT_INSTALL_IMAGES_CMDS define UBOOT_INSTALL_IMAGES_CMDS
cp -dpf $(@D)/$(UBOOT_BIN) $(BINARIES_DIR)/ $(foreach f,$(UBOOT_BINS), \
cp -dpf $(@D)/$(f) $(BINARIES_DIR)/
)
$(if $(BR2_TARGET_UBOOT_FORMAT_NAND), $(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), $(if $(BR2_TARGET_UBOOT_SPL),
$(foreach f,$(call qstrip,$(BR2_TARGET_UBOOT_SPL_NAME)), \ $(foreach f,$(call qstrip,$(BR2_TARGET_UBOOT_SPL_NAME)), \
cp -dpf $(@D)/$(f) $(BINARIES_DIR)/ cp -dpf $(@D)/$(f) $(BINARIES_DIR)/