* [PATCH 1/5] common/Makefile: reorder targets
2014-02-19 10:50 Cleanup environment dependencies and compressed file generation Sascha Hauer
@ 2014-02-19 10:50 ` Sascha Hauer
2014-02-19 10:50 ` [PATCH 2/5] defaultenv: simplify env dependencies Sascha Hauer
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2014-02-19 10:50 UTC (permalink / raw)
To: barebox
Reorder targets alphabetically to make the file look nicer, no
functional change.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/Makefile | 87 ++++++++++++++++++++++++++++-----------------------------
1 file changed, 42 insertions(+), 45 deletions(-)
diff --git a/common/Makefile b/common/Makefile
index ee02e0e..ce34d98 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -1,53 +1,50 @@
-obj-$(CONFIG_BINFMT) += binfmt.o
-obj-$(CONFIG_SHELL_HUSH) += hush.o
-obj-$(CONFIG_SHELL_SIMPLE) += parser.o
-obj-$(CONFIG_GREGORIAN_CALENDER) += date.o
-obj-$(CONFIG_KALLSYMS) += kallsyms.o
-obj-$(CONFIG_ENV_HANDLING) += environment.o
+obj-y += memory.o
+obj-y += memory_display.o
+obj-y += clock.o
+obj-y += console_common.o
+obj-y += startup.o
+obj-y += misc.o
+obj-y += memsize.o
+obj-y += resource.o
+obj-y += bootsource.o
+extra-y += barebox_default_env barebox_default_env.h
obj-$(CONFIG_AUTO_COMPLETE) += complete.o
-obj-$(CONFIG_POLLER) += poller.o
+obj-$(CONFIG_BANNER) += version.o
+obj-$(CONFIG_BAREBOX_UPDATE) += bbu.o
+obj-$(CONFIG_BINFMT) += binfmt.o
obj-$(CONFIG_BLOCK) += block.o
-obj-$(CONFIG_PARTITION_DISK) += partitions.o partitions/
-
+obj-$(CONFIG_BLSPEC) += blspec.o
+obj-$(CONFIG_BOOTM) += bootm.o
obj-$(CONFIG_CMD_LOADS) += s_record.o
+obj-$(CONFIG_CMD_MEMTEST) += memtest.o
+obj-$(CONFIG_COMMAND_SUPPORT) += command.o
+obj-$(CONFIG_CONSOLE_FULL) += console.o
+obj-$(CONFIG_CONSOLE_SIMPLE) += console_simple.o
+obj-$(CONFIG_DIGEST) += digest.o
+obj-$(CONFIG_DDR_SPD) += ddr_spd.o
+obj-$(CONFIG_ENV_HANDLING) += environment.o
+obj-$(CONFIG_ENVIRONMENT_VARIABLES) += env.o
+obj-$(CONFIG_FILETYPE) += filetype.o
+obj-$(CONFIG_FLEXIBLE_BOOTARGS) += bootargs.o
+obj-$(CONFIG_GLOBALVAR) += globalvar.o
+obj-$(CONFIG_GREGORIAN_CALENDER) += date.o
+obj-$(CONFIG_KALLSYMS) += kallsyms.o
+obj-$(CONFIG_MALLOC_DLMALLOC) += dlmalloc.o
+obj-$(CONFIG_MALLOC_TLSF) += tlsf_malloc.o tlsf.o
+obj-$(CONFIG_MALLOC_DUMMY) += dummy_malloc.o
+obj-$(CONFIG_MEMINFO) += meminfo.o
+obj-$(CONFIG_MENU) += menu.o
+obj-$(CONFIG_MODULES) += module.o
+extra-$(CONFIG_MODULES) += module.lds
obj-$(CONFIG_OFTREE) += oftree.o
+obj-$(CONFIG_PARTITION_DISK) += partitions.o partitions/
+obj-$(CONFIG_PASSWORD) += password.o
+obj-$(CONFIG_POLLER) += poller.o
+obj-$(CONFIG_RESET_SOURCE) += reset_source.o
+obj-$(CONFIG_SHELL_HUSH) += hush.o
+obj-$(CONFIG_SHELL_SIMPLE) += parser.o
+obj-$(CONFIG_UIMAGE) += image.o uimage.o
-obj-$(CONFIG_BLSPEC) += blspec.o
-obj-y += memory.o
-obj-$(CONFIG_DDR_SPD) += ddr_spd.o
-obj-y += memory_display.o
-obj-$(CONFIG_MALLOC_DLMALLOC) += dlmalloc.o
-obj-$(CONFIG_MALLOC_TLSF) += tlsf_malloc.o
-obj-$(CONFIG_MALLOC_TLSF) += tlsf.o
-obj-$(CONFIG_MALLOC_DUMMY) += dummy_malloc.o
-obj-$(CONFIG_CMD_MEMTEST) += memtest.o
-obj-y += clock.o
-obj-$(CONFIG_BANNER) += version.o
-obj-$(CONFIG_MEMINFO) += meminfo.o
-obj-$(CONFIG_COMMAND_SUPPORT) += command.o
-obj-$(CONFIG_CONSOLE_FULL) += console.o
-obj-$(CONFIG_CONSOLE_SIMPLE) += console_simple.o
-obj-y += console_common.o
-obj-$(CONFIG_DIGEST) += digest.o
-obj-$(CONFIG_ENVIRONMENT_VARIABLES) += env.o
-obj-$(CONFIG_UIMAGE) += image.o
-obj-$(CONFIG_UIMAGE) += uimage.o
-obj-y += startup.o
-obj-y += misc.o
-obj-y += memsize.o
-obj-$(CONFIG_GLOBALVAR) += globalvar.o
-obj-$(CONFIG_RESET_SOURCE) += reset_source.o
-obj-$(CONFIG_FILETYPE) += filetype.o
-obj-y += resource.o
-obj-$(CONFIG_MENU) += menu.o
-obj-$(CONFIG_PASSWORD) += password.o
-obj-$(CONFIG_MODULES) += module.o
-obj-$(CONFIG_FLEXIBLE_BOOTARGS) += bootargs.o
-obj-$(CONFIG_BAREBOX_UPDATE) += bbu.o
-obj-y += bootsource.o
-obj-$(CONFIG_BOOTM) += bootm.o
-extra-$(CONFIG_MODULES) += module.lds
-extra-y += barebox_default_env barebox_default_env.h
ifdef CONFIG_DEFAULT_ENVIRONMENT
$(obj)/startup.o: $(obj)/barebox_default_env.h
--
1.8.5.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/5] defaultenv: simplify env dependencies
2014-02-19 10:50 Cleanup environment dependencies and compressed file generation Sascha Hauer
2014-02-19 10:50 ` [PATCH 1/5] common/Makefile: reorder targets Sascha Hauer
@ 2014-02-19 10:50 ` Sascha Hauer
2014-02-19 10:50 ` [PATCH 3/5] make: Add wildcard rules for compressed files Sascha Hauer
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2014-02-19 10:50 UTC (permalink / raw)
To: barebox
Finding out whether to rebuild the environment is a difficult task
since we have to track all files in a directory. Instead of trying
this, just rebuild the environment during every build and only if
it differs to the last one overwrite the target. This way make
only sees a change when the environment is changed.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/Makefile | 15 ++++-----------
scripts/genenv | 12 ++++++++++--
2 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/common/Makefile b/common/Makefile
index ce34d98..0429336 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -65,23 +65,16 @@ ifneq ($(CONFIG_DEFAULT_ENVIRONMENT_PATH),"")
DEFAULT_ENVIRONMENT_PATH += $(CONFIG_DEFAULT_ENVIRONMENT_PATH)
endif
-ENV_FILES := $(shell cd $(srctree); for i in $(DEFAULT_ENVIRONMENT_PATH); do find $${i} -type f ; done)
-
endif # ifdef CONFIG_DEFAULT_ENVIRONMENT
#
# Generate a barebox envfs image.
#
-# echo $(ENV_FILES) > /dev/null is just for letting if_changed
-# recognize that something has changed when the environment has
-# other files,
-#
-quiet_cmd_env = ENV $@
-cmd_env = ($(srctree)/scripts/genenv $(srctree) $(objtree) $@ $(DEFAULT_ENVIRONMENT_PATH)) || \
- (echo $(ENV_FILES) > /dev/null; rm -f $@ ; false)
+quiet_cmd_envs = ENV $@
+cmd_envs = ($(srctree)/scripts/genenv $(srctree) $(objtree) $@ $(DEFAULT_ENVIRONMENT_PATH))
-$(obj)/barebox_default_env: $(ENV_FILES) FORCE
- $(call if_changed,env)
+$(obj)/barebox_default_env: FORCE
+ $(call cmd,envs)
barebox_default_env_comp =
ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_COMPRESSED_GZIP),y)
diff --git a/scripts/genenv b/scripts/genenv
index c14cd87..d0b0ffd 100755
--- a/scripts/genenv
+++ b/scripts/genenv
@@ -10,7 +10,8 @@ basedir=$1
target=$3
shift 3
-tempdir="$objtree/.barebox_default_env"
+tempdir="${target}.genenv.tmp"
+tmpfile="$(mktemp)"
mkdir -p "$tempdir"
@@ -26,6 +27,13 @@ done
find $tempdir -name '.svn' -o -name '*~' -delete
-$objtree/scripts/bareboxenv -s $tempdir $target
+$objtree/scripts/bareboxenv -s $tempdir ${tmpfile}
+
+diff "${tmpfile}" "${target}" >/dev/null 2>/dev/null
+if [ $? != 0 ]; then
+ mv "${tmpfile}" "${target}"
+else
+ rm ${tmpfile}
+fi
rm -r $tempdir
--
1.8.5.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/5] make: Add wildcard rules for compressed files
2014-02-19 10:50 Cleanup environment dependencies and compressed file generation Sascha Hauer
2014-02-19 10:50 ` [PATCH 1/5] common/Makefile: reorder targets Sascha Hauer
2014-02-19 10:50 ` [PATCH 2/5] defaultenv: simplify env dependencies Sascha Hauer
@ 2014-02-19 10:50 ` Sascha Hauer
2014-02-19 10:50 ` [PATCH 4/5] defaultenv: use wildcard compression rules Sascha Hauer
2014-02-19 10:50 ` [PATCH 5/5] Kconfig: Select default compression type Sascha Hauer
4 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2014-02-19 10:50 UTC (permalink / raw)
To: barebox
To simplify generating compressed files.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
scripts/Makefile.lib | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 73a433d..e87e401 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -193,6 +193,9 @@ quiet_cmd_gzip = GZIP $@
cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -n -f -9 > $@) || \
(rm -f $@ ; false)
+%.gz: %
+ $(call if_changed,gzip)
+
# DTC
# ---------------------------------------------------------------------------
@@ -251,6 +254,9 @@ cmd_bzip2 = (cat $(filter-out FORCE,$^) | \
bzip2 -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
(rm -f $@ ; false)
+%.bz2: %
+ $(call if_changed,bzip2)
+
# Lzma
# ---------------------------------------------------------------------------
@@ -259,11 +265,17 @@ cmd_lzma = (cat $(filter-out FORCE,$^) | \
lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
(rm -f $@ ; false)
+%.lzma: %
+ $(call if_changed,lzma)
+
quiet_cmd_lzo = LZO $@
cmd_lzo = (cat $(filter-out FORCE,$^) | \
lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
(rm -f $@ ; false)
+%.lzo: %
+ $(call if_changed,lzo)
+
# XZ
# ---------------------------------------------------------------------------
# Use xzkern to compress the kernel image and xzmisc to compress other things.
@@ -292,11 +304,17 @@ cmd_xzmisc = (cat $(filter-out FORCE,$^) | \
xz --check=crc32 --lzma2=dict=1MiB) > $@ || \
(rm -f $@ ; false)
+# lz4
+# ---------------------------------------------------------------------------
+
quiet_cmd_lz4 = LZ4 $@
cmd_lz4 = (cat $(filter-out FORCE,$^) | \
lz4c -l -c1 stdin stdout && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
(rm -f $@ ; false)
+%.lz4: %
+ $(call if_changed,lz4)
+
quiet_cmd_disasm = DISASM $@
cmd_disasm = $(OBJDUMP) -d $< > $@
--
1.8.5.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 4/5] defaultenv: use wildcard compression rules
2014-02-19 10:50 Cleanup environment dependencies and compressed file generation Sascha Hauer
` (2 preceding siblings ...)
2014-02-19 10:50 ` [PATCH 3/5] make: Add wildcard rules for compressed files Sascha Hauer
@ 2014-02-19 10:50 ` Sascha Hauer
2014-02-19 10:50 ` [PATCH 5/5] Kconfig: Select default compression type Sascha Hauer
4 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2014-02-19 10:50 UTC (permalink / raw)
To: barebox
Now that we have wildcard rules for compresed files use them.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/Makefile | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/common/Makefile b/common/Makefile
index 0429336..60b0356 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -87,17 +87,6 @@ ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_COMPRESSED_LZO),y)
barebox_default_env_comp = .lzo
endif
-$(obj)/barebox_default_env.gz: $(obj)/barebox_default_env FORCE
- $(call if_changed,gzip)
-
-$(obj)/barebox_default_env.bz2: $(obj)/barebox_default_env FORCE
- $(call if_changed,bzip2)
-
-$(obj)/barebox_default_env.lzo: $(obj)/barebox_default_env FORCE
- $(call if_changed,lzo)
-
-targets += barebox_default_env.lzo barebox_default_env.bz2 barebox_default_env.gz
-
quiet_cmd_env_h = ENVH $@
cmd_env_h = cat $< | (cd $(obj) && $(objtree)/scripts/bin2c default_environment) > $@; \
echo "static const int default_environment_uncompress_size=`stat -c%s $(obj)/barebox_default_env`;" >> $@
--
1.8.5.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 5/5] Kconfig: Select default compression type
2014-02-19 10:50 Cleanup environment dependencies and compressed file generation Sascha Hauer
` (3 preceding siblings ...)
2014-02-19 10:50 ` [PATCH 4/5] defaultenv: use wildcard compression rules Sascha Hauer
@ 2014-02-19 10:50 ` Sascha Hauer
4 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2014-02-19 10:50 UTC (permalink / raw)
To: barebox
Instead of asking explicitly for the default environment compression
type ask for the in-barebox default compression type. This also adds
a DEFAULT_COMPRESSION_SUFFIX make variable which can be used together
with the wildcard rules for compressed files to generate compressed
files without explicitly support each compression type.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
Makefile | 17 +++++++++++++++++
common/Kconfig | 39 +++++++++++++++++++++------------------
common/Makefile | 13 +------------
common/startup.c | 2 +-
4 files changed, 40 insertions(+), 31 deletions(-)
diff --git a/Makefile b/Makefile
index 640e589..b48240a 100644
--- a/Makefile
+++ b/Makefile
@@ -504,6 +504,23 @@ barebox-alldirs := $(sort $(barebox-dirs) $(patsubst %/,%,$(filter %/, \
pbl-common-y := $(patsubst %/, %/built-in-pbl.o, $(common-y))
common-y := $(patsubst %/, %/built-in.o, $(common-y))
+ifeq ($(CONFIG_DEFAULT_COMPRESSION_GZIP),y)
+DEFAULT_COMPRESSION_SUFFIX := .gz
+endif
+ifeq ($(CONFIG_DEFAULT_COMPRESSED_BZIP2),y)
+DEFAULT_COMPRESSION_SUFFIX := .bz2
+endif
+ifeq ($(CONFIG_DEFAULT_COMPRESSION_LZO),y)
+DEFAULT_COMPRESSION_SUFFIX := .lzo
+endif
+ifeq ($(CONFIG_DEFAULT_COMPRESSION_LZ4),y)
+DEFAULT_COMPRESSION_SUFFIX := .lz4
+endif
+ifeq ($(CONFIG_DEFAULT_COMPRESSION_NONE),y)
+DEFAULT_COMPRESSION_SUFFIX :=
+endif
+export DEFAULT_COMPRESSION_SUFFIX
+
# Build barebox
# ---------------------------------------------------------------------------
# barebox is built from the objects selected by $(barebox-init) and
diff --git a/common/Kconfig b/common/Kconfig
index 8af7ec1..d6cda8c 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -535,35 +535,38 @@ config DEFAULT_ENVIRONMENT
Enabling this option will give you a default environment when
the environment found in the environment sector is invalid
-config DEFAULT_ENVIRONMENT_COMPRESSED
- bool
- depends on DEFAULT_ENVIRONMENT
- depends on !IMAGE_COMPRESSION_LZO
- depends on !IMAGE_COMPRESSION_GZIP
- default y if ZLIB
- default y if BZLIB
- default y if LZO_DECOMPRESS
-
-if DEFAULT_ENVIRONMENT_COMPRESSED
-
choice
- prompt "compression"
-
-config DEFAULT_ENVIRONMENT_COMPRESSED_GZIP
+ prompt "default compression for in-barebox binaries"
+ default DEFAULT_COMPRESSION_NONE if PBL_IMAGE
+ default DEFAULT_COMPRESSION_LZO if LZO_DECOMPRESS
+ default DEFAULT_COMPRESSION_GZIP if ZLIB
+ default DEFAULT_COMPRESSION_LZ4 if LZ4_DECOMPRESS
+ default DEFAULT_COMPRESSION_BZIP2 if BZLIB
+ help
+ Select the default compression for in-barebox binary files. Files
+ compiled into barebox like for example the default environment will
+ be compressed with this compression type.
+
+config DEFAULT_COMPRESSION_GZIP
bool "gzip"
depends on ZLIB
-config DEFAULT_ENVIRONMENT_COMPRESSED_BZIP2
+config DEFAULT_COMPRESSION_BZIP2
bool "bzip2"
depends on BZLIB
-config DEFAULT_ENVIRONMENT_COMPRESSED_LZO
+config DEFAULT_COMPRESSION_LZO
bool "lzo"
depends on LZO_DECOMPRESS
-endchoice
+config DEFAULT_COMPRESSION_LZ4
+ bool "lz4"
+ depends on LZ4_DECOMPRESS
-endif
+config DEFAULT_COMPRESSION_NONE
+ bool "no compression"
+
+endchoice
config HAVE_DEFAULT_ENVIRONMENT_NEW
bool
diff --git a/common/Makefile b/common/Makefile
index 60b0356..3cfaae2 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -76,22 +76,11 @@ cmd_envs = ($(srctree)/scripts/genenv $(srctree) $(objtree) $@ $(DEFAULT_ENVIRON
$(obj)/barebox_default_env: FORCE
$(call cmd,envs)
-barebox_default_env_comp =
-ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_COMPRESSED_GZIP),y)
-barebox_default_env_comp = .gz
-endif
-ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_COMPRESSED_BZIP2),y)
-barebox_default_env_comp = .bz2
-endif
-ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_COMPRESSED_LZO),y)
-barebox_default_env_comp = .lzo
-endif
-
quiet_cmd_env_h = ENVH $@
cmd_env_h = cat $< | (cd $(obj) && $(objtree)/scripts/bin2c default_environment) > $@; \
echo "static const int default_environment_uncompress_size=`stat -c%s $(obj)/barebox_default_env`;" >> $@
-$(obj)/barebox_default_env.h: $(obj)/barebox_default_env$(barebox_default_env_comp) FORCE
+$(obj)/barebox_default_env.h: $(obj)/barebox_default_env$(DEFAULT_COMPRESSION_SUFFIX) FORCE
$(call if_changed,env_h)
quiet_cmd_pwd_h = PWDH $@
diff --git a/common/startup.c b/common/startup.c
index e8b9ea0..4bc5628 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -52,7 +52,7 @@ static int register_default_env(void)
int ret;
void *defaultenv;
- if (IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT_COMPRESSED)) {
+ if (!IS_ENABLED(CONFIG_DEFAULT_COMPRESSION_NONE)) {
void *tmp = malloc(default_environment_size);
if (!tmp)
--
1.8.5.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread