aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Nieder <[email protected]>2009-12-28 19:38:27 +0000
committerMichal Marek <[email protected]>2010-01-13 13:27:24 +0100
commit1373411ae4cd0caf2e1a35fb801dd9a00b64dea2 (patch)
tree37acd3331e8a4683f0232ed4458ecf3921485270
parent7284ce6c9f6153d1777df5f310c959724d1bd446 (diff)
kbuild: really fix bzImage build with non-bash sh
In an x86 build with CONFIG_KERNEL_LZMA enabled and dash as sh, arch/x86/boot/compressed/vmlinux.bin.lzma ends with '\xf0\x7d\x39\x00' (16 bytes) instead of the 4 bytes intended and the resulting vmlinuz fails to boot. This improves on the previous behavior, in which the file contained the characters '-ne ' as well, but not by much. Previous commits replaced "echo -ne" first with "/bin/echo -ne", then "printf" in the hope of improving portability, but none of these commands is guaranteed to support hexadecimal escapes on POSIX systems. So use the shell to convert from hexadecimal to octal. With this change, an LZMA-compressed kernel built with dash as sh boots correctly again. Reported-by: Sebastian Dalfuß <[email protected]> Reported-by: Oliver Hartkopp <[email protected]> Reported-by: Michael Guntsche <[email protected]> Signed-off-by: Jonathan Nieder <[email protected]> Cc: Michael Tokarev <[email protected]> Cc: Alek Du <[email protected]> Cc: Andrew Morton <[email protected]> Signed-off-by: Michal Marek <[email protected]>
-rw-r--r--scripts/Makefile.lib9
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 0fe48cd91ffa..f9bdf264473d 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -219,8 +219,13 @@ 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' \
+printf "%08x\n" $$dec_size | \
+ sed 's/\(..\)/\1 /g' | { \
+ read ch0 ch1 ch2 ch3; \
+ for ch in $$ch3 $$ch2 $$ch1 $$ch0; do \
+ printf '%s%03o' '\\' $$((0x$$ch)); \
+ done; \
+ } \
)
quiet_cmd_bzip2 = BZIP2 $@