From db9038c89d129383a9db2afcb72b504fe54f6edf Mon Sep 17 00:00:00 2001 From: Frans Pop Date: Tue, 25 Aug 2009 22:15:39 +0200 Subject: kbuild: fix the binrpm-pkg target to work with KBUILD_OUTPUT set The binrpm-pkg target (binary RPM only) fails when called with KBUILD_OUTPUT set. This patch makes it work. For the rpm-pkg target (source + binary RPM), building with KBUILD_OUTPUT set is not possible and also not needed as the actual build is done in a temporary directory anyway, so check that KBUILD_OUTPUT is not set in that case to avoid later errors. Signed-off-by: Frans Pop Signed-off-by: Sam Ravnborg --- scripts/package/Makefile | 11 ++++++++++- scripts/package/mkspec | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'scripts') 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 @@ # e) generate the rpm files, based on kernel.spec # - 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 RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \ else echo rpm; fi) @@ -33,6 +36,12 @@ $(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile $(CONFIG_SHELL) $(MKSPEC) > $@ 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 $(PREV) ln -sf $(srctree) $(KERNELPATH) $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion > $(objtree)/.scmversion @@ -61,7 +70,7 @@ binrpm-pkg: $(objtree)/binkernel.spec FORCE set -e; \ mv -f $(objtree)/.tmp_version $(objtree)/.version - $(RPM) $(RPMOPTS) --define "_builddir $(srctree)" --target \ + $(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \ $(UTS_MACHINE) -bb $< 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' echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware' 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 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" -- cgit v1.2.3 From a3ee9470e6ccce28b5c2a1c098a5ee5aa053c668 Mon Sep 17 00:00:00 2001 From: Amerigo Wang Date: Wed, 19 Aug 2009 18:19:55 +0800 Subject: kbuild,scripts: use non-builtin echo for '-e' Alek reported that on Ubuntu, where dash is used, 'echo -e' can't work, so let's use non-builtin echo in this case. Reported-by: Alek Du Signed-off-by: WANG Cong Signed-off-by: Sam Ravnborg --- scripts/Kbuild.include | 2 +- scripts/checkkconfigsymbols.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') 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,\ # Usage: cflags-y += $(call as-instr,instr,option1,option2) 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 # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) 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="$@" # Doing this once at the beginning saves a lot of time, on a cache-hot tree. 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 do # 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. symb_bare=`echo $symb | sed -e 's/_MODULE//'` if ! grep -q "\<$symb_bare\>" $Kconfigs; then - echo -e "$files: \t$symb" + /bin/echo -e "$files: \t$symb" fi done|sort -- cgit v1.2.3 From 58242b2b065557f8467a8630f7c9b2b4b2eb891f Mon Sep 17 00:00:00 2001 From: Alek Du Date: Wed, 19 Aug 2009 17:18:39 +0800 Subject: kbuild: Fix size_append issue for bzip2/lzma kernel The Makefile.lib will call "echo -ne" to append uncompressed kernel size to bzip2/lzma kernel image. The "echo" here depends on the shell that /bin/sh pointing to. On Ubuntu system, the /bin/sh is pointing to dash, which does not support "echo -e" at all. Use /bin/echo instead of shell echo should always be safe. Signed-off-by: Alek Du Acked-by: WANG Cong Signed-off-by: Sam Ravnborg --- scripts/Makefile.lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') 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 > $@) || \ # 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. -size_append = echo -ne $(shell \ +size_append = /bin/echo -ne $(shell \ dec_size=0; \ for F in $1; do \ fsize=$$(stat -c "%s" $$F); \ -- cgit v1.2.3 From 9c3049c02c6142e166c9472237f1f60d86153682 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Thu, 17 Sep 2009 00:38:39 +0300 Subject: kbuild: fix warning when domainname is not available Otherwise we get: "dnsdomainname: Unknown host" Signed-off-by: Felipe Contreras Acked-by: WANG Cong Signed-off-by: Sam Ravnborg --- scripts/mkcompile_h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index 6a12dd9f1181..f060763c0c6a 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h @@ -66,9 +66,13 @@ UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/" echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\" if [ -x /bin/dnsdomainname ]; then - echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname | $UTS_TRUNCATE`\" + domain=`dnsdomainname 2> /dev/null` 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 echo \#define LINUX_COMPILE_DOMAIN fi -- cgit v1.2.3 From 17c5ca98833dc3d8f8dd4e85487da238c50cd8c9 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Thu, 17 Sep 2009 00:38:40 +0300 Subject: kbuild: mkcompile_h: trivial cleanups UTS_TRUNCATTE is simpler this way, and now editors idetify this as a shell script. Signed-off-by: Felipe Contreras Acked-by: WANG Cong Signed-off-by: Sam Ravnborg --- scripts/mkcompile_h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index f060763c0c6a..bce3d0fe6fbd 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h @@ -1,3 +1,5 @@ +#!/bin/sh + TARGET=$1 ARCH=$2 SMP=$3 @@ -50,7 +52,7 @@ UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS $TIMESTAMP" # Truncate to maximum length UTS_LEN=64 -UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/" +UTS_TRUNCATE="cut -b -$UTS_LEN" # Generate a temporary compile.h -- cgit v1.2.3 From c01226c3145d173a0d38f9d5b4f229cc23d99ae2 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 21 Sep 2009 16:37:12 +0200 Subject: warn about use of uninstalled kernel headers User applications frequently hit problems when they try to use the kernel headers directly, rather than the exported headers. This adds an explicit warning for this case, and points to a URL holding an explanation of why this is wrong and what to do about it. Signed-off-by: Arnd Bergmann Signed-off-by: Sam Ravnborg --- scripts/headers_install.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') 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; 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) { local *INFILE; -- cgit v1.2.3