kbuild: save ARCH & CROSS_COMPILE when building a kernel
Subsystems (9)
PATCH 1/1 kbuild: save ARCH & CROSS_COMPILE when building a kernel
I have tested this locally - but it would
be good if someone with different habits than me try it out before it hits -next.
So far it works for me.
Last time I tries this it failed in strange ways in different setups. But I think I have addressed this by postponing the settings to *config time _after_ including the arch specific makefile.
This patch is a prerequisite for a small serie of patches to clean up how we handle generated files.
Sam
From 9e27e311540fbe0c31d9cdfe731ad60a54ad1202 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Mon, 20 Jul 2009 11:49:54 +0200
Subject: [PATCH] kbuild: save ARCH & CROSS_COMPILE when building a kernel
When building a kernel for a different architecture kbuild requires the user always to specify ARCH and CROSS_COMPILE on the command-line.
We use the asm symlink to detect if user forgets to specify the correct ARCH value - but that symlink is about to die. And we do now want to loose this check.
This patch save the settings of ARCH and CROSS_COMPILE in a file named ".kbuild".
The settings are saved during "make *config" time and always read.
If user try to change the settings we error out.
This works both for plain builds and for O=...
builds.
So now you can do:
$ mkdir sparc64 $ make O=sparc64 ARCH=sparc64 CROSS_COMPILE=sparc64-linux- defconfig $ cd sparc64 $ make
Notice that you no longer need to tell kbuild the settings of ARCH and CROSS_COMPILE when you type make in the output directory.
Likewise for plain builds where you do not use O=...
--- Makefile | 36 ++++++++++++++++++++++++++++++++++-- 1 files changed, 34 insertions(+), 2 deletions(-)
Makefile +34 -2
@@ -179,9 +179,36 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ # Alternatively CROSS_COMPILE can be set in the environment. # Default value for CROSS_COMPILE is not to prefix executables # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile +# +# To force ARCH and CROSS_COMPILE settings include .kbuild +# in the kernel tree - do not patch this file. export KBUILD_BUILDHOST := $(SUBARCH) -ARCH ?= $(SUBARCH) -CROSS_COMPILE ?= + +# Kbuild save the ARCH and CROSS_COMPILE setting in .kbuild +# Restore these settings and check that user did not specify +# conflicting values. +ifneq ($(wildcard .kbuild),) + -include .kbuild + ifneq ($(CROSS_COMPILE),) + ifneq ($(CROSS_COMPILE),$(KBUILD_CROSS_COMPILE)) + $(error CROSS_COMPILE changed from \ + "$(KBUILD_CROSS_COMPILE)" to \ + to "$(CROSS_COMPILE)". \ + Use "make mrproper" to fix it up) + endif + endif + ifneq ($(ARCH),) + ifneq ($(KBUILD_ARCH),$(ARCH)) + $(error ARCH changed from \ + "$(KBUILD_ARCH)" to "$(ARCH)". \ + Use "make mrproper" to fix it up) + endif + endif + CROSS_COMPILE := $(KBUILD_CROSS_COMPILE) + ARCH := $(KBUILD_ARCH) +else + ARCH ?= $(SUBARCH) +endif # Architecture as present in compile.h UTS_MACHINE := $(ARCH)
@@ -444,6 +471,10 @@ ifeq ($(config-targets),1) include $(srctree)/arch/$(SRCARCH)/Makefile export KBUILD_DEFCONFIG KBUILD_KCONFIG +# save ARCH & CROSS_COMPILE settings +$(shell (echo KBUILD_ARCH := $(ARCH) && \ + echo KBUILD_CROSS_COMPILE := $(CROSS_COMPILE)) > .kbuild) + config: scripts_basic outputmakefile FORCE $(Q)mkdir -p include/linux include/config $(Q)$(MAKE) $(build)=scripts/kconfig $@
@@ -1195,6 +1226,7 @@ CLEAN_FILES += vmlinux System.map \ # Directories & files removed with 'make mrproper' MRPROPER_DIRS += include/config include2 usr/include include/generated MRPROPER_FILES += .config .config.old include/asm .version .old_version \ + .kbuild \ include/linux/autoconf.h include/linux/version.h \ include/linux/utsrelease.h \ include/linux/bounds.h include/asm*/asm-offsets.h \
Signature · 1 line
1.6.2.5
Quoted 28 lines · Sam Ravnborg
From
9e27e311540fbe0c31d9cdfe731ad60a54ad1202Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Mon, 20 Jul 2009 11:49:54 +0200
Subject: [PATCH] kbuild: save ARCH &CROSS_COMPILEwhen building a kernelWhen building a kernel for a different architecture kbuild requires the user always to specify ARCH and
CROSS_COMPILEon the command-line.We use the asm symlink to detect if user forgets to specify the correct ARCH value - but that symlink is about to die. And we do now want to loose this check.
This patch save the settings of ARCH and
CROSS_COMPILEin a file named ".kbuild".
The settings are saved during "make *config" time and always read.If user try to change the settings we error out.
This works both for plain builds and for O=...
builds.
So now you can do:$ mkdir sparc64 $ make O=sparc64 ARCH=sparc64 CROSS_COMPILE=sparc64-linux- defconfig $ cd sparc64 $ make
Quoted 4 lines
Notice that you no longer need to tell kbuild the settings of ARCH and
CROSS_COMPILEwhen you type make in the output directory.
Likewise for plain builds where you do not use O=...
If I were to do:
$ make O=foo-build INSTALL_MOD_STRIP=1 modules_install install
after that, would that still use the CROSS_COMPILE setting used before?
If so, that would break my build. Because arch/x86/boot/install.sh does:
if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi
Which will not match my:
make CROSS_COMPILE="distcc ${ARCH}-linux-" -j $DISTCC_SLOTS "$@"
even when $ARCH is the right one for the machine in question.
Quoted 41 lines · Peter Zijlstra
Quoted 28 lines · Sam Ravnborg
From
9e27e311540fbe0c31d9cdfe731ad60a54ad1202Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Mon, 20 Jul 2009 11:49:54 +0200
Subject: [PATCH] kbuild: save ARCH &CROSS_COMPILEwhen building a kernelWhen building a kernel for a different architecture kbuild requires the user always to specify ARCH and
CROSS_COMPILEon the command-line.We use the asm symlink to detect if user forgets to specify the correct ARCH value - but that symlink is about to die. And we do now want to loose this check.
This patch save the settings of ARCH and
CROSS_COMPILEin a file named ".kbuild".
The settings are saved during "make *config" time and always read.If user try to change the settings we error out.
This works both for plain builds and for O=...
builds.
So now you can do:$ mkdir sparc64 $ make O=sparc64 ARCH=sparc64 CROSS_COMPILE=sparc64-linux- defconfig $ cd sparc64 $ makeQuoted 4 lines
Notice that you no longer need to tell kbuild the settings of ARCH and
CROSS_COMPILEwhen you type make in the output directory.
Likewise for plain builds where you do not use O=...If I were to do:
$ make O=foo-build INSTALL_MOD_STRIP=1 modules_install installafter that, would that still use the
CROSS_COMPILEsetting used before?
Quoted 8 lines
If so, that would break my build. Because
arch/x86/boot/install.shdoes:if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi
Which will not match my:
make CROSS_COMPILE="distcc ${ARCH}-linux-" -j $DISTCC_SLOTS "$@"
You are right that this would fail.....
And we would not be able to override the value of CROSS_COMPILE as kbuild will error out is we try to change that.
We have 5 archs that does the above so this needs to be addressed somehow.
The best solution I can come up with right now would be to fall back to the native version if the CROSS_COMPILE version does not exist.
Then the only situation where this would not work is if you use distcc/ccache to build your kernel for another architecture and you want to use the kbuild supplied install.sh script to install it. Because you cannot override the old CROSS_COMPILE setting.
Maybe the right solution would be to add specific support for distcc/ccache to overcome this if it turns out to be a real issue.
Suggested patch for x86 below.
arch/x86/boot/install.sh +5 -3
@@ -32,9 +32,11 @@ verify "$2" verify "$3" # User may have a custom install script - -if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi -if [ -x /sbin/${CROSS_COMPILE}installkernel ]; then exec /sbin/${CROSS_COMPILE}installkernel "$@"; fi +for INSTALL in ~/bin/${CROSS_COMPILE} /sbin/${CROSS_COMPILE} ~/bin /sbin/; do + if [ -x ${INSTALL}installkernel ]; then + exec ${INSTALL}installkernel "$@" + fi +done # Default install - same as make zlilo
Patch is only RFC for now. If we can agree on this I will patch all relevant archs.
Sam
arch/x86/boot/install.sh verify "$2" · line 39
Quoted 7 lines · Sam Ravnborg
arch/x86/boot/install.sh +5
-2-if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi -if [ -x /sbin/${CROSS_COMPILE}installkernel ]; then exec /sbin/${CROSS_COMPILE}installkernel "$@"; fi +for INSTALL in ~/bin/${CROSS_COMPILE} /sbin/${CROSS_COMPILE} ~/bin /sbin/; do + if [ -x ${INSTALL}installkernel ]; then + exec ${INSTALL}installkernel "$@" + fi +done
Won't that still get upset if CROSS_COMPILE has whitespace in it, which would form weird filenames etc.. or worse, it might match ~/bin/distcc
Quoted 11 lines · Peter Zijlstra
Review
Quoted 7 lines · Sam Ravnborg
(quoted diff) +5
-2-if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi -if [ -x /sbin/${CROSS_COMPILE}installkernel ]; then exec /sbin/${CROSS_COMPILE}installkernel "$@"; fi +for INSTALL in ~/bin/${CROSS_COMPILE} /sbin/${CROSS_COMPILE} ~/bin /sbin/; do + if [ -x ${INSTALL}installkernel ]; then + exec ${INSTALL}installkernel "$@" + fi +doneWon't that still get upset if
CROSS_COMPILEhas whitespace in it, which would form weird filenames etc.. or worse, it might match ~/bin/distcc
The root cause of this is the use of CROSS_COMPILE for the installkernel script.
We know that the CROSS_COMPILE prefix changes with the toolcahin and likely is a very personal thing.
So rather than using CROSS_COMPILE we should let the user override the installkernel script used.
The simplest replacement is the following patch which solves this and only people relying on the use of CROSS_COMPILE for installkernel needs to change anything.
Needs to change the other ~20 uses of installkernel if we agree on this change.
Sam
Makefile +3 -1
@@ -342,6 +342,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy OBJDUMP = $(CROSS_COMPILE)objdump AWK = awk GENKSYMS = scripts/genksyms/genksyms +INSTALLKERNEL := installkernel DEPMOD = /sbin/depmod KALLSYMS = scripts/kallsyms PERL = perl
@@ -380,7 +381,8 @@ KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC -export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE +export CPP AR NM STRIP OBJCOPY OBJDUMP +export MAKE AWK GENKSYMS INSTALLKERNEL PERL UTS_MACHINE export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
arch/x86/boot/install.sh +2 -2
@@ -33,8 +33,8 @@ verify "$3" # User may have a custom install script -if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi -if [ -x /sbin/${CROSS_COMPILE}installkernel ]; then exec /sbin/${CROSS_COMPILE}installkernel "$@"; fi +if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi +if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi # Default install - same as make zlilo
Quoted 20 lines · Sam Ravnborg
Quoted 11 lines · Peter Zijlstra
Review
Quoted 7 lines · Sam Ravnborg
(quoted diff) +5
-2-if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi -if [ -x /sbin/${CROSS_COMPILE}installkernel ]; then exec /sbin/${CROSS_COMPILE}installkernel "$@"; fi +for INSTALL in ~/bin/${CROSS_COMPILE} /sbin/${CROSS_COMPILE} ~/bin /sbin/; do + if [ -x ${INSTALL}installkernel ]; then + exec ${INSTALL}installkernel "$@" + fi +doneWon't that still get upset if
CROSS_COMPILEhas whitespace in it, which would form weird filenames etc.. or worse, it might match ~/bin/distccThe root cause of this is the use of
CROSS_COMPILEfor the installkernel script.
We know that theCROSS_COMPILEprefix changes with the toolcahin and likely is a very personal thing.
So rather than usingCROSS_COMPILEwe should let the user override the installkernel script used.
Quoted 6 lines
The simplest replacement is the following patch which solves this and only people relying on the use of
CROSS_COMPILEfor installkernel needs to change anything.Needs to change the other ~20 uses of installkernel if we agree on this change.
This is the patch I have cooked up.
I will push that to kbuild-next soon if there is no futher comments.
Sam
From 27d34661aed0cd3fbf469b8efb24accaf83c1987 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Mon, 20 Jul 2009 21:37:11 +0200
Subject: [PATCH] kbuild: Use INSTALLKERNEL to select customized installkernel script
Replace the use of CROSS_COMPILE to select a customized installkernel script with the possibility to set INSTALLKERNEL to select a custom installkernel script when running make:
make INSTALLKERNEL=arm-installkernel install
With this patch we are now more consistent across different architectures - they did not all support use of CROSS_COMPILE.
The use of CROSS_COMPILE was a hack as this really belongs to gcc/binutils and the installkernel script does not change just because we change toolchain.
The use of CROSS_COMPILE caused troubles with an upcoming patch that saves CROSS_COMPILE when a kernel is built -
it would no longer be installable.
[Thanks to Peter for this hint]
This patch undos what Ian did in commit:
0f8e2d62fa04441cd12c08ce521e84e5bd3f8a46
("use ${CROSS_COMPILE}installkernel in arch/*/boot/install.sh")The patch has been lightly tested on x86 - but all changes looks obvious.
--- Documentation/kbuild/kbuild.txt | 16 ++++++++++++++++ Makefile | 4 +++- arch/arm/Makefile | 4 ++-- arch/arm/boot/install.sh | 4 ++-- arch/blackfin/Makefile | 4 ++-- arch/blackfin/boot/install.sh | 6 +++--- arch/ia64/install.sh | 4 ++-- arch/m32r/boot/compressed/install.sh | 4 ++-- arch/m68k/install.sh | 4 ++-- arch/parisc/Makefile | 4 ++-- arch/parisc/install.sh | 4 ++-- arch/powerpc/Makefile | 4 ++-- arch/powerpc/boot/install.sh | 4 ++-- arch/s390/boot/install.sh | 4 ++-- arch/sh/boot/compressed/install.sh | 4 ++-- arch/x86/Makefile | 4 ++-- arch/x86/boot/install.sh | 4 ++-- 17 files changed, 50 insertions(+), 32 deletions(-)
Documentation/kbuild/kbuild.txt +16 -0
@@ -65,6 +65,22 @@ INSTALL_PATH INSTALL_PATH specifies where to place the updated kernel and system map images. Default is /boot, but you can set it to other values. +INSTALLKERNEL +-------------------------------------------------- +Install script called when using "make install". +The default name is "installkernel". + +The script will be called with the following arguments: + $1 - kernel version + $2 - kernel image file + $3 - kernel map file + $4 - default install path (use root directory if blank) + +The implmentation of "make install" is architecture specific +and it may differ from the above. + +INSTALLKERNEL is provided to enable the possibility to +specify a custom installer when cross compiling a kernel. MODLIB --------------------------------------------------
Makefile +3 -1
@@ -342,6 +342,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy OBJDUMP = $(CROSS_COMPILE)objdump AWK = awk GENKSYMS = scripts/genksyms/genksyms +INSTALLKERNEL := installkernel DEPMOD = /sbin/depmod KALLSYMS = scripts/kallsyms PERL = perl
@@ -380,7 +381,8 @@ KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC -export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE +export CPP AR NM STRIP OBJCOPY OBJDUMP +export MAKE AWK GENKSYMS INSTALLKERNEL PERL UTS_MACHINE export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
arch/arm/Makefile +2 -2
@@ -266,7 +266,7 @@ define archhelp echo ' (supply initrd image via make variable INITRD=<path>)' echo ' install - Install uncompressed kernel' echo ' zinstall - Install compressed kernel' - echo ' Install using (your) ~/bin/installkernel or' - echo ' (distribution) /sbin/installkernel or' + echo ' Install using (your) ~/bin/$(INSTALLKERNEL) or' + echo ' (distribution) /sbin/$(INSTALLKERNEL) or' echo ' install to $$(INSTALL_PATH) and run lilo' endef
arch/arm/boot/install.sh +2 -2
@@ -21,8 +21,8 @@ # # User may have a custom install script -if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi -if [ -x /sbin/${CROSS_COMPILE}installkernel ]; then exec /sbin/${CROSS_COMPILE}installkernel "$@"; fi +if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi +if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi if [ "$(basename $2)" = "zImage" ]; then # Compressed install
arch/blackfin/Makefile +2 -2
@@ -155,7 +155,7 @@ define archhelp echo '* vmImage.gz - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.gz)' echo ' vmImage.lzma - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.lzma)' echo ' install - Install kernel using' - echo ' (your) ~/bin/$(CROSS_COMPILE)installkernel or' - echo ' (distribution) PATH: $(CROSS_COMPILE)installkernel or' + echo ' (your) ~/bin/$(INSTALLKERNEL) or' + echo ' (distribution) PATH: $(INSTALLKERNEL) or' echo ' install to $$(INSTALL_PATH)' endef
arch/blackfin/boot/install.sh +3 -3
@@ -36,9 +36,9 @@ verify "$3" # User may have a custom install script -if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi -if which ${CROSS_COMPILE}installkernel >/dev/null 2>&1; then - exec ${CROSS_COMPILE}installkernel "$@" +if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi +if which ${INSTALLKERNEL} >/dev/null 2>&1; then + exec ${INSTALLKERNEL} "$@" fi # Default install - same as make zlilo
arch/ia64/install.sh +2 -2
@@ -21,8 +21,8 @@ # User may have a custom install script -if [ -x ~/bin/installkernel ]; then exec ~/bin/installkernel "$@"; fi -if [ -x /sbin/installkernel ]; then exec /sbin/installkernel "$@"; fi +if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi +if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi # Default install - same as make zlilo
arch/m32r/boot/compressed/install.sh +2 -2
@@ -24,8 +24,8 @@ # User may have a custom install script -if [ -x /sbin/installkernel ]; then - exec /sbin/installkernel "$@" +if [ -x /sbin/${INSTALLKERNEL} ]; then + exec /sbin/${INSTALLKERNEL} "$@" fi if [ "$2" = "zImage" ]; then
arch/m68k/install.sh +2 -2
@@ -33,8 +33,8 @@ verify "$3" # User may have a custom install script -if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi -if [ -x /sbin/${CROSS_COMPILE}installkernel ]; then exec /sbin/${CROSS_COMPILE}installkernel "$@"; fi +if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi +if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi # Default install - same as make zlilo
arch/parisc/Makefile +2 -2
@@ -118,8 +118,8 @@ define archhelp @echo '* vmlinux - Uncompressed kernel image (./vmlinux)' @echo ' palo - Bootable image (./lifimage)' @echo ' install - Install kernel using' - @echo ' (your) ~/bin/installkernel or' - @echo ' (distribution) /sbin/installkernel or' + @echo ' (your) ~/bin/$(INSTALLKERNEL) or' + @echo ' (distribution) /sbin/$(INSTALLKERNEL) or' @echo ' copy to $$(INSTALL_PATH)' endef
arch/parisc/install.sh +2 -2
@@ -21,8 +21,8 @@ # User may have a custom install script -if [ -x ~/bin/installkernel ]; then exec ~/bin/installkernel "$@"; fi -if [ -x /sbin/installkernel ]; then exec /sbin/installkernel "$@"; fi +if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi +if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi # Default install
arch/powerpc/Makefile +2 -2
@@ -182,8 +182,8 @@ define archhelp @echo ' simpleImage.<dt> - Firmware independent image.' @echo ' treeImage.<dt> - Support for older IBM 4xx firmware (not U-Boot)' @echo ' install - Install kernel using' - @echo ' (your) ~/bin/installkernel or' - @echo ' (distribution) /sbin/installkernel or' + @echo ' (your) ~/bin/$(INSTALLKERNEL) or' + @echo ' (distribution) /sbin/$(INSTALLKERNEL) or' @echo ' install to $$(INSTALL_PATH) and run lilo' @echo ' *_defconfig - Select default config from arch/$(ARCH)/configs' @echo ''
arch/powerpc/boot/install.sh +2 -2
@@ -23,8 +23,8 @@ set -e # User may have a custom install script -if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi -if [ -x /sbin/${CROSS_COMPILE}installkernel ]; then exec /sbin/${CROSS_COMPILE}installkernel "$@"; fi +if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi +if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi # Default install
arch/s390/boot/install.sh +2 -2
@@ -21,8 +21,8 @@ # User may have a custom install script -if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi -if [ -x /sbin/${CROSS_COMPILE}installkernel ]; then exec /sbin/${CROSS_COMPILE}installkernel "$@"; fi +if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi +if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi # Default install - same as make zlilo
arch/sh/boot/compressed/install.sh +2 -2
@@ -23,8 +23,8 @@ # User may have a custom install script -if [ -x /sbin/installkernel ]; then - exec /sbin/installkernel "$@" +if [ -x /sbin/${INSTALLKERNEL} ]; then + exec /sbin/${INSTALLKERNEL} "$@" fi if [ "$2" = "zImage" ]; then
arch/x86/Makefile +2 -2
@@ -177,8 +177,8 @@ archclean: define archhelp echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)' echo ' install - Install kernel using' - echo ' (your) ~/bin/installkernel or' - echo ' (distribution) /sbin/installkernel or' + echo ' (your) ~/bin/$(INSTALLKERNEL) or' + echo ' (distribution) /sbin/$(INSTALLKERNEL) or' echo ' install to $$(INSTALL_PATH) and run lilo' echo ' fdimage - Create 1.4MB boot floppy image (arch/x86/boot/fdimage)' echo ' fdimage144 - Create 1.4MB boot floppy image (arch/x86/boot/fdimage)'
arch/x86/boot/install.sh +2 -2
@@ -33,8 +33,8 @@ verify "$3" # User may have a custom install script -if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi -if [ -x /sbin/${CROSS_COMPILE}installkernel ]; then exec /sbin/${CROSS_COMPILE}installkernel "$@"; fi +if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi +if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi # Default install - same as make zlilo
Signature · 1 line
1.6.2.5
Peter Zijlstra
Acked-byQuoted 24 lines · Sam Ravnborg
From
27d34661aed0cd3fbf469b8efb24accaf83c1987Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Mon, 20 Jul 2009 21:37:11 +0200
Subject: [PATCH] kbuild: Use INSTALLKERNEL to select customized installkernel scriptReplace the use of
CROSS_COMPILEto select a customized installkernel script with the possibility to set INSTALLKERNEL to select a custom installkernel script when running make:make INSTALLKERNEL=arm-installkernel install
With this patch we are now more consistent across different architectures - they did not all support use of
CROSS_COMPILE.The use of
CROSS_COMPILEwas a hack as this really belongs to gcc/binutils and the installkernel script does not change just because we change toolchain.The use of
CROSS_COMPILEcaused troubles with an upcoming patch that savesCROSS_COMPILEwhen a kernel is built -
it would no longer be installable.
[Thanks to Peter for this hint]
Quoted 7 lines
This patch undos what Ian did in commit:
0f8e2d62fa04441cd12c08ce521e84e5bd3f8a46 ("use ${CROSS_COMPILE}installkernel in arch/*/boot/install.sh")The patch has been lightly tested on x86 - but all changes looks obvious.
Looks good to me, thanks sam!
Quoted 28 lines · Sam Ravnborg
arch/blackfin/Makefile +0
-0@@ -155,7 +155,7 @@ define archhelpecho '* vmImage.gz - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.gz)' echo ' vmImage.lzma - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.lzma)' echo ' install - Install kernel using'
- echo ' (your) ~/bin/$(CROSS_COMPILE)installkernel or'
- echo ' (distribution) PATH: $(CROSS_COMPILE)installkernel or'
+ echo ' (your) ~/bin/$(INSTALLKERNEL) or'
+ echo ' (distribution) PATH: $(INSTALLKERNEL) or' echo ' install to $$(INSTALL_PATH)'
endefarch/blackfin/boot/install.sh +3
-3@@ -36,9 +36,9 @@ verify "$3" # User may have a custom install script -if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi -if which ${CROSS_COMPILE}installkernel >/dev/null 2>&1; then - exec ${CROSS_COMPILE}installkernel "$@" +if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi +if which ${INSTALLKERNEL} >/dev/null 2>&1; then + exec ${INSTALLKERNEL} "$@"fi
Quoted 1 line
# Default install - same as make zlilo
np with this, Acked-by-me
-mike
Quoted 7 lines · Sam Ravnborg
This works both for plain builds and for O=...
builds.
So now you can do:$ mkdir sparc64 $ make O=sparc64 ARCH=sparc64 CROSS_COMPILE=sparc64-linux- defconfig $ cd sparc64 $ make
Like anyone who does a lot of cross builds will ever write that by hand..
Quoted 11 lines · Peter Zijlstra
Quoted 7 lines · Sam Ravnborg
This works both for plain builds and for O=...
builds.
So now you can do:$ mkdir sparc64 $ make O=sparc64 ARCH=sparc64 CROSS_COMPILE=sparc64-linux- defconfig $ cd sparc64 $ makeLike anyone who does a lot of cross builds will ever write that by hand..
I usually have the first three lines scripted. And when entering _any_ arch specific directory it is convinient just to type 'make'.
And yes - I do a lot of cross builds as kbuild by nature is not tied to a specific architecture.
Sam