From 84336466011c589b6af554f2f2f1fcfa1a5c1437 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 21 Dec 2009 16:24:06 -0800 Subject: kconfig CROSS_COMPILE option This adds CROSS_COMPILE as a kconfig string so you can store it in .config. Then you can use plain "make" in the configured kernel build directory to do the right cross compilation without setting the command-line or environment variable every time. With this, you can set up different build directories for different kernel configurations, whether native or cross-builds, and then use the simple: make -C /build/dir M=module-source-dir idiom to build modules for any given target kernel, indicating which one by nothing but the build directory chosen. I tried a version that defaults the string with env="CROSS_COMPILE" so that in a "make oldconfig" with CROSS_COMPILE in the environment you can just hit return to store the way you're building it. But the kconfig prompt for strings doesn't give you any way to say you want an empty string instead of the default, so I punted that. Signed-off-by: Roland McGrath Cc: Sam Ravnborg Cc: Anibal Monsalve Salazar Cc: Steven Rostedt Cc: Michal Marek Signed-off-by: Andrew Morton Signed-off-by: Michal Marek --- Makefile | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 394aec712c7d..f9dc25cd9b2e 100644 --- a/Makefile +++ b/Makefile @@ -183,11 +183,14 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ # CROSS_COMPILE can be set on the command line # make CROSS_COMPILE=ia64-linux- # Alternatively CROSS_COMPILE can be set in the environment. +# A third alternative is to store a setting in .config so that plain +# "make" in the configured kernel build directory always uses that. # Default value for CROSS_COMPILE is not to prefix executables # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile export KBUILD_BUILDHOST := $(SUBARCH) ARCH ?= $(SUBARCH) CROSS_COMPILE ?= +CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%) # Architecture as present in compile.h UTS_MACHINE := $(ARCH) -- cgit v1.2.2 From 85a256d8e0116c8f5ad276730830f5d4d473344d Mon Sep 17 00:00:00 2001 From: David Rientjes Date: Wed, 13 Jan 2010 13:01:05 -0800 Subject: kbuild: improve version string logic The LOCALVERSION= string passed to "make" will now always be appended to the kernel version after CONFIG_LOCALVERSION, if it exists, regardless of whether CONFIG_LOCALVERSION_AUTO is set or not. This allows users to uniquely identify their kernel builds with a string. If CONFIG_LOCALVERSION_AUTO is enabled, the unique SCM tag reported by setlocalversion (or .scmversion) is appended to the kernel version, if it exists. When CONFIG_LOCALVERSION_AUTO is not enabled, a `+' is appended to the kernel version to represent that the kernel has been revised since the last release unless "make LOCALVERSION=" was used to uniquely identify the build. The end result is this: - when LOCALVERSION= is passed to "make", it is appended to the kernel version, - when CONFIG_LOCALVERSION_AUTO is enabled, a unique SCM identifier is appended if the respository has been revised beyond a tagged commit, and - when CONFIG_LOCALVERSION_AUTO is disabled, a `+' is appended if the repository has been revised beyond a tagged commit and LOCALVERSION= was not passed to "make". Examples: With CONFIG_LOCALVERSION_AUTO: "make" results in v2.6.32-rc4-00149-ga3ccf63. If there are uncommited changes to the respository, it results in v2.6.32-rc4-00149-ga3ccf63-dirty. If "make LOCALVERSION=kbuild" were used, it results in v2.6.32-rc4-kbuild-00149-ga3ccf63-dirty. Without CONFIG_LOCALVERSION_AUTO, "make" results in v2.6.32-rc4+ unless the repository is at the Linux v2.6.32-rc4 commit (in which case the version would be v2.6.32-rc4). If "make LOCALVERSION=kbuild" were used, it results in v2.6.32-rc4-kbuild. Also renames variables such as localver-auto and _localver-auto to more accurately describe what they represent: localver-extra and scm-identifier, respectively. Signed-off-by: David Rientjes Signed-off-by: Michal Marek --- Makefile | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index f9dc25cd9b2e..faa320a67bf8 100644 --- a/Makefile +++ b/Makefile @@ -910,14 +910,19 @@ endif # $(localver) # localversion* (files without backups, containing '~') # $(CONFIG_LOCALVERSION) (from kernel config setting) -# $(localver-auto) (only if CONFIG_LOCALVERSION_AUTO is set) -# ./scripts/setlocalversion (SCM tag, if one exists) -# $(LOCALVERSION) (from make command line if provided) +# $(LOCALVERSION) (from make command line, if provided) +# $(localver-extra) +# $(scm-identifier) (unique SCM tag, if one exists) +# ./scripts/setlocalversion (only with CONFIG_LOCALVERSION_AUTO) +# .scmversion (only with CONFIG_LOCALVERSION_AUTO) +# + (only without CONFIG_LOCALVERSION_AUTO +# and without LOCALVERSION= and +# repository is at non-tagged commit) # -# Note how the final $(localver-auto) string is included *only* if the -# kernel config option CONFIG_LOCALVERSION_AUTO is selected. Also, at the -# moment, only git is supported but other SCMs can edit the script -# scripts/setlocalversion and add the appropriate checks as needed. +# For kernels without CONFIG_LOCALVERSION_AUTO compiled from an SCM that has +# been revised beyond a tagged commit, `+' is appended to the version string +# when not overridden by using "make LOCALVERSION=". This indicates that the +# kernel is not a vanilla release version and has been modified. pattern = ".*/localversion[^~]*" string = $(shell cat /dev/null \ @@ -926,26 +931,32 @@ string = $(shell cat /dev/null \ localver = $(subst $(space),, $(string) \ $(patsubst "%",%,$(CONFIG_LOCALVERSION))) -# If CONFIG_LOCALVERSION_AUTO is set scripts/setlocalversion is called -# and if the SCM is know a tag from the SCM is appended. -# The appended tag is determined by the SCM used. +# scripts/setlocalversion is called to create a unique identifier if the source +# is managed by a known SCM and the repository has been revised since the last +# tagged (release) commit. The format of the identifier is determined by the +# SCM's implementation. # # .scmversion is used when generating rpm packages so we do not loose # the version information from the SCM when we do the build of the kernel # from the copied source -ifdef CONFIG_LOCALVERSION_AUTO - ifeq ($(wildcard .scmversion),) - _localver-auto = $(shell $(CONFIG_SHELL) \ + scm-identifier = $(shell $(CONFIG_SHELL) \ $(srctree)/scripts/setlocalversion $(srctree)) else - _localver-auto = $(shell cat .scmversion 2> /dev/null) + scm-identifier = $(shell cat .scmversion 2> /dev/null) endif - localver-auto = $(LOCALVERSION)$(_localver-auto) +ifdef CONFIG_LOCALVERSION_AUTO + localver-extra = $(scm-identifier) +else + ifneq ($scm-identifier,) + ifeq ($(LOCALVERSION),) + localver-extra = + + endif + endif endif -localver-full = $(localver)$(localver-auto) +localver-full = $(localver)$(LOCALVERSION)$(localver-extra) # Store (new) KERNELRELASE string in include/config/kernel.release kernelrelease = $(KERNELVERSION)$(localver-full) -- cgit v1.2.2 From 62718979780720e526a411dc66e810288aaa7bf6 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Wed, 13 Jan 2010 09:31:44 -0800 Subject: Makefile: Document ability to make file.lst and file.S Signed-off-by: Joe Perches Acked-by: WANG Cong Signed-off-by: Michal Marek --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index faa320a67bf8..03053c66bb3a 100644 --- a/Makefile +++ b/Makefile @@ -1261,7 +1261,9 @@ help: @echo ' firmware_install- Install all firmware to INSTALL_FW_PATH' @echo ' (default: $$(INSTALL_MOD_PATH)/lib/firmware)' @echo ' dir/ - Build all files in dir and below' - @echo ' dir/file.[ois] - Build specified target only' + @echo ' dir/file.[oisS] - Build specified target only' + @echo ' dir/file.lst - Build specified mixed source/assembly target only' + @echo ' (requires a recent binutils and recent build (System.map))' @echo ' dir/file.ko - Build module including final link' @echo ' modules_prepare - Set up for building external modules' @echo ' tags/TAGS - Generate tags file for editors' -- cgit v1.2.2 From d0679c730395d0bde9a46939e7ba255b4ba7dd7c Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Tue, 2 Feb 2010 14:40:02 -0800 Subject: kbuild: move -fno-dwarf2-cfi-asm to powerpc only Better dwarf2 unwind information is a good thing, it allows better debugging with kgdb and crash and helps systemtap. Commit 003086497f07f7f1e67c0c295e261740f822b377 ("Build with -fno-dwarf2-cfi-asm") disabled some CFI information globally to work around a module loader bug on powerpc. But this disables the better unwind tables for all architectures, not just powerpc. Move the workaround to powerpc and also add a suitable comment that's it really a workaround. This improves dwarf2 unwind tables on x86 at least. Signed-off-by: Andi Kleen Cc: Kyle McMartin Signed-off-by: Andrew Morton Acked-by: Benjamin Herrenschmidt Signed-off-by: Michal Marek --- Makefile | 3 --- 1 file changed, 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 03053c66bb3a..2e74a68878c7 100644 --- a/Makefile +++ b/Makefile @@ -579,9 +579,6 @@ KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,) # disable invalid "can't wrap" optimizations for signed / pointers KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow) -# revert to pre-gcc-4.4 behaviour of .eh_frame -KBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm) - # conserve stack if available KBUILD_CFLAGS += $(call cc-option,-fconserve-stack) -- cgit v1.2.2 From a6c366324cacd5f71107dd01362b995a1c67b1ad Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Mon, 8 Mar 2010 10:07:12 +0100 Subject: kbuild: Do not unnecessarily regenerate modules.builtin Only regenerate it if the configuration has changed. Also, do this after the modules build to fix errors with some weird Makefiles that are generated during build. Reported-by: Eric Miao Signed-off-by: Michal Marek --- Makefile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 2e74a68878c7..160cadadc471 100644 --- a/Makefile +++ b/Makefile @@ -882,9 +882,6 @@ $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ; PHONY += $(vmlinux-dirs) $(vmlinux-dirs): prepare scripts $(Q)$(MAKE) $(build)=$@ -ifdef CONFIG_MODULES - $(Q)$(MAKE) $(modbuiltin)=$@ -endif # Build the kernel release string # @@ -1089,7 +1086,7 @@ ifdef CONFIG_MODULES # By default, build modules as well -all: modules +all: modules modules.builtin # Build modules # @@ -1100,11 +1097,16 @@ all: modules PHONY += modules modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order - $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.builtin) > $(objtree)/modules.builtin @$(kecho) ' Building modules, stage 2.'; $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modbuild +modules.builtin: $(vmlinux-dirs:%=%/modules.builtin) + $(Q)$(AWK) '!x[$$0]++' $^ > $(objtree)/modules.builtin + +%/modules.builtin: include/config/auto.conf | modules + $(Q)$(MAKE) $(modbuiltin)=$* + # Target to prepare building external modules PHONY += modules_prepare -- cgit v1.2.2 From 73d1393eb8507ed5fd7f8e696f6b1ecc18035ebe Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Wed, 10 Mar 2010 12:28:58 +0100 Subject: kbuild: Generate modules.builtin in make modules_install The previous approach didn't work if one did make modules && make modules_install Add modules.builtin as dependency of _modinst_, which is the target that actually needs the file. Reported-by: Andrew Morton Signed-off-by: Michal Marek --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 160cadadc471..b98943a466c5 100644 --- a/Makefile +++ b/Makefile @@ -1086,7 +1086,7 @@ ifdef CONFIG_MODULES # By default, build modules as well -all: modules modules.builtin +all: modules # Build modules # @@ -1104,7 +1104,7 @@ modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin: $(vmlinux-dirs:%=%/modules.builtin) $(Q)$(AWK) '!x[$$0]++' $^ > $(objtree)/modules.builtin -%/modules.builtin: include/config/auto.conf | modules +%/modules.builtin: include/config/auto.conf $(Q)$(MAKE) $(modbuiltin)=$* @@ -1117,7 +1117,7 @@ PHONY += modules_install modules_install: _modinst_ _modinst_post PHONY += _modinst_ -_modinst_: +_modinst_: modules.builtin @if [ -z "`$(DEPMOD) -V 2>/dev/null | grep module-init-tools`" ]; then \ echo "Warning: you may need to install module-init-tools"; \ echo "See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt";\ -- cgit v1.2.2 From fb994ecc2b1c214951366c2ba5d8b121f0010d1f Mon Sep 17 00:00:00 2001 From: Greg Thelen Date: Wed, 5 May 2010 10:41:44 -0700 Subject: kbuild: Fix checking of scm-identifier variable I'm looking Makefile in the -mm branch (dated 2010-04-28-16-53) and seeing what looks like a bug in the checking of scm-identifier. The "ifneq ($scm-identifier)" seems to always execute "ifeq ($(LOCALVERSION,)) ...". This patch fixes the checking of scm-identifier. Signed-off-by: Greg Thelen Acked-by: David Rientjes Signed-off-by: Michal Marek --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index b98943a466c5..ea5f0bee1934 100644 --- a/Makefile +++ b/Makefile @@ -943,7 +943,7 @@ endif ifdef CONFIG_LOCALVERSION_AUTO localver-extra = $(scm-identifier) else - ifneq ($scm-identifier,) + ifneq ($(scm-identifier),) ifeq ($(LOCALVERSION),) localver-extra = + endif -- cgit v1.2.2 From e44a21b7268a022c7749f521c06214145bd161e4 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sat, 5 Jun 2010 20:43:24 -0700 Subject: Linux 2.6.35-rc2 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index efdc3d0d8e60..654c31aaec64 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 35 -EXTRAVERSION = -rc1 +EXTRAVERSION = -rc2 NAME = Sheep on Meth # *DOCUMENTATION* -- cgit v1.2.2 From 2da30e703c5a56e27249fa8b8607708123fa52f5 Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Mon, 7 Jun 2010 22:22:12 +0200 Subject: kbuild: Generate modules.builtin in make modules Generating the file in make modules_install was broken as well, because it didn't work in a readonly filesystem and otherwise it generated a root-owned file which is not wanted. Reported-by: Rafael J. Wysocki Signed-off-by: Michal Marek --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 654c31aaec64..993d1f335925 100644 --- a/Makefile +++ b/Makefile @@ -1095,7 +1095,7 @@ all: modules # using awk while concatenating to the final file. PHONY += modules -modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) +modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order @$(kecho) ' Building modules, stage 2.'; $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost @@ -1117,7 +1117,7 @@ PHONY += modules_install modules_install: _modinst_ _modinst_post PHONY += _modinst_ -_modinst_: modules.builtin +_modinst_: @if [ -z "`$(DEPMOD) -V 2>/dev/null | grep module-init-tools`" ]; then \ echo "Warning: you may need to install module-init-tools"; \ echo "See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt";\ -- cgit v1.2.2 From 7e27d6e778cd87b6f2415515d7127eba53fe5d02 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 11 Jun 2010 19:14:04 -0700 Subject: Linux 2.6.35-rc3 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 993d1f335925..d49d96c35ce5 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 35 -EXTRAVERSION = -rc2 +EXTRAVERSION = -rc3 NAME = Sheep on Meth # *DOCUMENTATION* -- cgit v1.2.2