From patchwork Sat Nov 3 16:05:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 196863 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id 151222C00B9 for ; Sun, 4 Nov 2012 03:05:35 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 2D1928C4A8; Sat, 3 Nov 2012 16:05:33 +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 TjLSowZTZpmh; Sat, 3 Nov 2012 16:05:28 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 5EB548C50B; Sat, 3 Nov 2012 16:05:25 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id C83BD8F74A for ; Sat, 3 Nov 2012 16:05:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id F08378BC5E for ; Sat, 3 Nov 2012 16:05:23 +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 5Ou03A4hKKbE for ; Sat, 3 Nov 2012 16:05:22 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.free-electrons.com (mail.free-electrons.com [88.190.12.23]) by whitealder.osuosl.org (Postfix) with ESMTP id 1AA058BB48 for ; Sat, 3 Nov 2012 16:05:21 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 106) id 4D65F267; Sat, 3 Nov 2012 17:04:10 +0100 (CET) Received: from localhost (182.Red-88-19-115.staticIP.rima-tde.net [88.19.115.182]) by mail.free-electrons.com (Postfix) with ESMTPSA id 62A72237 for ; Sat, 3 Nov 2012 17:04:02 +0100 (CET) From: Maxime Ripard To: buildroot@busybox.net Date: Sat, 3 Nov 2012 17:05:10 +0100 Message-Id: <1351958710-7530-1-git-send-email-maxime.ripard@free-electrons.com> X-Mailer: git-send-email 1.7.9.5 Subject: [Buildroot] [PATCHv2] barebox: Allow to pass a custom configuration file X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 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-bounces@busybox.net Signed-off-by: Maxime Ripard --- boot/barebox/Config.in | 21 +++++++++++++++++++++ boot/barebox/barebox.mk | 26 +++++++++++++++++++++----- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/boot/barebox/Config.in b/boot/barebox/Config.in index 574bfae..1f5f81b 100644 --- a/boot/barebox/Config.in +++ b/boot/barebox/Config.in @@ -67,12 +67,33 @@ config BR2_TARGET_BAREBOX_CUSTOM_GIT_VERSION endif + +choice + prompt "Barebox configuration" + default BR2_TARGET_BAREBOX_USE_DEFCONFIG + +config BR2_TARGET_BAREBOX_USE_DEFCONFIG + bool "Using a defconfig" + +config BR2_TARGET_BAREBOX_USE_CUSTOM_CONFIG + bool "Using a custom config file" + +endchoice + config BR2_TARGET_BAREBOX_BOARD_DEFCONFIG string "board defconfig" + depends on BR2_TARGET_BAREBOX_USE_DEFCONFIG help Name of the board for which Barebox should be built, without the _defconfig suffix. + +config BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE + string "Configuration file path" + depends on BR2_TARGET_BAREBOX_USE_CUSTOM_CONFIG + help + Path to the barebox configuration file + config BR2_TARGET_BAREBOX_BAREBOXENV bool "bareboxenv tool in target" help diff --git a/boot/barebox/barebox.mk b/boot/barebox/barebox.mk index 9550cdc..78c4aa9 100644 --- a/boot/barebox/barebox.mk +++ b/boot/barebox/barebox.mk @@ -37,8 +37,6 @@ ifneq ($(BR2_TARGET_BAREBOX_BAREBOXENV),y) BAREBOX_INSTALL_TARGET = NO endif -BAREBOX_BOARD_DEFCONFIG = $(call qstrip,$(BR2_TARGET_BAREBOX_BOARD_DEFCONFIG)) - ifeq ($(KERNEL_ARCH),i386) BAREBOX_ARCH=x86 else ifeq ($(KERNEL_ARCH),powerpc) @@ -49,8 +47,16 @@ endif BAREBOX_MAKE_FLAGS = ARCH=$(BAREBOX_ARCH) CROSS_COMPILE="$(CCACHE) $(TARGET_CROSS)" + +ifeq ($(BR2_TARGET_BAREBOX_USE_DEFCONFIG),y) +BAREBOX_SOURCE_CONFIG = $(@D)/arch/$(BAREBOX_ARCH)/configs/$(call qstrip,$(BR2_TARGET_BAREBOX_BOARD_DEFCONFIG))_defconfig +else ifeq ($(BR2_TARGET_BAREBOX_USE_CUSTOM_CONFIG),y) +BAREBOX_SOURCE_CONFIG = $(BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE) +endif + define BAREBOX_CONFIGURE_CMDS - $(MAKE) $(BAREBOX_MAKE_FLAGS) -C $(@D) $(BAREBOX_BOARD_DEFCONFIG)_defconfig + cp $(BAREBOX_SOURCE_CONFIG) $(@D)/arch/$(BAREBOX_ARCH)/configs/buildroot_defconfig + $(MAKE) $(BAREBOX_MAKE_FLAGS) -C $(@D) buildroot_defconfig endef ifeq ($(BR2_TARGET_BAREBOX_BAREBOXENV),y) @@ -80,8 +86,8 @@ $(eval $(generic-package)) ifeq ($(BR2_TARGET_BAREBOX),y) # we NEED a board defconfig file unless we're at make source ifeq ($(filter source,$(MAKECMDGOALS)),) -ifeq ($(BAREBOX_BOARD_DEFCONFIG),) -$(error No Barebox defconfig file. Check your BR2_TARGET_BAREBOX_BOARD_DEFCONFIG setting) +ifeq ($(BAREBOX_SOURCE_CONFIG),) +$(error No Barebox config file. Check your BR2_TARGET_BAREBOX_BOARD_DEFCONFIG or BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE settings) endif endif @@ -94,4 +100,14 @@ barebox-savedefconfig: barebox-configure $(MAKE) $(BAREBOX_MAKE_FLAGS) -C $(BAREBOX_DIR) \ $(subst barebox-,,$@) +ifeq ($(BR2_TARGET_BAREBOX_USE_CUSTOM_CONFIG),y) +barebox-update-config: barebox-configure $(BAREBOX_DIR)/.config + cp -f $(BAREBOX_DIR)/.config $(BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE) + +barebox-update-defconfig: barebox-savedefconfig + cp -f $(BAREBOX_DIR)/defconfig $(BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE) +else +barebox-update-config: ; +barebox-update-defconfig: ; +endif endif