Commit-ID: 9264e8e2b738f52dbca85814d552aab9a0a88171 Gitweb: http://git.kernel.org/tip/9264e8e2b738f52dbca85814d552aab9a0a88171 Author: H. Peter Anvin <hpa@xxxxxxxxx> AuthorDate: Tue, 5 May 2009 21:17:15 -0700 Committer: H. Peter Anvin <hpa@xxxxxxxxx> CommitDate: Tue, 5 May 2009 21:17:15 -0700 kbuild: allow compressors (gzip, bzip2, lzma) to take multiple inputs Allow the compression commands in Kbuild (i.e. gzip, bzip2, lzma) to take multiple input files and emit the concatenated compressed output. This avoids an intermediate step when a kernel image is built from multiple components, such as the relocatable x86-32 kernel. [ Impact: new build feature, not yet used ] Signed-off-by: H. Peter Anvin <hpa@xxxxxxxxx> Cc: Sam Ravnborg <sam@xxxxxxxxxxxx> --- scripts/Makefile.lib | 11 ++++++++--- scripts/bin_size | 8 ++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 9796195..35dfdf6 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -183,7 +183,8 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ # --------------------------------------------------------------------------- quiet_cmd_gzip = GZIP $@ -cmd_gzip = gzip -f -9 < $< > $@ +cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9 > $@) || \ + (rm -f $@ ; false) # Bzip2 @@ -193,10 +194,14 @@ cmd_gzip = gzip -f -9 < $< > $@ size_append=$(CONFIG_SHELL) $(srctree)/scripts/bin_size quiet_cmd_bzip2 = BZIP2 $@ -cmd_bzip2 = (bzip2 -9 < $< && $(size_append) $<) > $@ || (rm -f $@ ; false) +cmd_bzip2 = (cat $(filter-out FORCE,$^) | \ + bzip2 -9 && $(size_append) $(filter-out FORCE,$^)) > $@ || \ + (rm -f $@ ; false) # Lzma # --------------------------------------------------------------------------- quiet_cmd_lzma = LZMA $@ -cmd_lzma = (lzma -9 -c $< && $(size_append) $<) >$@ || (rm -f $@ ; false) +cmd_lzma = (cat $(filter-out FORCE,$^) | \ + lzma -9 && $(size_append) $(filter-out FORCE,$^)) > $@ || \ + (rm -f $@ ; false) diff --git a/scripts/bin_size b/scripts/bin_size index 43e1b36..5b0ae5b 100644 --- a/scripts/bin_size +++ b/scripts/bin_size @@ -1,10 +1,14 @@ #!/bin/sh if [ $# = 0 ] ; then - echo Usage: $0 file + echo Usage: $0 file... fi -size_dec=`stat -c "%s" $1` +size_dec=0 +foreach file; do + fsize=`stat -c "%s" $file` + size_dec=`expr $size_dec + $fsize` +done size_hex_echo_string=`printf "%08x" $size_dec | sed 's/\(..\)\(..\)\(..\)\(..\)/\\\\x\4\\\\x\3\\\\x\2\\\\x\1/g'` /bin/echo -ne $size_hex_echo_string -- To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
![]() |