lkml.org 
[lkml]   [2009]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH] kbuild: correct size calculation of bzImgae / fix x86 boot
Date
Michal Marek <mmarek@suse.cz> writes:

> Andreas Schwab napsal(a):
>> Does dash's printf support %b? Then this should work.
>
> Good idea. %b is specified by posix, so there is hope :).

Actually you don't need it anyway. (Still untested though.)

Andreas.

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index cd815ac..7173c0c 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -213,14 +213,16 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9 > $@) || \

# Bzip2 and LZMA do not include size in file... so we have to fake that;
# append the size as a 32-bit littleendian number as gzip does.
-size_append = printf $(shell \
+size_append = printf $$( \
dec_size=0; \
for F in $1; do \
fsize=$$(stat -c "%s" $$F); \
dec_size=$$(expr $$dec_size + $$fsize); \
done; \
-printf "%08x" $$dec_size | \
- sed 's/\(..\)\(..\)\(..\)\(..\)/\\\\x\4\\\\x\3\\\\x\2\\\\x\1/g' \
+for i in 1 2 3 4; do \
+ printf '\\%03o' $$(expr $$dec_size % 256); \
+ dec_size=$$(expr $$dec_size / 256); \
+done \
)

quiet_cmd_bzip2 = BZIP2 $@
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."


\
 
 \ /
  Last update: 2009-12-21 14:53    [W:0.160 / U:23.504 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site