From 46dca86cb93db80992a45e4b55737ff2b2f61cd0 Mon Sep 17 00:00:00 2001 From: Evgeniy Manachkin Date: Wed, 15 Oct 2008 23:37:26 +0600 Subject: [PATCH 01/11] kbuild: mkspec - fix build rpm This is patch to fix incorrect mkspec script to make rpm correctly at 2.6.27 vanilla kernel. This is regression in 2.6.27. 2.6.26 make rpm work good. In 2.6.27 'make rpm' say error from rpmbuild "Many unpacked files (*.fw)." Signed-off-by: Evgeniy Manachkin Acked-by: Alan Cox Signed-off-by: Sam Ravnborg Cc: Stable --- scripts/package/mkspec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/package/mkspec b/scripts/package/mkspec index ffd61fe0c1ad..62c5ffdf2fdf 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -64,8 +64,10 @@ fi echo "%install" echo "%ifarch ia64" echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules' +echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware' echo "%else" echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules' +echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware' echo "%endif" echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install' @@ -92,5 +94,6 @@ echo "%files" echo '%defattr (-, root, root)' echo "%dir /lib/modules" echo "/lib/modules/$KERNELRELEASE" +echo "/lib/firmware" echo "/boot/*" echo "" From dcc2da1a9693807096e9ac5137b499a829c51268 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 25 Oct 2008 22:58:23 +0200 Subject: [PATCH 02/11] kbuild: improve check-symlink o if include/asm point to a nonexisting directory remove the asm symlink o if include/asm is a directory error out This fixes a situation where one could be left with a symlink to asm-x86 but that directory no longer exist and thus the build would error out. include/asm may be a directory if the kernel tree has been copied Signed-off-by: Sam Ravnborg --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index a7f20687d8e5..ffac7126c944 100644 --- a/Makefile +++ b/Makefile @@ -961,6 +961,7 @@ export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) # The asm symlink changes when $(ARCH) changes. # Detect this and ask user to run make mrproper +# If asm is a stale symlink (point to dir that does not exist) remove it define check-symlink set -e; \ if [ -L include/asm ]; then \ @@ -970,6 +971,10 @@ define check-symlink echo " set ARCH or save .config and run 'make mrproper' to fix it"; \ exit 1; \ fi; \ + test -e $$asmlink || rm include/asm; \ + elif [ -d include/asm ]; then \ + echo "ERROR: $@ is a directory but a symlink was expected";\ + exit 1; \ fi endef From e3da2fb712bb75b6035ba0743f3256df1de30bce Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 25 Oct 2008 17:43:50 -0400 Subject: [PATCH 03/11] kbuild: setlocalversion: dont include svn change count The number of pending changes is pretty useless, so encoding it into the version is just annoying by the constant shuffle in corresponding modules. Signed-off-by: Mike Frysinger Signed-off-by: Sam Ravnborg --- scripts/setlocalversion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setlocalversion b/scripts/setlocalversion index 83b75126c9f7..453faffe18a7 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion @@ -55,7 +55,7 @@ if rev=`svn info 2>/dev/null | grep '^Revision'`; then # Are there uncommitted changes? if [ $changes != 0 ]; then - printf -- '-svn%s%s%s' "$rev" -dirty "$changes" + printf -- '-svn%s%s' "$rev" -dirty else printf -- '-svn%s' "$rev" fi From 13797b77d419fc1b16eebf2993bf7b5cea65f0bf Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Sat, 25 Oct 2008 15:02:47 -0700 Subject: [PATCH 04/11] scripts/package: don't break if %{_smp_mflags} isn't set Currently, if we do a 'make rpm-pkg' without the _smp_mflags rpm macro defined, the build fails with: [snip] Executing(%build): /bin/bash -e /var/tmp/rpm-tmp.67959 + umask 022 + cd /home/jk/devel/kernel-snapshot/rpm/BUILD + cd kernel-2.6.26 + make clean + make '%{_smp_mflags}' make[3]: *** No rule to make target `%{_smp_mflags}'. Stop. error: Bad exit status from /var/tmp/rpm-tmp.67959 (%build) This change uses the 'null if not set' reference to the _smp_mflags macro instead. Signed-off-by: Jeremy Kerr Signed-off-by: Andrew Morton Signed-off-by: Sam Ravnborg --- scripts/package/mkspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 62c5ffdf2fdf..2500886fb90a 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -57,7 +57,7 @@ fi echo "%build" if ! $PREBUILT; then -echo "make clean && make %{_smp_mflags}" +echo "make clean && make %{?_smp_mflags}" echo "" fi From bd8f89ff47f11941a109220dbd51d81fd7ed2058 Mon Sep 17 00:00:00 2001 From: Thomas Volpini Date: Sat, 25 Oct 2008 15:02:50 -0700 Subject: [PATCH 05/11] scripts/checksyscalls.sh: fix for non-gnu sed Make the checksyscalls script work even on systems where sed is non-gnu. Signed-off-by: Andrew Morton Signed-off-by: Sam Ravnborg --- scripts/checksyscalls.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh index 41564b142c04..60d00d1c4eee 100755 --- a/scripts/checksyscalls.sh +++ b/scripts/checksyscalls.sh @@ -113,10 +113,10 @@ EOF } syscall_list() { -sed -n -e '/^\#define/ { s/[^_]*__NR_\([^[:space:]]*\).*/\ +sed -n -e '/^\#define/ s/[^_]*__NR_\([^[:space:]]*\).*/\ \#if !defined \(__NR_\1\) \&\& !defined \(__IGNORE_\1\)\ \#warning syscall \1 not implemented\ -\#endif/p }' $1 +\#endif/p' $1 } (ignore_list && syscall_list ${srctree}/arch/x86/include/asm/unistd_32.h) | \ From 3f5e26cee443eb4d3900cd3085664c3e51b72135 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Sat, 25 Oct 2008 15:02:51 -0700 Subject: [PATCH 06/11] adjust init section definitions Add rodata equivalents for assembly use, and fix the section attributes used by __REFCONST. Signed-off-by: Jan Beulich Signed-off-by: Andrew Morton Signed-off-by: Sam Ravnborg --- include/linux/init.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/linux/init.h b/include/linux/init.h index 0c1264668be0..68cb0265d009 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -112,21 +112,25 @@ #define __FINIT .previous #define __INITDATA .section ".init.data","aw" +#define __INITRODATA .section ".init.rodata","a" #define __FINITDATA .previous #define __DEVINIT .section ".devinit.text", "ax" #define __DEVINITDATA .section ".devinit.data", "aw" +#define __DEVINITRODATA .section ".devinit.rodata", "a" #define __CPUINIT .section ".cpuinit.text", "ax" #define __CPUINITDATA .section ".cpuinit.data", "aw" +#define __CPUINITRODATA .section ".cpuinit.rodata", "a" #define __MEMINIT .section ".meminit.text", "ax" #define __MEMINITDATA .section ".meminit.data", "aw" +#define __MEMINITRODATA .section ".meminit.rodata", "a" /* silence warnings when references are OK */ #define __REF .section ".ref.text", "ax" #define __REFDATA .section ".ref.data", "aw" -#define __REFCONST .section ".ref.rodata", "aw" +#define __REFCONST .section ".ref.rodata", "a" #ifndef __ASSEMBLY__ /* From 92f83cc56eeafdb8fcf07ceb89fd9a0212bd498c Mon Sep 17 00:00:00 2001 From: Peter Volkov Date: Sat, 25 Oct 2008 15:02:52 -0700 Subject: [PATCH 07/11] kbuild: fix KBUILD_EXTRA_SYMBOLS Taken from http://bugzilla.kernel.org/show_bug.cgi?id=11567 If you even define KBUILD_EXTRA_SYMBOLS in Makefile it will not be expanded into command line argument for modpost. Signed-off-by: Andrew Morton Signed-off-by: Sam Ravnborg --- scripts/Makefile.modpost | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 9ee9783aea57..f4053dc7b5d6 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -82,7 +82,7 @@ modpost = scripts/mod/modpost \ $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \ $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \ $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \ - $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(EXTRA_SYMBOLS))) \ + $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \ $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \ From e6e6733ed9451827165d853f25bf99ba55e12feb Mon Sep 17 00:00:00 2001 From: Ashutosh Naik Date: Sat, 25 Oct 2008 15:02:53 -0700 Subject: [PATCH 08/11] kbuild: prevent modpost from looking for a .cmd file for a static library linked into a module This fixes a compile time warning which occurs whenever a static library is linked into a kernel module. MODPOST tries to look for a "..cmd" file to look for its dependencies, but that file doesn't exist or get generated for static libraries. This patch prevents modpost from looking for a .cmd file when a module is linked with a static library [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Ashutosh Naik Cc: Rusty Russell Signed-off-by: Andrew Morton Signed-off-by: Sam Ravnborg --- scripts/mod/sumversion.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c index d9cc6901d680..aadc5223dcdb 100644 --- a/scripts/mod/sumversion.c +++ b/scripts/mod/sumversion.c @@ -290,6 +290,15 @@ static int parse_file(const char *fname, struct md4_ctx *md) release_file(file, len); return 1; } +/* Check whether the file is a static library or not */ +static int is_static_library(const char *objfile) +{ + int len = strlen(objfile); + if (objfile[len - 2] == '.' && objfile[len - 1] == 'a') + return 1; + else + return 0; +} /* We have dir/file.o. Open dir/.file.o.cmd, look for deps_ line to * figure out source file. */ @@ -420,7 +429,8 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen) while ((fname = strsep(&sources, " ")) != NULL) { if (!*fname) continue; - if (!parse_source_files(fname, &md)) + if (!(is_static_library(fname)) && + !parse_source_files(fname, &md)) goto release; } From f03b283f081f538ec71b9e87cb8411bb62e2abc9 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Fri, 12 Sep 2008 12:26:24 -0700 Subject: [PATCH 09/11] kbuild: tag with git revision when git describe is missing setlocalversion used to use an abbreviated git commit sha1 to generate the tag. This was changed in commit d882421f4e08ddf0a94245cdbe516db260aa6f41 "kbuild: change CONFIG_LOCALVERSION_AUTO to use a git-describe-ish format" to use git describe to come up with a tag. Which is nice, but git describe sometimes can't describe the revision. Commit 56b2f0706d82535fd8d85503f2dcc0be40c8e55d ("setlocalversion: do not describe if there is nothing to describe") addressed this, but there is still no tag generated. So, generate a plain abbreviated sha1 tag like setlocalversion used to when git describe comes up short. Signed-off-by: Trent Piepho CC: Jan Engelhardt Signed-off-by: Sam Ravnborg --- scripts/setlocalversion | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/setlocalversion b/scripts/setlocalversion index 453faffe18a7..72d233528ade 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion @@ -9,11 +9,13 @@ usage() { cd "${1:-.}" || usage # Check for git and a git repo. -if head=`git rev-parse --verify HEAD 2>/dev/null`; then +if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then # Do we have an untagged version? if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then if tag=`git describe 2>/dev/null`; then echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' + else + printf '%s%s' -g $head fi fi From de2addf592894b31b8149cca008f00d8102401e9 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Tue, 28 Oct 2008 13:36:25 +0000 Subject: [PATCH 10/11] kbuild: do not include arch//include/asm in find-sources twice. Architectures which have moved their includes to arch//include now list the headers twice in the source listing used by "make cscope" and friends, causing those tools to list symbols twice. Skipping these files in the ALLSOURCE_ARCHS pass rather than removing the ALLINCLUDE_ARCHS pass preserves the semantics of the later. Signed-off-by: Ian Campbell Signed-off-by: Sam Ravnborg --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ffac7126c944..d50081751e02 100644 --- a/Makefile +++ b/Makefile @@ -1436,7 +1436,8 @@ ALLSOURCE_ARCHS := $(SRCARCH) define find-sources ( for arch in $(ALLSOURCE_ARCHS) ; do \ find $(__srctree)arch/$${arch} $(RCS_FIND_IGNORE) \ - -name $1 -print; \ + -wholename $(__srctree)arch/$${arch}/include/asm -type d -prune \ + -o -name $1 -print; \ done ; \ find $(__srctree)security/selinux/include $(RCS_FIND_IGNORE) \ -name $1 -print; \ From 15a2ee74d22674c58f347b16b3af5601fa4e15db Mon Sep 17 00:00:00 2001 From: Jeremy Huntwork Date: Wed, 29 Oct 2008 14:20:13 -0700 Subject: [PATCH 11/11] Fix incompatibility with versions of Perl less than 5.6.0 Fix headers_install.pl and headers_check.pl to be compatible with versions of Perl less than 5.6.0. It has been tested with Perl 5.005_03 and 5.8.8. I realize this may not be an issue for most people, but there will still be some that hit it, I imagine. There are three basic issues: 1. Prior to 5.6.0 open() only used 2 arguments, and the versions of the scripts in 2.6.27.1 use 3. 2. 5.6.0 also introduced the ability to use uninitialized scalar variables as file handles, which the current scripts make use of. 3. Lastly, 5.6.0 also introduced the pragma 'use warnings'. We can use the -w switch and be backwards compatible. Signed-off-by: Jeremy Huntwork Signed-off-by: Andrew Morton Signed-off-by: Sam Ravnborg --- scripts/headers_check.pl | 10 +++++----- scripts/headers_install.pl | 17 +++++++++-------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl index 15d53a6b1a1f..488a3b1f760f 100644 --- a/scripts/headers_check.pl +++ b/scripts/headers_check.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/perl -w # # headers_check.pl execute a number of trivial consistency checks # @@ -17,7 +17,6 @@ # 2) TODO: check for leaked CONFIG_ symbols use strict; -use warnings; my ($dir, $arch, @files) = @ARGV; @@ -27,14 +26,15 @@ my $lineno = 0; my $filename; foreach my $file (@files) { + local *FH; $filename = $file; - open(my $fh, '<', "$filename") or die "$filename: $!\n"; + open(FH, "<$filename") or die "$filename: $!\n"; $lineno = 0; - while ($line = <$fh>) { + while ($line = ) { $lineno++; check_include(); } - close $fh; + close FH; } exit $ret; diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl index 68591cd08731..7d2b4146e02f 100644 --- a/scripts/headers_install.pl +++ b/scripts/headers_install.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/perl -w # # headers_install prepare the listed header files for use in # user space and copy the files to their destination. @@ -17,28 +17,29 @@ # 3) Drop all sections defined out by __KERNEL__ (using unifdef) use strict; -use warnings; my ($readdir, $installdir, $arch, @files) = @ARGV; my $unifdef = "scripts/unifdef -U__KERNEL__"; foreach my $file (@files) { + local *INFILE; + local *OUTFILE; my $tmpfile = "$installdir/$file.tmp"; - open(my $infile, '<', "$readdir/$file") + open(INFILE, "<$readdir/$file") or die "$readdir/$file: $!\n"; - open(my $outfile, '>', "$tmpfile") or die "$tmpfile: $!\n"; - while (my $line = <$infile>) { + open(OUTFILE, ">$tmpfile") or die "$tmpfile: $!\n"; + while (my $line = ) { $line =~ s/([\s(])__user\s/$1/g; $line =~ s/([\s(])__force\s/$1/g; $line =~ s/([\s(])__iomem\s/$1/g; $line =~ s/\s__attribute_const__\s/ /g; $line =~ s/\s__attribute_const__$//g; $line =~ s/^#include //; - printf $outfile "%s", $line; + printf OUTFILE "%s", $line; } - close $outfile; - close $infile; + close OUTFILE; + close INFILE; system $unifdef . " $tmpfile > $installdir/$file"; unlink $tmpfile; }