Skip to contentSkip to conversation

kbuild fix for 2.6.33

GIT PULL Michal Marek 2 participants 2 messages Jan 5, 2010 – Jan 9, 2010 Kbuild

lore
Share & tools
lore
#0 lore raw

Hi Linus,

please pull this to fix build with /bin/sh -> dash (as used in Ubuntu).

Thanks!
Michal

The following changes since commit 45d28b097280a78893ce25a5d0db41e6a2717853:
Linus Torvalds (1):
Merge branch 'reiserfs/kill-bkl' of git://git.kernel.org/.../frederic/random-tracing

are available in the git repository at:

git://repo.or.cz/linux-kbuild.git for-33

Jonathan Nieder (1):
kbuild: really fix bzImage build with non-bash sh

 scripts/Makefile.lib |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
Tested-by Meelis Roos Acked-by Michal Marek
#1 lore raw

Hi Linus,

Quoted 1 line · Michal Marek

please pull this to fix build with /bin/sh -> dash (as used in Ubuntu).

Could you look over this patch and perhaps apply it? In the grand scheme of things, it is a small issue, but it has been offering some Debian and Ubuntu users a lot of annoyance.

The problem is that dash's echo and printf do not support \x... escapes. The symptom is a build without errors resulting in a vmlinuz that cannot boot.

Thanks,
Jonathan

Quoted 7 lines

The following changes since commit 45d28b097280a78893ce25a5d0db41e6a2717853:
Linus Torvalds (1):
Merge branch 'reiserfs/kill-bkl' of git://git.kernel.org/.../frederic/random-tracing

are available in the git repository at:

git://repo.or.cz/linux-kbuild.git for-33

-- %< --
From: Jonathan Nieder <[email protected]>
Date: Mon, 28 Dec 2009 19:38:27 +0000
Subject: [PATCH] kbuild: really fix bzImage build with non-bash sh

dash's echo and printf do not support \x... escapes. The symptom is a build without errors resulting in a vmlinuz that cannot boot.

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. Use arithmetic expansion to convert from hexadecimal to octal to fix this.

You can see what is happening by examining the end of arch/x86/boot/compressed/vmlinux.bin.lzma after an x86 build with CONFIG_KERNEL_LZMA enabled and /bin/sh a symlink to dash. Without this patch, it ends with '\xf0\x7d\x39\x00' (16 bytes) instead of the 4 bytes intended and the resulting vmlinuz fails to boot.

With this change, an LZMA-compressed kernel built with dash as sh boots correctly again.

---
 scripts/Makefile.lib |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
scripts/Makefile.lib +7 -2
index cd815ac..eabedbb 100644
@@ -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   $@
Signature · 1 line
1.6.6