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:
  kbuild: revert "save ARCH & CROSS_COMPILE ..."
  warn about use of uninstalled kernel headers
  kbuild: mkcompile_h: trivial cleanups
  kbuild: fix warning when domainname is not available
  kbuild: Fix size_append issue for bzip2/lzma kernel
  kbuild,scripts: use non-builtin echo for '-e'
  kbuild: fix the binrpm-pkg target to work with KBUILD_OUTPUT set
This commit is contained in:
Linus Torvalds 2009-10-13 10:20:53 -07:00
commit 25d591587d
9 changed files with 33 additions and 54 deletions

View file

@ -179,46 +179,9 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
# Alternatively CROSS_COMPILE can be set in the environment. # Alternatively CROSS_COMPILE can be set in the environment.
# Default value for CROSS_COMPILE is not to prefix executables # Default value for CROSS_COMPILE is not to prefix executables
# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
#
# To force ARCH and CROSS_COMPILE settings include kernel.* files
# in the kernel tree - do not patch this file.
export KBUILD_BUILDHOST := $(SUBARCH) export KBUILD_BUILDHOST := $(SUBARCH)
ARCH ?= $(SUBARCH)
# Kbuild save the ARCH and CROSS_COMPILE setting in kernel.* files. CROSS_COMPILE ?=
# Restore these settings and check that user did not specify
# conflicting values.
saved_arch := $(shell cat include/generated/kernel.arch 2> /dev/null)
saved_cross := $(shell cat include/generated/kernel.cross 2> /dev/null)
ifneq ($(CROSS_COMPILE),)
ifneq ($(saved_cross),)
ifneq ($(CROSS_COMPILE),$(saved_cross))
$(error CROSS_COMPILE changed from \
"$(saved_cross)" to \
to "$(CROSS_COMPILE)". \
Use "make mrproper" to fix it up)
endif
endif
else
CROSS_COMPILE := $(saved_cross)
endif
ifneq ($(ARCH),)
ifneq ($(saved_arch),)
ifneq ($(saved_arch),$(ARCH))
$(error ARCH changed from \
"$(saved_arch)" to "$(ARCH)". \
Use "make mrproper" to fix it up)
endif
endif
else
ifneq ($(saved_arch),)
ARCH := $(saved_arch)
else
ARCH := $(SUBARCH)
endif
endif
# Architecture as present in compile.h # Architecture as present in compile.h
UTS_MACHINE := $(ARCH) UTS_MACHINE := $(ARCH)
@ -483,11 +446,6 @@ ifeq ($(config-targets),1)
include $(srctree)/arch/$(SRCARCH)/Makefile include $(srctree)/arch/$(SRCARCH)/Makefile
export KBUILD_DEFCONFIG KBUILD_KCONFIG export KBUILD_DEFCONFIG KBUILD_KCONFIG
# save ARCH & CROSS_COMPILE settings
$(shell mkdir -p include/generated && \
echo $(ARCH) > include/generated/kernel.arch && \
echo $(CROSS_COMPILE) > include/generated/kernel.cross)
config: scripts_basic outputmakefile FORCE config: scripts_basic outputmakefile FORCE
$(Q)mkdir -p include/linux include/config $(Q)mkdir -p include/linux include/config
$(Q)$(MAKE) $(build)=scripts/kconfig $@ $(Q)$(MAKE) $(build)=scripts/kconfig $@

View file

@ -659,6 +659,12 @@ extern int do_sysinfo(struct sysinfo *info);
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#ifndef __EXPORTED_HEADERS__
#ifndef __KERNEL__
#warning Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders
#endif /* __KERNEL__ */
#endif /* __EXPORTED_HEADERS__ */
#define SI_LOAD_SHIFT 16 #define SI_LOAD_SHIFT 16
struct sysinfo { struct sysinfo {
long uptime; /* Seconds since boot */ long uptime; /* Seconds since boot */

View file

@ -100,7 +100,7 @@ as-option = $(call try-run,\
# Usage: cflags-y += $(call as-instr,instr,option1,option2) # Usage: cflags-y += $(call as-instr,instr,option1,option2)
as-instr = $(call try-run,\ as-instr = $(call try-run,\
echo -e "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3)) /bin/echo -e "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3))
# cc-option # cc-option
# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)

View file

@ -208,7 +208,7 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9 > $@) || \
# Bzip2 and LZMA do not include size in file... so we have to fake that; # Bzip2 and LZMA do not include size in file... so we have to fake that;
# append the size as a 32-bit littleendian number as gzip does. # append the size as a 32-bit littleendian number as gzip does.
size_append = echo -ne $(shell \ size_append = /bin/echo -ne $(shell \
dec_size=0; \ dec_size=0; \
for F in $1; do \ for F in $1; do \
fsize=$$(stat -c "%s" $$F); \ fsize=$$(stat -c "%s" $$F); \

View file

@ -9,7 +9,7 @@ paths="$@"
# Doing this once at the beginning saves a lot of time, on a cache-hot tree. # Doing this once at the beginning saves a lot of time, on a cache-hot tree.
Kconfigs="`find . -name 'Kconfig' -o -name 'Kconfig*[^~]'`" Kconfigs="`find . -name 'Kconfig' -o -name 'Kconfig*[^~]'`"
echo -e "File list \tundefined symbol used" /bin/echo -e "File list \tundefined symbol used"
find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while read i find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while read i
do do
# Output the bare Kconfig variable and the filename; the _MODULE part at # Output the bare Kconfig variable and the filename; the _MODULE part at
@ -54,6 +54,6 @@ while read symb files; do
# beyond the purpose of this script. # beyond the purpose of this script.
symb_bare=`echo $symb | sed -e 's/_MODULE//'` symb_bare=`echo $symb | sed -e 's/_MODULE//'`
if ! grep -q "\<$symb_bare\>" $Kconfigs; then if ! grep -q "\<$symb_bare\>" $Kconfigs; then
echo -e "$files: \t$symb" /bin/echo -e "$files: \t$symb"
fi fi
done|sort done|sort

View file

@ -20,7 +20,7 @@ use strict;
my ($readdir, $installdir, $arch, @files) = @ARGV; my ($readdir, $installdir, $arch, @files) = @ARGV;
my $unifdef = "scripts/unifdef -U__KERNEL__"; my $unifdef = "scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__";
foreach my $file (@files) { foreach my $file (@files) {
local *INFILE; local *INFILE;

View file

@ -1,3 +1,5 @@
#!/bin/sh
TARGET=$1 TARGET=$1
ARCH=$2 ARCH=$2
SMP=$3 SMP=$3
@ -50,7 +52,7 @@ UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS $TIMESTAMP"
# Truncate to maximum length # Truncate to maximum length
UTS_LEN=64 UTS_LEN=64
UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/" UTS_TRUNCATE="cut -b -$UTS_LEN"
# Generate a temporary compile.h # Generate a temporary compile.h
@ -66,9 +68,13 @@ UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/"
echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\" echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\"
if [ -x /bin/dnsdomainname ]; then if [ -x /bin/dnsdomainname ]; then
echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname | $UTS_TRUNCATE`\" domain=`dnsdomainname 2> /dev/null`
elif [ -x /bin/domainname ]; then elif [ -x /bin/domainname ]; then
echo \#define LINUX_COMPILE_DOMAIN \"`domainname | $UTS_TRUNCATE`\" domain=`domainname 2> /dev/null`
fi
if [ -n "$domain" ]; then
echo \#define LINUX_COMPILE_DOMAIN \"`echo $domain | $UTS_TRUNCATE`\"
else else
echo \#define LINUX_COMPILE_DOMAIN echo \#define LINUX_COMPILE_DOMAIN
fi fi

View file

@ -18,6 +18,9 @@
# e) generate the rpm files, based on kernel.spec # e) generate the rpm files, based on kernel.spec
# - Use /. to avoid tar packing just the symlink # - Use /. to avoid tar packing just the symlink
# Note that the rpm-pkg target cannot be used with KBUILD_OUTPUT,
# but the binrpm-pkg target can; for some reason O= gets ignored.
# Do we have rpmbuild, otherwise fall back to the older rpm # Do we have rpmbuild, otherwise fall back to the older rpm
RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \ RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
else echo rpm; fi) else echo rpm; fi)
@ -33,6 +36,12 @@ $(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile
$(CONFIG_SHELL) $(MKSPEC) > $@ $(CONFIG_SHELL) $(MKSPEC) > $@
rpm-pkg rpm: $(objtree)/kernel.spec FORCE rpm-pkg rpm: $(objtree)/kernel.spec FORCE
@if test -n "$(KBUILD_OUTPUT)"; then \
echo "Building source + binary RPM is not possible outside the"; \
echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \
echo "binrpm-pkg target instead."; \
false; \
fi
$(MAKE) clean $(MAKE) clean
$(PREV) ln -sf $(srctree) $(KERNELPATH) $(PREV) ln -sf $(srctree) $(KERNELPATH)
$(CONFIG_SHELL) $(srctree)/scripts/setlocalversion > $(objtree)/.scmversion $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion > $(objtree)/.scmversion
@ -61,7 +70,7 @@ binrpm-pkg: $(objtree)/binkernel.spec FORCE
set -e; \ set -e; \
mv -f $(objtree)/.tmp_version $(objtree)/.version mv -f $(objtree)/.tmp_version $(objtree)/.version
$(RPM) $(RPMOPTS) --define "_builddir $(srctree)" --target \ $(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \
$(UTS_MACHINE) -bb $< $(UTS_MACHINE) -bb $<
clean-files += $(objtree)/binkernel.spec clean-files += $(objtree)/binkernel.spec

View file

@ -70,7 +70,7 @@ echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules'
echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware' echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
echo "%endif" echo "%endif"
echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install' echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} KBUILD_SRC= modules_install'
echo "%ifarch ia64" echo "%ifarch ia64"
echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE"
echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/"