lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1241735222-6640-6-git-send-email-hpa@linux.intel.com>
Date:	Thu,  7 May 2009 15:26:53 -0700
From:	"H. Peter Anvin" <hpa@...ux.intel.com>
To:	linux-kernel@...r.kernel.org
Cc:	vgoyal@...hat.com, hbabu@...ibm.com, kexec@...ts.infradead.org,
	ying.huang@...el.com, mingo@...e.hu, tglx@...utronix.de,
	ebiederm@...ssion.com, sam@...nborg.org,
	"H. Peter Anvin" <hpa@...or.com>
Subject: [PATCH 05/14] kbuild: allow compressors (gzip, bzip2, lzma) to take multiple inputs

From: H. Peter Anvin <hpa@...or.com>

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@...or.com>
Cc: Sam Ravnborg <sam@...nborg.org>
---
 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..55f2161 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
+for 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
-- 
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ