Skip to content

Commit 65fc716

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes: Fix incompatibility with versions of Perl less than 5.6.0 kbuild: do not include arch/<ARCH>/include/asm in find-sources twice. kbuild: tag with git revision when git describe is missing kbuild: prevent modpost from looking for a .cmd file for a static library linked into a module kbuild: fix KBUILD_EXTRA_SYMBOLS adjust init section definitions scripts/checksyscalls.sh: fix for non-gnu sed scripts/package: don't break if %{_smp_mflags} isn't set kbuild: setlocalversion: dont include svn change count kbuild: improve check-symlink kbuild: mkspec - fix build rpm
2 parents 814b3be + 15a2ee7 commit 65fc716

9 files changed

Lines changed: 48 additions & 22 deletions

File tree

‎Makefile‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,7 @@ export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
961961

962962
# The asm symlink changes when $(ARCH) changes.
963963
# Detect this and ask user to run make mrproper
964+
# If asm is a stale symlink (point to dir that does not exist) remove it
964965
define check-symlink
965966
set -e; \
966967
if [ -L include/asm ]; then \
@@ -970,6 +971,10 @@ define check-symlink
970971
echo " set ARCH or save .config and run 'make mrproper' to fix it"; \
971972
exit 1; \
972973
fi; \
974+
test -e $$asmlink || rm include/asm; \
975+
elif [ -d include/asm ]; then \
976+
echo "ERROR: $@ is a directory but a symlink was expected";\
977+
exit 1; \
973978
fi
974979
endef
975980

@@ -1431,7 +1436,8 @@ ALLSOURCE_ARCHS := $(SRCARCH)
14311436
define find-sources
14321437
( for arch in $(ALLSOURCE_ARCHS) ; do \
14331438
find $(__srctree)arch/$${arch} $(RCS_FIND_IGNORE) \
1434-
-name $1 -print; \
1439+
-wholename $(__srctree)arch/$${arch}/include/asm -type d -prune \
1440+
-o -name $1 -print; \
14351441
done ; \
14361442
find $(__srctree)security/selinux/include $(RCS_FIND_IGNORE) \
14371443
-name $1 -print; \

‎include/linux/init.h‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,21 +112,25 @@
112112
#define __FINIT .previous
113113

114114
#define __INITDATA .section ".init.data","aw"
115+
#define __INITRODATA .section ".init.rodata","a"
115116
#define __FINITDATA .previous
116117

117118
#define __DEVINIT .section ".devinit.text", "ax"
118119
#define __DEVINITDATA .section ".devinit.data", "aw"
120+
#define __DEVINITRODATA .section ".devinit.rodata", "a"
119121

120122
#define __CPUINIT .section ".cpuinit.text", "ax"
121123
#define __CPUINITDATA .section ".cpuinit.data", "aw"
124+
#define __CPUINITRODATA .section ".cpuinit.rodata", "a"
122125

123126
#define __MEMINIT .section ".meminit.text", "ax"
124127
#define __MEMINITDATA .section ".meminit.data", "aw"
128+
#define __MEMINITRODATA .section ".meminit.rodata", "a"
125129

126130
/* silence warnings when references are OK */
127131
#define __REF .section ".ref.text", "ax"
128132
#define __REFDATA .section ".ref.data", "aw"
129-
#define __REFCONST .section ".ref.rodata", "aw"
133+
#define __REFCONST .section ".ref.rodata", "a"
130134

131135
#ifndef __ASSEMBLY__
132136
/*

‎scripts/Makefile.modpost‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ modpost = scripts/mod/modpost \
8282
$(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \
8383
$(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
8484
$(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
85-
$(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(EXTRA_SYMBOLS))) \
85+
$(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \
8686
$(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
8787
$(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \
8888
$(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \

‎scripts/checksyscalls.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ EOF
113113
}
114114

115115
syscall_list() {
116-
sed -n -e '/^\#define/ { s/[^_]*__NR_\([^[:space:]]*\).*/\
116+
sed -n -e '/^\#define/ s/[^_]*__NR_\([^[:space:]]*\).*/\
117117
\#if !defined \(__NR_\1\) \&\& !defined \(__IGNORE_\1\)\
118118
\#warning syscall \1 not implemented\
119-
\#endif/p }' $1
119+
\#endif/p' $1
120120
}
121121

122122
(ignore_list && syscall_list ${srctree}/arch/x86/include/asm/unistd_32.h) | \

‎scripts/headers_check.pl‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/perl
1+
#!/usr/bin/perl -w
22
#
33
# headers_check.pl execute a number of trivial consistency checks
44
#
@@ -17,7 +17,6 @@
1717
# 2) TODO: check for leaked CONFIG_ symbols
1818

1919
use strict;
20-
use warnings;
2120

2221
my ($dir, $arch, @files) = @ARGV;
2322

@@ -27,14 +26,15 @@
2726
my $filename;
2827

2928
foreach my $file (@files) {
29+
local *FH;
3030
$filename = $file;
31-
open(my $fh, '<', "$filename") or die "$filename: $!\n";
31+
open(FH, "<$filename") or die "$filename: $!\n";
3232
$lineno = 0;
33-
while ($line = <$fh>) {
33+
while ($line = <FH>) {
3434
$lineno++;
3535
check_include();
3636
}
37-
close $fh;
37+
close FH;
3838
}
3939
exit $ret;
4040

‎scripts/headers_install.pl‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/perl
1+
#!/usr/bin/perl -w
22
#
33
# headers_install prepare the listed header files for use in
44
# user space and copy the files to their destination.
@@ -17,28 +17,29 @@
1717
# 3) Drop all sections defined out by __KERNEL__ (using unifdef)
1818

1919
use strict;
20-
use warnings;
2120

2221
my ($readdir, $installdir, $arch, @files) = @ARGV;
2322

2423
my $unifdef = "scripts/unifdef -U__KERNEL__";
2524

2625
foreach my $file (@files) {
26+
local *INFILE;
27+
local *OUTFILE;
2728
my $tmpfile = "$installdir/$file.tmp";
28-
open(my $infile, '<', "$readdir/$file")
29+
open(INFILE, "<$readdir/$file")
2930
or die "$readdir/$file: $!\n";
30-
open(my $outfile, '>', "$tmpfile") or die "$tmpfile: $!\n";
31-
while (my $line = <$infile>) {
31+
open(OUTFILE, ">$tmpfile") or die "$tmpfile: $!\n";
32+
while (my $line = <INFILE>) {
3233
$line =~ s/([\s(])__user\s/$1/g;
3334
$line =~ s/([\s(])__force\s/$1/g;
3435
$line =~ s/([\s(])__iomem\s/$1/g;
3536
$line =~ s/\s__attribute_const__\s/ /g;
3637
$line =~ s/\s__attribute_const__$//g;
3738
$line =~ s/^#include <linux\/compiler.h>//;
38-
printf $outfile "%s", $line;
39+
printf OUTFILE "%s", $line;
3940
}
40-
close $outfile;
41-
close $infile;
41+
close OUTFILE;
42+
close INFILE;
4243
system $unifdef . " $tmpfile > $installdir/$file";
4344
unlink $tmpfile;
4445
}

‎scripts/mod/sumversion.c‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,15 @@ static int parse_file(const char *fname, struct md4_ctx *md)
290290
release_file(file, len);
291291
return 1;
292292
}
293+
/* Check whether the file is a static library or not */
294+
static int is_static_library(const char *objfile)
295+
{
296+
int len = strlen(objfile);
297+
if (objfile[len - 2] == '.' && objfile[len - 1] == 'a')
298+
return 1;
299+
else
300+
return 0;
301+
}
293302

294303
/* We have dir/file.o. Open dir/.file.o.cmd, look for deps_ line to
295304
* figure out source file. */
@@ -420,7 +429,8 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen)
420429
while ((fname = strsep(&sources, " ")) != NULL) {
421430
if (!*fname)
422431
continue;
423-
if (!parse_source_files(fname, &md))
432+
if (!(is_static_library(fname)) &&
433+
!parse_source_files(fname, &md))
424434
goto release;
425435
}
426436

‎scripts/package/mkspec‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,17 @@ fi
5757
echo "%build"
5858

5959
if ! $PREBUILT; then
60-
echo "make clean && make %{_smp_mflags}"
60+
echo "make clean && make %{?_smp_mflags}"
6161
echo ""
6262
fi
6363

6464
echo "%install"
6565
echo "%ifarch ia64"
6666
echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules'
67+
echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
6768
echo "%else"
6869
echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules'
70+
echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
6971
echo "%endif"
7072

7173
echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install'
@@ -92,5 +94,6 @@ echo "%files"
9294
echo '%defattr (-, root, root)'
9395
echo "%dir /lib/modules"
9496
echo "/lib/modules/$KERNELRELEASE"
97+
echo "/lib/firmware"
9598
echo "/boot/*"
9699
echo ""

‎scripts/setlocalversion‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ usage() {
99
cd "${1:-.}" || usage
1010

1111
# Check for git and a git repo.
12-
if head=`git rev-parse --verify HEAD 2>/dev/null`; then
12+
if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
1313
# Do we have an untagged version?
1414
if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then
1515
if tag=`git describe 2>/dev/null`; then
1616
echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
17+
else
18+
printf '%s%s' -g $head
1719
fi
1820
fi
1921

@@ -55,7 +57,7 @@ if rev=`svn info 2>/dev/null | grep '^Revision'`; then
5557

5658
# Are there uncommitted changes?
5759
if [ $changes != 0 ]; then
58-
printf -- '-svn%s%s%s' "$rev" -dirty "$changes"
60+
printf -- '-svn%s%s' "$rev" -dirty
5961
else
6062
printf -- '-svn%s' "$rev"
6163
fi

0 commit comments

Comments
 (0)