aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/Makefile.lib
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-05-06 00:17:15 -0400
committerH. Peter Anvin <hpa@zytor.com>2009-05-08 20:16:22 -0400
commitd3dd3b5a29bb9582957451531fed461628dfc834 (patch)
tree1c9961963861552a1a4759c27cc624a3098da860 /scripts/Makefile.lib
parent0b4eb462da10f832b28d518abffa4d77805928a0 (diff)
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. Sam Ravnborg integrated the bin_size script into the Makefile. [ Impact: new build feature, not yet used ] Signed-off-by: H. Peter Anvin <hpa@zytor.com> Acked-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/Makefile.lib')
-rw-r--r--scripts/Makefile.lib28
1 files changed, 21 insertions, 7 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 979619574f70..f8cf938dde98 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -183,20 +183,34 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
183# --------------------------------------------------------------------------- 183# ---------------------------------------------------------------------------
184 184
185quiet_cmd_gzip = GZIP $@ 185quiet_cmd_gzip = GZIP $@
186cmd_gzip = gzip -f -9 < $< > $@ 186cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9 > $@) || \
187 (rm -f $@ ; false)
187 188
188 189
189# Bzip2 190# Bzip2
190# --------------------------------------------------------------------------- 191# ---------------------------------------------------------------------------
191 192
192# Bzip2 does not include size in file... so we have to fake that 193# Bzip2 and LZMA do not include size in file... so we have to fake that;
193size_append=$(CONFIG_SHELL) $(srctree)/scripts/bin_size 194# append the size as a 32-bit littleendian number as gzip does.
194 195size_append = echo -ne $(shell \
195quiet_cmd_bzip2 = BZIP2 $@ 196dec_size=0; \
196cmd_bzip2 = (bzip2 -9 < $< && $(size_append) $<) > $@ || (rm -f $@ ; false) 197for F in $1; do \
198 fsize=$$(stat -c "%s" $$F); \
199 dec_size=$$(expr $$dec_size + $$fsize); \
200done; \
201printf "%08x" $$dec_size | \
202 sed 's/\(..\)\(..\)\(..\)\(..\)/\\\\x\4\\\\x\3\\\\x\2\\\\x\1/g' \
203)
204
205quiet_cmd_bzip2 = BZIP2 $@
206cmd_bzip2 = (cat $(filter-out FORCE,$^) | \
207 bzip2 -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
208 (rm -f $@ ; false)
197 209
198# Lzma 210# Lzma
199# --------------------------------------------------------------------------- 211# ---------------------------------------------------------------------------
200 212
201quiet_cmd_lzma = LZMA $@ 213quiet_cmd_lzma = LZMA $@
202cmd_lzma = (lzma -9 -c $< && $(size_append) $<) >$@ || (rm -f $@ ; false) 214cmd_lzma = (cat $(filter-out FORCE,$^) | \
215 lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
216 (rm -f $@ ; false)