mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 03/11] Allow to merge default environment from more than one directory
Date: Mon, 14 Jun 2010 11:48:33 +0200	[thread overview]
Message-ID: <1276508921-3264-4-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1276508921-3264-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 Makefile        |   15 ---------------
 common/Kconfig  |    4 ++--
 common/Makefile |    6 ++++--
 scripts/genenv  |   17 +++++++++++++++++
 4 files changed, 23 insertions(+), 19 deletions(-)
 create mode 100755 scripts/genenv

diff --git a/Makefile b/Makefile
index d17ca47..e24ae45 100644
--- a/Makefile
+++ b/Makefile
@@ -1299,18 +1299,3 @@ Makefile: ;
 # information in a variable se we can use it in if_changed and friends.
 .PHONY: $(PHONY)
 
-#
-# sanity checks for check default environemnt
-#
-ifdef CONFIG_DEFAULT_ENVIRONMENT
-
-ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_PATH),"")
-$(error default environment path empty))
-endif
-
-saved-env_path := $(CONFIG_DEFAULT_ENVIRONMENT_PATH)
-CONFIG_DEFAULT_ENVIRONMENT_PATH := $(shell cd $(if $(filter /%,$(CONFIG_DEFAULT_ENVIRONMENT_PATH)),,$(srctree)/)$(CONFIG_DEFAULT_ENVIRONMENT_PATH) && /bin/pwd)
-$(if $(CONFIG_DEFAULT_ENVIRONMENT_PATH),, \
-	$(error default environment path $(saved-env_path) does not exist))
-
-endif # ifdef CONFIG_DEFAULT_ENVIRONMENT
diff --git a/common/Kconfig b/common/Kconfig
index f514759..a58f242 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -339,8 +339,8 @@ config DEFAULT_ENVIRONMENT_PATH
 	depends on DEFAULT_ENVIRONMENT
 	prompt "Default environment path"
 	help
-	  The path the default environment will be taken from. Relative
-	  pathes will be relative to the barebox Toplevel dir, but absolute
+	  Space separated list of pathes the default environment will be taken from.
+	  Relative pathes will be relative to the barebox Toplevel dir, but absolute
 	  pathes are fine aswell.
 
 endmenu
diff --git a/common/Makefile b/common/Makefile
index 0c075a9..aebaa39 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -15,6 +15,7 @@ obj-y += env.o
 obj-y += startup.o
 obj-y += misc.o
 obj-y += memsize.o
+obj-y += sysdev.o
 obj-$(CONFIG_MODULES) += module.o
 extra-$(CONFIG_MODULES) += module.lds
 
@@ -22,9 +23,10 @@ ifdef CONFIG_DEFAULT_ENVIRONMENT
 $(obj)/startup.o: include/barebox_default_env.h
 $(obj)/env.o: include/barebox_default_env.h
 
-ENV_FILES := $(shell find $(srctree)/$(CONFIG_DEFAULT_ENVIRONMENT_PATH))
+ENV_FILES := $(shell cd $(srctree); for i in $(CONFIG_DEFAULT_ENVIRONMENT_PATH); do find $${i} -type f -exec readlink -f {} \;; done)
+
 endif # ifdef CONFIG_DEFAULT_ENVIRONMENT
 
 include/barebox_default_env.h: $(ENV_FILES)
-	$(Q)scripts/bareboxenv -s $(srctree)/$(CONFIG_DEFAULT_ENVIRONMENT_PATH) barebox_default_env
+	$(Q)scripts/genenv $(srctree) $(CONFIG_DEFAULT_ENVIRONMENT_PATH)
 	$(Q)cat barebox_default_env | scripts/bin2c default_environment > $@
diff --git a/scripts/genenv b/scripts/genenv
new file mode 100755
index 0000000..6a833b1
--- /dev/null
+++ b/scripts/genenv
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# Generate the default environment file from a list of directories
+# usage: genenv <basedir> <dir>...
+# where <basedir> is the base directory for relative pathes in <dir>
+cd $1 || exit 1
+shift
+
+tempdir=$(mktemp -d)
+
+for i in $*; do
+	cp -r $i/* $tempdir
+done
+scripts/bareboxenv -s $tempdir barebox_default_env
+
+rm -r $tempdir
+
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2010-06-14  9:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-14  9:48 More patches Sascha Hauer
2010-06-14  9:48 ` [PATCH 01/11] pcm037: Add MMU support Sascha Hauer
2010-06-14  9:48 ` [PATCH 02/11] bootu: Allow passing in devices as parameter Sascha Hauer
2010-06-14  9:48 ` Sascha Hauer [this message]
2010-06-14  9:48 ` [PATCH 04/11] include support for a simple pseudo number generator Sascha Hauer
2010-06-15  9:39   ` Peter Korsgaard
2010-06-15 11:54     ` Sascha Hauer
2010-06-17 13:17   ` Sascha Hauer
2010-06-17 13:26     ` Andy Pont
2010-06-17 14:14     ` Peter Korsgaard
2010-06-14  9:48 ` [PATCH 05/11] net: implement random_ether_addr Sascha Hauer
2010-06-14  9:48 ` [PATCH 06/11] net: use a random mac address if the current device does not have one Sascha Hauer
2010-06-14  9:48 ` [PATCH 07/11] add a generic default environment Sascha Hauer
2010-06-15  9:13   ` Uwe Kleine-König
2010-06-17 13:20   ` Sascha Hauer
2010-06-19 20:14     ` Uwe Kleine-König
2010-06-14  9:48 ` [PATCH 08/11] pcm038: use generic default env Sascha Hauer
2010-06-14  9:48 ` [PATCH 09/11] pcm043: " Sascha Hauer
2010-06-14  9:48 ` [PATCH 10/11] pcm037: " Sascha Hauer
2010-06-14  9:48 ` [PATCH 11/11] pca100: " Sascha Hauer

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=1276508921-3264-4-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox