From 7dd65feb6c603e13eba501c34c662259ab38e70e Mon Sep 17 00:00:00 2001 From: Albin Tonnerre Date: Fri, 8 Jan 2010 14:42:42 -0800 Subject: lib: add support for LZO-compressed kernels This patch series adds generic support for creating and extracting LZO-compressed kernel images, as well as support for using such images on the x86 and ARM architectures, and support for creating and using LZO-compressed initrd and initramfs images. Russell King said: : Testing on a Cortex A9 model: : - lzo decompressor is 65% of the time gzip takes to decompress a kernel : - lzo kernel is 9% larger than a gzip kernel : : which I'm happy to say confirms your figures when comparing the two. : : However, when comparing your new gzip code to the old gzip code: : - new is 99% of the size of the old code : - new takes 42% of the time to decompress than the old code : : What this means is that for a proper comparison, the results get even better: : - lzo is 7.5% larger than the old gzip'd kernel image : - lzo takes 28% of the time that the old gzip code took : : So the expense seems definitely worth the effort. The only reason I : can think of ever using gzip would be if you needed the additional : compression (eg, because you have limited flash to store the image.) : : I would argue that the default for ARM should therefore be LZO. This patch: The lzo compressor is worse than gzip at compression, but faster at extraction. Here are some figures for an ARM board I'm working on: Uncompressed size: 3.24Mo gzip 1.61Mo 0.72s lzo 1.75Mo 0.48s So for a compression ratio that is still relatively close to gzip, it's much faster to extract, at least in that case. This part contains: - Makefile routine to support lzo compression - Fixes to the existing lzo compressor so that it can be used in compressed kernels - wrapper around the existing lzo1x_decompress, as it only extracts one block at a time, while we need to extract a whole file here - config dialog for kernel compression [akpm@linux-foundation.org: coding-style fixes] [akpm@linux-foundation.org: cleanup] Signed-off-by: Albin Tonnerre Tested-by: Wu Zhangjin Acked-by: "H. Peter Anvin" Cc: Ingo Molnar Cc: Thomas Gleixner Tested-by: Russell King Acked-by: Russell King Cc: Ralf Baechle Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/Makefile.lib | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'scripts') diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index cd815ac2a50..0fe48cd91ff 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -235,3 +235,8 @@ quiet_cmd_lzma = LZMA $@ cmd_lzma = (cat $(filter-out FORCE,$^) | \ lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ (rm -f $@ ; false) + +quiet_cmd_lzo = LZO $@ +cmd_lzo = (cat $(filter-out FORCE,$^) | \ + lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ + (rm -f $@ ; false) -- cgit v1.2.3 From 272a897904b9a067550f5b8e812036b65180418f Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Fri, 8 Jan 2010 14:42:48 -0800 Subject: scripts/get_maintainer.pl: fix file exclusion X: logic The following command doesn't generate any output. `./scripts/get_maintainer.pl --no-git -f drivers/net/wireless/wl12xx/wl1271_acx.c` An excluded "X:" pattern match in any section would cause a file not to match any other section. Signed-off-by: Joe Perches Reported-by: Dan Carpenter Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/get_maintainer.pl | 84 ++++++++++++++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 30 deletions(-) (limited to 'scripts') diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 445e8845f0a..090f2483970 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -296,46 +296,56 @@ my @status = (); foreach my $file (@files) { -#Do not match excluded file patterns - - my $exclude = 0; - foreach my $line (@typevalue) { - if ($line =~ m/^(\C):\s*(.*)/) { - my $type = $1; - my $value = $2; - if ($type eq 'X') { - if (file_match_pattern($file, $value)) { - $exclude = 1; - last; - } - } - } - } + my %hash; + my $tvi = find_first_section(); + while ($tvi < @typevalue) { + my $start = find_starting_index($tvi); + my $end = find_ending_index($tvi); + my $exclude = 0; + my $i; + + #Do not match excluded file patterns - if (!$exclude) { - my $tvi = 0; - my %hash; - foreach my $line (@typevalue) { + for ($i = $start; $i < $end; $i++) { + my $line = $typevalue[$i]; if ($line =~ m/^(\C):\s*(.*)/) { my $type = $1; my $value = $2; - if ($type eq 'F') { + if ($type eq 'X') { if (file_match_pattern($file, $value)) { - my $value_pd = ($value =~ tr@/@@); - my $file_pd = ($file =~ tr@/@@); - $value_pd++ if (substr($value,-1,1) ne "/"); - if ($pattern_depth == 0 || - (($file_pd - $value_pd) < $pattern_depth)) { - $hash{$tvi} = $value_pd; - } + $exclude = 1; } } } - $tvi++; } - foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { - add_categories($line); + + if (!$exclude) { + for ($i = $start; $i < $end; $i++) { + my $line = $typevalue[$i]; + if ($line =~ m/^(\C):\s*(.*)/) { + my $type = $1; + my $value = $2; + if ($type eq 'F') { + if (file_match_pattern($file, $value)) { + my $value_pd = ($value =~ tr@/@@); + my $file_pd = ($file =~ tr@/@@); + $value_pd++ if (substr($value,-1,1) ne "/"); + if ($pattern_depth == 0 || + (($file_pd - $value_pd) < $pattern_depth)) { + $hash{$tvi} = $value_pd; + } + } + } + } + } } + + $tvi += ($end - $start); + + } + + foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { + add_categories($line); } if ($email && $email_git) { @@ -570,6 +580,20 @@ sub format_email { return $formatted_email; } +sub find_first_section { + my $index = 0; + + while ($index < @typevalue) { + my $tv = $typevalue[$index]; + if (($tv =~ m/^(\C):\s*(.*)/)) { + last; + } + $index++; + } + + return $index; +} + sub find_starting_index { my ($index) = @_; -- cgit v1.2.3 From b82a4045f7962483a78a874343dc6e31b79c96c1 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Mon, 11 Jan 2010 11:31:44 +0100 Subject: tracing/x86: Derive arch from bits argument in recordmcount.pl Let the arch argument be overruled by bits. Otherwise, building of external modules against a i386 target on a x86-64 host (and likely vice versa as well) fails unless ARCH=i386 is explicitly passed to make. Signed-off-by: Jan Kiszka LKML-Reference: <4B4AFE10.8050109@siemens.com> Signed-off-by: Steven Rostedt --- scripts/recordmcount.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index 92f09fe9639..ea6f6e3adae 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl @@ -194,7 +194,7 @@ sub check_objcopy } } -if ($arch eq "x86") { +if ($arch =~ /(x86(_64)?)|(i386)/) { if ($bits == 64) { $arch = "x86_64"; } else { -- cgit v1.2.3 From dbf004d7883b3adb058c0c1a5635bc4ec27651c0 Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Tue, 12 Jan 2010 16:59:52 -0500 Subject: remove my email address from checkpatch. Maybe this will stop people emailing me about it. Signed-off-by: Dave Jones Signed-off-by: Linus Torvalds --- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index bc4114f1ab3..3257d3d9676 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -# (c) 2001, Dave Jones. (the file handling bit) +# (c) 2001, Dave Jones. (the file handling bit) # (c) 2005, Joel Schopp (the ugly bit) # (c) 2007,2008, Andy Whitcroft (new conditions, test suite) # (c) 2008,2009, Andy Whitcroft -- cgit v1.2.3 From 1373411ae4cd0caf2e1a35fb801dd9a00b64dea2 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Mon, 28 Dec 2009 19:38:27 +0000 Subject: kbuild: really fix bzImage build with non-bash sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ß Reported-by: Oliver Hartkopp Reported-by: Michael Guntsche Signed-off-by: Jonathan Nieder Cc: Michael Tokarev Cc: Alek Du Cc: Andrew Morton Signed-off-by: Michal Marek --- scripts/Makefile.lib | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 0fe48cd91ff..f9bdf264473 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 $@ -- cgit v1.2.3 From 1f8cdae43929d32e3706c314eb2a302dc3683fba Mon Sep 17 00:00:00 2001 From: Hui Zhu Date: Fri, 15 Jan 2010 17:01:07 -0800 Subject: markup_oops.pl: fix error with x86 When I try to use markup_oops.pl in x86, I always get: cat 1 | perl markup_oops.pl ./vmlinux objdump: --start-address: bad number: NaN No matching code found This is because in line: if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+0x([0-9a-f]+)\/[a-f0-9]/) { $function = $1; $func_offset = $2; } $func_offset will get a number like "0x2" But in follow code: my $decodestart = Math::BigInt->from_hex("0x$target") - Math::BigInt->from_hex("0x$func_offset"); It add other ox to ox2. Then this value will be set to NaN. So I made a small patch to fix it. Signed-off-by: Hui Zhu Acked-by: Arjan van de Ven Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/markup_oops.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/markup_oops.pl b/scripts/markup_oops.pl index 5f0fcb712e2..ce3e40b01e4 100644 --- a/scripts/markup_oops.pl +++ b/scripts/markup_oops.pl @@ -154,7 +154,7 @@ while () { if ($line =~ /RIP: 0010:\[\<([a-z0-9]+)\>\]/) { $target = $1; } - if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) { + if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+0x([0-9a-f]+)\/0x[a-f0-9]/) { $function = $1; $func_offset = $2; } -- cgit v1.2.3 From 3a5dd791abef032fe57fc652c0232913c696e59b Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 17 Jan 2010 08:27:34 +1030 Subject: modpost: fix segfault in sym_is() with prefixed arches The sym_is() compares a symbol in an attempt to automatically skip symbol prefixes. It does this first by searching the real symbol with the normal unprefixed symbol. But then it uses the length of the original symbol to check the end of the substring instead of the length of the symbol it is looking for. On non-prefixed arches, this is effectively the same thing, so there is no problem. On prefixed-arches, since this is exceeds by just one byte, a crash is rare and it is usually a NUL byte anyways. But every once in a blue moon, you get the right page alignment and it segfaults. For example, on the Blackfin arch, sym_is() will be called with the real symbol "___mod_usb_device_table" as "symbol" when looking for the normal symbol "__mod_usb_device_table" as "name". The substring will thus return one byte into "symbol" and store it into "match". But then "match" will be indexed with the length of "symbol" instead of "name" and so we will exceed the storage. i.e. the code ends up doing: char foo[] = "abc"; return foo[strlen(foo)+1] == '\0'; Signed-off-by: Mike Frysinger Signed-off-by: Rusty Russell Signed-off-by: Linus Torvalds --- scripts/mod/file2alias.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 6f426afbc52..220213e603d 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -804,7 +804,7 @@ static inline int sym_is(const char *symbol, const char *name) match = strstr(symbol, name); if (!match) return 0; - return match[strlen(symbol)] == '\0'; + return match[strlen(name)] == '\0'; } static void do_table(void *symval, unsigned long size, -- cgit v1.2.3 From 99cf611613f8826f52c156810bfb9e34c71d193a Mon Sep 17 00:00:00 2001 From: Richard Kennedy Date: Tue, 2 Feb 2010 13:44:07 -0800 Subject: get_maintainer.pl: teach git log to use --no-color When git has been set to always use color in .gitconfig then I get the warning message Bad divisor in main::vcs_assign: 0 This is caused by vcs_file_signoffs not matching any commits due to the pattern not understand the colour codes. Fix this by telling git log to never use colour. Signed-off-by: Richard Kennedy Acked-by: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/get_maintainer.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 090f2483970..2f3230db7ff 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -74,8 +74,8 @@ my %VCS_cmds; my %VCS_cmds_git = ( "execute_cmd" => \&git_execute_cmd, "available" => '(which("git") ne "") && (-d ".git")', - "find_signers_cmd" => "git log --since=\$email_git_since -- \$file", - "find_commit_signers_cmd" => "git log -1 \$commit", + "find_signers_cmd" => "git log --no-color --since=\$email_git_since -- \$file", + "find_commit_signers_cmd" => "git log --no-color -1 \$commit", "blame_range_cmd" => "git blame -l -L \$diff_start,+\$diff_length \$file", "blame_file_cmd" => "git blame -l \$file", "commit_pattern" => "^commit [0-9a-f]{40,40}", -- cgit v1.2.3 From ef2b9b054580ef835078d8aa411bd06542cd5c1c Mon Sep 17 00:00:00 2001 From: Hui Zhu Date: Tue, 2 Feb 2010 13:44:09 -0800 Subject: markup_oops.pl: fix $func_offset error with x86_64 When I use markup_oops.pl parse a x8664 oops, I got: objdump: --start-address: bad number: NaN No matching code found This is because: main::(./m.pl:228): open(FILE, "objdump -dS --adjust-vma=$vmaoffset --start-address=$decodestart --stop-address=$decodestop $filename |") || die "Cannot start objdump"; DB<3> p $decodestart NaN This NaN is from: main::(./m.pl:176): my $decodestart = Math::BigInt->from_hex("0x$target") - Math::BigInt->from_hex("0x$func_offset"); DB<2> p $func_offset 0x175 There is already a "0x" in $func_offset, another 0x makes it a NaN. The $func_offset is from line: if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\] \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) { $function = $1; $func_offset = $2; } I make a patch to change "(0x[0-9a-f]+)\/0x[a-f0-9]/)" to "0x([0-9a-f]+)\/0x[a-f0-9]/)". Signed-off-by: Hui Zhu Cc: Arjan van de Ven Cc: Michal Marek Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/markup_oops.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/markup_oops.pl b/scripts/markup_oops.pl index ce3e40b01e4..e950f9cde01 100644 --- a/scripts/markup_oops.pl +++ b/scripts/markup_oops.pl @@ -158,7 +158,7 @@ while () { $function = $1; $func_offset = $2; } - if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\] \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) { + if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\] \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+0x([0-9a-f]+)\/0x[a-f0-9]/) { $function = $1; $func_offset = $2; } -- cgit v1.2.3