diff options
-rw-r--r-- | Makefile | 46 | ||||
-rw-r--r-- | include/linux/kernel.h | 6 | ||||
-rw-r--r-- | scripts/Kbuild.include | 2 | ||||
-rw-r--r-- | scripts/Makefile.lib | 2 | ||||
-rwxr-xr-x | scripts/checkkconfigsymbols.sh | 4 | ||||
-rw-r--r-- | scripts/headers_install.pl | 2 | ||||
-rwxr-xr-x | scripts/mkcompile_h | 12 | ||||
-rw-r--r-- | scripts/package/Makefile | 11 | ||||
-rwxr-xr-x | scripts/package/mkspec | 2 |
9 files changed, 33 insertions, 54 deletions
@@ -179,46 +179,9 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ | |||
179 | # Alternatively CROSS_COMPILE can be set in the environment. | 179 | # Alternatively CROSS_COMPILE can be set in the environment. |
180 | # Default value for CROSS_COMPILE is not to prefix executables | 180 | # Default value for CROSS_COMPILE is not to prefix executables |
181 | # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile | 181 | # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile |
182 | # | ||
183 | # To force ARCH and CROSS_COMPILE settings include kernel.* files | ||
184 | # in the kernel tree - do not patch this file. | ||
185 | export KBUILD_BUILDHOST := $(SUBARCH) | 182 | export KBUILD_BUILDHOST := $(SUBARCH) |
186 | 183 | ARCH ?= $(SUBARCH) | |
187 | # Kbuild save the ARCH and CROSS_COMPILE setting in kernel.* files. | 184 | CROSS_COMPILE ?= |
188 | # Restore these settings and check that user did not specify | ||
189 | # conflicting values. | ||
190 | |||
191 | saved_arch := $(shell cat include/generated/kernel.arch 2> /dev/null) | ||
192 | saved_cross := $(shell cat include/generated/kernel.cross 2> /dev/null) | ||
193 | |||
194 | ifneq ($(CROSS_COMPILE),) | ||
195 | ifneq ($(saved_cross),) | ||
196 | ifneq ($(CROSS_COMPILE),$(saved_cross)) | ||
197 | $(error CROSS_COMPILE changed from \ | ||
198 | "$(saved_cross)" to \ | ||
199 | to "$(CROSS_COMPILE)". \ | ||
200 | Use "make mrproper" to fix it up) | ||
201 | endif | ||
202 | endif | ||
203 | else | ||
204 | CROSS_COMPILE := $(saved_cross) | ||
205 | endif | ||
206 | |||
207 | ifneq ($(ARCH),) | ||
208 | ifneq ($(saved_arch),) | ||
209 | ifneq ($(saved_arch),$(ARCH)) | ||
210 | $(error ARCH changed from \ | ||
211 | "$(saved_arch)" to "$(ARCH)". \ | ||
212 | Use "make mrproper" to fix it up) | ||
213 | endif | ||
214 | endif | ||
215 | else | ||
216 | ifneq ($(saved_arch),) | ||
217 | ARCH := $(saved_arch) | ||
218 | else | ||
219 | ARCH := $(SUBARCH) | ||
220 | endif | ||
221 | endif | ||
222 | 185 | ||
223 | # Architecture as present in compile.h | 186 | # Architecture as present in compile.h |
224 | UTS_MACHINE := $(ARCH) | 187 | UTS_MACHINE := $(ARCH) |
@@ -483,11 +446,6 @@ ifeq ($(config-targets),1) | |||
483 | include $(srctree)/arch/$(SRCARCH)/Makefile | 446 | include $(srctree)/arch/$(SRCARCH)/Makefile |
484 | export KBUILD_DEFCONFIG KBUILD_KCONFIG | 447 | export KBUILD_DEFCONFIG KBUILD_KCONFIG |
485 | 448 | ||
486 | # save ARCH & CROSS_COMPILE settings | ||
487 | $(shell mkdir -p include/generated && \ | ||
488 | echo $(ARCH) > include/generated/kernel.arch && \ | ||
489 | echo $(CROSS_COMPILE) > include/generated/kernel.cross) | ||
490 | |||
491 | config: scripts_basic outputmakefile FORCE | 449 | config: scripts_basic outputmakefile FORCE |
492 | $(Q)mkdir -p include/linux include/config | 450 | $(Q)mkdir -p include/linux include/config |
493 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ | 451 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index d3cd23f30039..f4e3184fa054 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -659,6 +659,12 @@ extern int do_sysinfo(struct sysinfo *info); | |||
659 | 659 | ||
660 | #endif /* __KERNEL__ */ | 660 | #endif /* __KERNEL__ */ |
661 | 661 | ||
662 | #ifndef __EXPORTED_HEADERS__ | ||
663 | #ifndef __KERNEL__ | ||
664 | #warning Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders | ||
665 | #endif /* __KERNEL__ */ | ||
666 | #endif /* __EXPORTED_HEADERS__ */ | ||
667 | |||
662 | #define SI_LOAD_SHIFT 16 | 668 | #define SI_LOAD_SHIFT 16 |
663 | struct sysinfo { | 669 | struct sysinfo { |
664 | long uptime; /* Seconds since boot */ | 670 | long uptime; /* Seconds since boot */ |
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 4f9c1908593b..c67e73ecd5be 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
@@ -100,7 +100,7 @@ as-option = $(call try-run,\ | |||
100 | # Usage: cflags-y += $(call as-instr,instr,option1,option2) | 100 | # Usage: cflags-y += $(call as-instr,instr,option1,option2) |
101 | 101 | ||
102 | as-instr = $(call try-run,\ | 102 | as-instr = $(call try-run,\ |
103 | echo -e "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3)) | 103 | /bin/echo -e "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3)) |
104 | 104 | ||
105 | # cc-option | 105 | # cc-option |
106 | # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) | 106 | # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) |
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 7a7778746ea6..ffdafb26f539 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -208,7 +208,7 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9 > $@) || \ | |||
208 | 208 | ||
209 | # Bzip2 and LZMA do not include size in file... so we have to fake that; | 209 | # Bzip2 and LZMA do not include size in file... so we have to fake that; |
210 | # append the size as a 32-bit littleendian number as gzip does. | 210 | # append the size as a 32-bit littleendian number as gzip does. |
211 | size_append = echo -ne $(shell \ | 211 | size_append = /bin/echo -ne $(shell \ |
212 | dec_size=0; \ | 212 | dec_size=0; \ |
213 | for F in $1; do \ | 213 | for F in $1; do \ |
214 | fsize=$$(stat -c "%s" $$F); \ | 214 | fsize=$$(stat -c "%s" $$F); \ |
diff --git a/scripts/checkkconfigsymbols.sh b/scripts/checkkconfigsymbols.sh index 39677c82747a..46be3c5a62b7 100755 --- a/scripts/checkkconfigsymbols.sh +++ b/scripts/checkkconfigsymbols.sh | |||
@@ -9,7 +9,7 @@ paths="$@" | |||
9 | # Doing this once at the beginning saves a lot of time, on a cache-hot tree. | 9 | # Doing this once at the beginning saves a lot of time, on a cache-hot tree. |
10 | Kconfigs="`find . -name 'Kconfig' -o -name 'Kconfig*[^~]'`" | 10 | Kconfigs="`find . -name 'Kconfig' -o -name 'Kconfig*[^~]'`" |
11 | 11 | ||
12 | echo -e "File list \tundefined symbol used" | 12 | /bin/echo -e "File list \tundefined symbol used" |
13 | find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while read i | 13 | find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while read i |
14 | do | 14 | do |
15 | # Output the bare Kconfig variable and the filename; the _MODULE part at | 15 | # Output the bare Kconfig variable and the filename; the _MODULE part at |
@@ -54,6 +54,6 @@ while read symb files; do | |||
54 | # beyond the purpose of this script. | 54 | # beyond the purpose of this script. |
55 | symb_bare=`echo $symb | sed -e 's/_MODULE//'` | 55 | symb_bare=`echo $symb | sed -e 's/_MODULE//'` |
56 | if ! grep -q "\<$symb_bare\>" $Kconfigs; then | 56 | if ! grep -q "\<$symb_bare\>" $Kconfigs; then |
57 | echo -e "$files: \t$symb" | 57 | /bin/echo -e "$files: \t$symb" |
58 | fi | 58 | fi |
59 | done|sort | 59 | done|sort |
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl index c6ae4052ab43..b89ca2c58fdb 100644 --- a/scripts/headers_install.pl +++ b/scripts/headers_install.pl | |||
@@ -20,7 +20,7 @@ use strict; | |||
20 | 20 | ||
21 | my ($readdir, $installdir, $arch, @files) = @ARGV; | 21 | my ($readdir, $installdir, $arch, @files) = @ARGV; |
22 | 22 | ||
23 | my $unifdef = "scripts/unifdef -U__KERNEL__"; | 23 | my $unifdef = "scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__"; |
24 | 24 | ||
25 | foreach my $file (@files) { | 25 | foreach my $file (@files) { |
26 | local *INFILE; | 26 | local *INFILE; |
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index 6a12dd9f1181..bce3d0fe6fbd 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h | |||
@@ -1,3 +1,5 @@ | |||
1 | #!/bin/sh | ||
2 | |||
1 | TARGET=$1 | 3 | TARGET=$1 |
2 | ARCH=$2 | 4 | ARCH=$2 |
3 | SMP=$3 | 5 | SMP=$3 |
@@ -50,7 +52,7 @@ UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS $TIMESTAMP" | |||
50 | # Truncate to maximum length | 52 | # Truncate to maximum length |
51 | 53 | ||
52 | UTS_LEN=64 | 54 | UTS_LEN=64 |
53 | UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/" | 55 | UTS_TRUNCATE="cut -b -$UTS_LEN" |
54 | 56 | ||
55 | # Generate a temporary compile.h | 57 | # Generate a temporary compile.h |
56 | 58 | ||
@@ -66,9 +68,13 @@ UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/" | |||
66 | echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\" | 68 | echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\" |
67 | 69 | ||
68 | if [ -x /bin/dnsdomainname ]; then | 70 | if [ -x /bin/dnsdomainname ]; then |
69 | echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname | $UTS_TRUNCATE`\" | 71 | domain=`dnsdomainname 2> /dev/null` |
70 | elif [ -x /bin/domainname ]; then | 72 | elif [ -x /bin/domainname ]; then |
71 | echo \#define LINUX_COMPILE_DOMAIN \"`domainname | $UTS_TRUNCATE`\" | 73 | domain=`domainname 2> /dev/null` |
74 | fi | ||
75 | |||
76 | if [ -n "$domain" ]; then | ||
77 | echo \#define LINUX_COMPILE_DOMAIN \"`echo $domain | $UTS_TRUNCATE`\" | ||
72 | else | 78 | else |
73 | echo \#define LINUX_COMPILE_DOMAIN | 79 | echo \#define LINUX_COMPILE_DOMAIN |
74 | fi | 80 | fi |
diff --git a/scripts/package/Makefile b/scripts/package/Makefile index fa4a0a17b7e0..f67cc885c807 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile | |||
@@ -18,6 +18,9 @@ | |||
18 | # e) generate the rpm files, based on kernel.spec | 18 | # e) generate the rpm files, based on kernel.spec |
19 | # - Use /. to avoid tar packing just the symlink | 19 | # - Use /. to avoid tar packing just the symlink |
20 | 20 | ||
21 | # Note that the rpm-pkg target cannot be used with KBUILD_OUTPUT, | ||
22 | # but the binrpm-pkg target can; for some reason O= gets ignored. | ||
23 | |||
21 | # Do we have rpmbuild, otherwise fall back to the older rpm | 24 | # Do we have rpmbuild, otherwise fall back to the older rpm |
22 | RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \ | 25 | RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \ |
23 | else echo rpm; fi) | 26 | else echo rpm; fi) |
@@ -33,6 +36,12 @@ $(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile | |||
33 | $(CONFIG_SHELL) $(MKSPEC) > $@ | 36 | $(CONFIG_SHELL) $(MKSPEC) > $@ |
34 | 37 | ||
35 | rpm-pkg rpm: $(objtree)/kernel.spec FORCE | 38 | rpm-pkg rpm: $(objtree)/kernel.spec FORCE |
39 | @if test -n "$(KBUILD_OUTPUT)"; then \ | ||
40 | echo "Building source + binary RPM is not possible outside the"; \ | ||
41 | echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \ | ||
42 | echo "binrpm-pkg target instead."; \ | ||
43 | false; \ | ||
44 | fi | ||
36 | $(MAKE) clean | 45 | $(MAKE) clean |
37 | $(PREV) ln -sf $(srctree) $(KERNELPATH) | 46 | $(PREV) ln -sf $(srctree) $(KERNELPATH) |
38 | $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion > $(objtree)/.scmversion | 47 | $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion > $(objtree)/.scmversion |
@@ -61,7 +70,7 @@ binrpm-pkg: $(objtree)/binkernel.spec FORCE | |||
61 | set -e; \ | 70 | set -e; \ |
62 | mv -f $(objtree)/.tmp_version $(objtree)/.version | 71 | mv -f $(objtree)/.tmp_version $(objtree)/.version |
63 | 72 | ||
64 | $(RPM) $(RPMOPTS) --define "_builddir $(srctree)" --target \ | 73 | $(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \ |
65 | $(UTS_MACHINE) -bb $< | 74 | $(UTS_MACHINE) -bb $< |
66 | 75 | ||
67 | clean-files += $(objtree)/binkernel.spec | 76 | clean-files += $(objtree)/binkernel.spec |
diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 3d93f8c81252..47bdd2f99b78 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec | |||
@@ -70,7 +70,7 @@ echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules' | |||
70 | echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware' | 70 | echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware' |
71 | echo "%endif" | 71 | echo "%endif" |
72 | 72 | ||
73 | echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install' | 73 | echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} KBUILD_SRC= modules_install' |
74 | echo "%ifarch ia64" | 74 | echo "%ifarch ia64" |
75 | echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" | 75 | echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" |
76 | echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" | 76 | echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" |