Patchwork barebox: Allow to build an environment image

login
register
mail settings
Submitter Maxime Ripard
Date Jan. 22, 2013, 3:40 p.m.
Message ID <1358869242-13472-1-git-send-email-maxime.ripard@free-electrons.com>
Download mbox | patch
Permalink /patch/214576/
State Superseded
Headers show

Comments

Maxime Ripard - Jan. 22, 2013, 3:40 p.m.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 boot/barebox/Config.in  |   11 +++++++++++
 boot/barebox/barebox.mk |   14 ++++++++++++++
 2 files changed, 25 insertions(+)
Thomas Petazzoni - Jan. 23, 2013, 4:03 p.m.
Dear Maxime Ripard,

On Tue, 22 Jan 2013 16:40:42 +0100, Maxime Ripard wrote:

> +config BR2_TARGET_BAREBOX_CUSTOM_ENV
> +	bool "Generate an environment image"
> +	help
> +	  Generate a custom environment image.
> +
> +config BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH
> +	string "Environment path"
> +	depends on BR2_TARGET_BAREBOX_CUSTOM_ENV
> +	help
> +	  Path to the custom barebox environment

In general I'm fine, but I'd like to see more details in the help text
here. At least explaining what is an environment image, that it gets
generated from a text file in such or such format (possibly with a
pointer into the Barebox documentation). Make it clear that
BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH is the path to the source
environment, and where the image will be generated, with what name, etc.

Best regards,

Thomas

Patch

diff --git a/boot/barebox/Config.in b/boot/barebox/Config.in
index b9e03b3..24fcb38 100644
--- a/boot/barebox/Config.in
+++ b/boot/barebox/Config.in
@@ -99,4 +99,15 @@  config BR2_TARGET_BAREBOX_BAREBOXENV
 	help
 	  Install bareboxenv tool in target.
 
+config BR2_TARGET_BAREBOX_CUSTOM_ENV
+	bool "Generate an environment image"
+	help
+	  Generate a custom environment image.
+
+config BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH
+	string "Environment path"
+	depends on BR2_TARGET_BAREBOX_CUSTOM_ENV
+	help
+	  Path to the custom barebox environment
+
 endif
diff --git a/boot/barebox/barebox.mk b/boot/barebox/barebox.mk
index 143338e..5ec47f6 100644
--- a/boot/barebox/barebox.mk
+++ b/boot/barebox/barebox.mk
@@ -67,9 +67,22 @@  define BAREBOX_BUILD_BAREBOXENV_CMDS
 endef
 endif
 
+ifeq ($(BR2_TARGET_BAREBOX_CUSTOM_ENV),y)
+BAREBOX_ENV_NAME = $(notdir $(call qstrip, $(BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH)))
+define BAREBOX_BUILD_CUSTOM_ENV
+	$(@D)/scripts/bareboxenv -s \
+		$(call qstrip, $(BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH)) \
+		$(@D)/$(BAREBOX_ENV_NAME)
+endef
+define BAREBOX_INSTALL_CUSTOM_ENV
+	cp $(@D)/$(BAREBOX_ENV_NAME) $(BINARIES_DIR)
+endef
+endif
+
 define BAREBOX_BUILD_CMDS
 	$(BAREBOX_BUILD_BAREBOXENV_CMDS)
 	$(TARGET_MAKE_ENV) $(MAKE) $(BAREBOX_MAKE_FLAGS) -C $(@D)
+	$(BAREBOX_BUILD_CUSTOM_ENV)
 endef
 
 define BAREBOX_INSTALL_IMAGES_CMDS
@@ -78,6 +91,7 @@  define BAREBOX_INSTALL_IMAGES_CMDS
 	else \
 		cp $(@D)/barebox.bin $(BINARIES_DIR);\
 	fi
+	$(BAREBOX_INSTALL_CUSTOM_ENV)
 endef
 
 ifeq ($(BR2_TARGET_BAREBOX_BAREBOXENV),y)