From patchwork Fri Sep 2 12:26:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Kulhavy X-Patchwork-Id: 665195 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sQdfF01zPz9sD5 for ; Fri, 2 Sep 2016 22:26:44 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id B568F9116B; Fri, 2 Sep 2016 12:26:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TxSY3nDtvoyQ; Fri, 2 Sep 2016 12:26:39 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id F10FF8E15E; Fri, 2 Sep 2016 12:26:38 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 29B891C26FF for ; Fri, 2 Sep 2016 12:26:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 24BBC30C78 for ; Fri, 2 Sep 2016 12:26:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Jc391WJrGBlb for ; Fri, 2 Sep 2016 12:26:35 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from fep12.mx.upcmail.net (fep12.mx.upcmail.net [62.179.121.32]) by silver.osuosl.org (Postfix) with ESMTP id EC69E316A4 for ; Fri, 2 Sep 2016 12:26:34 +0000 (UTC) Received: from edge04.upcmail.net ([192.168.13.239]) by viefep12-int.chello.at (InterMail vM.8.01.05.13 201-2260-151-135-20130320) with ESMTP id <20160902122632.MXGI657.viefep12-int.chello.at@edge04.upcmail.net> for ; Fri, 2 Sep 2016 14:26:32 +0200 Received: from localhost.localdomain ([83.150.41.162]) by edge04.upcmail.net with edge id ecSS1t01S3VvXnX01cSWu6; Fri, 02 Sep 2016 14:26:30 +0200 X-SourceIP: 83.150.41.162 X-Authenticated-Sender: brain@hispeed.ch From: Petr Kulhavy To: buildroot@uclibc.org Date: Fri, 2 Sep 2016 14:26:26 +0200 Message-Id: <1472819186-30700-1-git-send-email-brain@jikos.cz> X-Mailer: git-send-email 2.7.4 Cc: Petr Kulhavy Subject: [Buildroot] [PATCH v2] boot/uboot: allow to build multiple Uboot images X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" 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 --- boot/uboot/Config.in | 19 +++++----- boot/uboot/uboot.mk | 98 +++++++++++++++++++++++++++++++++------------------- 2 files changed, 73 insertions(+), 44 deletions(-) diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in index b024b66..d40a4e7 100644 --- a/boot/uboot/Config.in +++ b/boot/uboot/Config.in @@ -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 y config BR2_TARGET_UBOOT_FORMAT_DTB_IMG bool "u-boot-dtb.img" @@ -252,19 +251,21 @@ config BR2_TARGET_UBOOT_FORMAT_CUSTOM help On some platforms, the standard U-Boot binary is not called u-boot.bin, but u-boot.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. -endchoice - 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 help - Specify the correct name of the output binary created by - U-Boot, if it is not one of the default names. For example: + In case the U-Boot binary for the target platform is not among + the default names, one or more custom names can be listed here. + Use space to separate multiple names. + 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 diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk index a62f7be..bb613c2 100644 --- a/boot/uboot/uboot.mk +++ b/boot/uboot/uboot.mk @@ -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 @@ -166,9 +192,11 @@ define UBOOT_BUILD_OMAP_IFT endef define UBOOT_INSTALL_IMAGES_CMDS - cp -dpf $(@D)/$(UBOOT_BIN) $(BINARIES_DIR)/ + $(foreach f,$(UBOOT_BIN), \ + 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)/