Allow to merge default environment from more than one directory
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
72861584e3
commit
600c0e987e
15
Makefile
15
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -22,9 +22,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 > $@
|
||||
|
|
|
@ -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
|
||||
|
Loading…
Reference in New Issue