LKML Archive on lore.kernel.org
 help / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Michal Marek" <mmarek@suse.cz>, "Sebastian Dalfuß" <sd@sedf.de>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Michael Tokarev" <mjt@tls.msk.ru>, "Alek Du" <alek.du@intel.com>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [GIT PULL] kbuild fix for 2.6.33
Date: Sat, 9 Jan 2010 16:48:28 -0600
Message-ID: <20100109224827.GA30610@progeny.tock> (raw)
In-Reply-To: <20100105155038.GA20834@sepie.suse.cz>

Hi Linus,

Michal Marek wrote:

> 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

> 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 <jrnieder@gmail.com>
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.

Fixes: http://bugzilla.kernel.org/show_bug.cgi?id=14907
Reported-by: Sebastian Dalfuß <sd@sedf.de>
Reported-by: Oliver Hartkopp <oliver@hartkopp.net>
Reported-by: Michael Guntsche <mike@it-loops.com>
Tested-by: Meelis Roos <mroos@linux.ee>
Cc: Michael Tokarev <mjt@tls.msk.ru>
Cc: Alek Du <alek.du@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 scripts/Makefile.lib |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index cd815ac..eabedbb 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   $@
-- 
1.6.6


      reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-05 15:50 Michal Marek
2010-01-09 22:48 ` Jonathan Nieder [this message]

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100109224827.GA30610@progeny.tock \
    --to=jrnieder@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=alek.du@intel.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjt@tls.msk.ru \
    --cc=mmarek@suse.cz \
    --cc=sd@sedf.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org linux-kernel@archiver.kernel.org
	public-inbox-index lkml


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox