All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 14/49] u-boot: support building for mkimage
Date: Sat, 12 Jun 2010 16:21:48 +0200	[thread overview]
Message-ID: <f2d16ae0e17370131e64438cd50d5a6c7ab0ea8d.1276352308.git.thomas.petazzoni@free-electrons.com> (raw)
In-Reply-To: <cover.1276352307.git.thomas.petazzoni@free-electrons.com>

To build mkimage for the host (which is needed to build an uImage of
the kernel), it is not necessary to configure U-Boot, and therefore to
have a particular board selected.

Therefore, this commit:

 * Adds a verification at U-Boot configure step that a U-Boot board
   name has been defined

 * Sets a default U-Boot version if none has been specified, so that
   even when U-Boot isn't selected but we want to build mkimage for
   the host, a particular U-Boot version is picked.

 * Make the host mkimage target depend only on U-Boot being
   downloaded/extracted/patched, and the target mkimage/fw_printenv
   targets depend on U-Boot being fully configured.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 boot/u-boot/u-boot.mk |   28 +++++++++++++++++++++-------
 1 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/boot/u-boot/u-boot.mk b/boot/u-boot/u-boot.mk
index ac16c8b..00724ba 100644
--- a/boot/u-boot/u-boot.mk
+++ b/boot/u-boot/u-boot.mk
@@ -4,6 +4,15 @@
 #
 #############################################################
 U_BOOT_VERSION:=$(call qstrip,$(BR2_UBOOT_VERSION))
+U_BOOT_BOARD_NAME:=$(call qstrip,$(BR2_TARGET_UBOOT_BOARDNAME))
+
+# U-Boot may not be selected in the configuration, but mkimage might
+# be needed to build/prepare a kernel image. In this case, we just
+# pick some random stable U-Boot version that will be used just to
+# build mkimage.
+ifeq ($(U_BOOT_VERSION),)
+U_BOOT_VERSION=2010.03
+endif
 
 U_BOOT_SOURCE:=u-boot-$(U_BOOT_VERSION).tar.bz2
 
@@ -30,9 +39,6 @@ TARGET_UBOOT_ETHADDR:=$(call qstrip,$(BR2_TARGET_UBOOT_ETHADDR))
 
 # u-boot still uses arch=ppc for powerpc
 U_BOOT_ARCH=$(KERNEL_ARCH:powerpc=ppc)
-ifeq ($(UBOOT_BOARD_NAME),)
-UBOOT_BOARD_NAME:=$(call qstrip,$(BR2_TARGET_UBOOT_BOARDNAME))
-endif
 
 U_BOOT_INC_CONF_FILE:=$(U_BOOT_DIR)/include/config.h
 
@@ -73,6 +79,9 @@ endif
 	touch $@
 
 $(U_BOOT_DIR)/.configured: $(U_BOOT_DIR)/.patched
+ifeq ($(U_BOOT_BOARD_NAME),)
+	$(error NO U-Boot board name set. Check your BR2_TARGET_UBOOT_BOARDNAME setting)
+endif
 	$(TARGET_CONFIGURE_OPTS)		\
 		CFLAGS="$(TARGET_CFLAGS)"	\
 		LDFLAGS="$(TARGET_LDFLAGS)"	\
@@ -154,11 +163,16 @@ $(BINARIES_DIR)/$(U_BOOT_BIN): $(U_BOOT_DIR)/$(U_BOOT_BIN)
 	rm -f $(BINARIES_DIR)/$(U_BOOT_BIN)
 	cp -dpf $(U_BOOT_DIR)/$(U_BOOT_BIN) $(BINARIES_DIR)/
 
-$(U_BOOT_TOOLS): $(U_BOOT_DIR)/$(U_BOOT_BIN)
+# Build just mkimage for the host. It might have already been built by
+# the U-Boot build procedure, but mkimage may also be needed even if
+# U-Boot isn't selected in the configuration, to generate a kernel
+# uImage.
+$(MKIMAGE): $(U_BOOT_DIR)/.patched
 	mkdir -p $(@D)
-	cp -dpf $(U_BOOT_DIR)/tools/mkimage $@
+	$(MAKE) -C $(U_BOOT_DIR) tools
+	cp -dpf $(U_BOOT_DIR)/tools/mkimage $(@D)
 
-$(TARGET_DIR)/usr/bin/mkimage: $(U_BOOT_DIR)/$(U_BOOT_BIN)
+$(TARGET_DIR)/usr/bin/mkimage: $(U_BOOT_DIR)/.configured
 	mkdir -p $(@D)
 	$(TARGET_CC) -I$(U_BOOT_DIR)/include -I$(U_BOOT_DIR)/tools \
 		-DUSE_HOSTCC -o $@ \
@@ -171,7 +185,7 @@ $(TARGET_DIR)/usr/bin/mkimage: $(U_BOOT_DIR)/$(U_BOOT_BIN)
 
 	$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $@
 
-$(TARGET_DIR)/usr/sbin/fw_printenv: $(U_BOOT_DIR)/$(U_BOOT_BIN)
+$(TARGET_DIR)/usr/sbin/fw_printenv: $(U_BOOT_DIR)/.configured
 	mkdir -p $(@D)
 	$(TARGET_CC) -I$(U_BOOT_DIR)/include -I$(LINUX_HEADERS_DIR)/include \
 		-DUSE_HOSTCC -o $@ \
-- 
1.7.0.4

  parent reply	other threads:[~2010-06-12 14:21 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-12 14:21 [Buildroot] [pull request] Pull request for branch bootloaders-cleanup Thomas Petazzoni
2010-06-12 14:21 ` [Buildroot] [PATCH 01/49] bootloaders: move bootloader build code to boot/ Thomas Petazzoni
2010-06-12 14:21 ` [Buildroot] [PATCH 02/49] yaboot: drop support Thomas Petazzoni
2010-06-12 14:21 ` [Buildroot] [PATCH 03/49] boot: remove references to COPYTO Thomas Petazzoni
2010-06-12 14:21 ` [Buildroot] [PATCH 04/49] u-boot: do not default to $(BOARD_NAME) for the board name Thomas Petazzoni
2010-06-12 14:21 ` [Buildroot] [PATCH 05/49] u-boot: remove ancient versions Thomas Petazzoni
2010-06-14 13:51   ` Jonathan dumaresq
2010-06-12 14:21 ` [Buildroot] [PATCH 06/49] u-boot: rename Makefile.in to u-boot.mk for coherency Thomas Petazzoni
2010-06-12 14:21 ` [Buildroot] [PATCH 07/49] u-boot: remove option to configure download site Thomas Petazzoni
2010-06-12 14:21 ` [Buildroot] [PATCH 08/49] u-boot: remove arch specific patches infrastructure Thomas Petazzoni
2010-06-12 14:21 ` [Buildroot] [PATCH 09/49] u-boot: remove u-boot-status make target Thomas Petazzoni
2010-06-12 14:21 ` [Buildroot] [PATCH 10/49] u-boot: remove reference to old 1.2.0-atmel version Thomas Petazzoni
2010-06-12 14:21 ` [Buildroot] [PATCH 11/49] u-boot: simplify custom patch handling Thomas Petazzoni
2010-06-12 14:21 ` [Buildroot] [PATCH 12/49] u-boot: remove patch for obsolete version Thomas Petazzoni
2010-06-12 14:21 ` [Buildroot] [PATCH 13/49] u-boot: remove useless symbolic link Thomas Petazzoni
2010-06-12 14:21 ` Thomas Petazzoni [this message]
2010-06-12 14:21 ` [Buildroot] [PATCH 15/49] u-boot: further simplify the configuration Thomas Petazzoni
2010-06-12 14:21 ` [Buildroot] [PATCH 16/49] u-boot: remove unused U_BOOT_TARGET_TOOLS variable Thomas Petazzoni
2010-06-12 14:21 ` [Buildroot] [PATCH 17/49] u-boot: add a few comments Thomas Petazzoni
2010-06-12 14:21 ` [Buildroot] [PATCH 18/49] u-boot: re-add infrastructure to specify custom tarball Thomas Petazzoni
2010-06-12 14:21 ` [Buildroot] [PATCH 19/49] u-boot: beautify option prompts Thomas Petazzoni
2010-06-12 14:21 ` [Buildroot] [PATCH 20/49] u-boot: use BR2_TARGET_UBOOT_VERSION instead of BR2_UBOOT_VERSION Thomas Petazzoni
2010-06-12 14:21 ` [Buildroot] [PATCH 21/49] defconfigs: remove references to old U-Boot versions Thomas Petazzoni
2010-06-12 14:21 ` [Buildroot] [PATCH 22/49] grub: remove GRUB_SUPPORTED_ARCH Thomas Petazzoni
2010-06-12 14:21 ` [Buildroot] [PATCH 23/49] grub2: remove GRUB2_ARCH_SUPPORTED Thomas Petazzoni
2010-06-12 14:21 ` [Buildroot] [PATCH 24/49] grub/grub2: drop unnecessary dependency on uclibc Thomas Petazzoni
2010-06-12 14:21 ` [Buildroot] [PATCH 25/49] grub/grub2: update splash image location Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 26/49] grub2: bump version Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 27/49] grub2: fix build Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 28/49] grub2: remove non-existing options Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 29/49] grub2: only available on x86 and PowerPC and mark as BROKEN Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 30/49] syslinux: bump version and fix build Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 31/49] syslinux: remove the unnecessary SYSLINUX_SUPPORTED_ARCH check Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 32/49] nasm: new package, needed for syslinux Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 33/49] syslinux: depends on host-nasm Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 34/49] at91bootstrap: do not default to $(BOARD_NAME) Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 35/49] at91bootstrap: simplify configuration Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 36/49] at91bootstrap: fix the boot source selection Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 37/49] at91bootstrap: fix incorrect config option comment Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 38/49] at91bootstrap: remove unused/useless code Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 39/49] at91bootstrap: add a check to verify that BR2_TARGET_AT91BOOTSTRAP_BOARD is set Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 40/49] at91bootstrap: bump version to 2.13 Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 41/49] at91bootstrap: don't use the ATMEL_MIRROR thing Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 42/49] at91bootstrap: fix install procedure Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 43/49] at91bootstrap: fix AT91BOOTSTRAP_BINARY Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 44/49] at91dataflashboot: fix configuration options Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 45/49] at91dataflashboot: various fixes Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 46/49] at91dataflashboot: add a patch step Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 47/49] at91dataflashboot: add two patches Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 48/49] Add support for the Barebox bootloader Thomas Petazzoni
2010-06-12 14:22 ` [Buildroot] [PATCH 49/49] linux: fix dependency on mkimage Thomas Petazzoni
2010-06-13 13:51   ` Thomas Petazzoni
2010-06-13 14:58     ` Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f2d16ae0e17370131e64438cd50d5a6c7ab0ea8d.1276352308.git.thomas.petazzoni@free-electrons.com \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.