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=...
Signed-off-by: Sam Ravnborg <[email protected]>
---
Makefile | 36 ++++++++++++++++++++++++++++++++++--
1 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 79957b3..3c95e76 100644
--- a/Makefile
+++ b/Makefile
@@ -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 \
--
1.6.2.5
On Mon, 2009-07-20 at 12:01 +0200, Sam Ravnborg wrote:
> 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=...
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.
On Mon, Jul 20, 2009 at 12:34:19PM +0200, Peter Zijlstra wrote:
> On Mon, 2009-07-20 at 12:01 +0200, Sam Ravnborg wrote:
>
> > 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=...
>
> 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 "$@"
>
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.
diff --git a/arch/x86/boot/install.sh b/arch/x86/boot/install.sh
index 8d60ee1..59f0f0f 100644
--- a/arch/x86/boot/install.sh
+++ b/arch/x86/boot/install.sh
@@ -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
On Mon, 2009-07-20 at 13:51 +0200, Sam Ravnborg wrote:
> -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
On Mon, Jul 20, 2009 at 02:00:43PM +0200, Peter Zijlstra wrote:
> On Mon, 2009-07-20 at 13:51 +0200, Sam Ravnborg wrote:
> > -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
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
diff --git a/Makefile b/Makefile
index 3c95e76..b55b47a 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/arch/x86/boot/install.sh b/arch/x86/boot/install.sh
index 8d60ee1..d13ec1c 100644
--- a/arch/x86/boot/install.sh
+++ b/arch/x86/boot/install.sh
@@ -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
On Mon, Jul 20, 2009 at 07:12:00PM +0200, Sam Ravnborg wrote:
> On Mon, Jul 20, 2009 at 02:00:43PM +0200, Peter Zijlstra wrote:
> > On Mon, 2009-07-20 at 13:51 +0200, Sam Ravnborg wrote:
> > > -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
>
> 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.
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.
Cc: Peter Zijlstra <[email protected]>
Cc: Ian Campbell <[email protected]>
Cc: Russell King <[email protected]>
Cc: Mike Frysinger <[email protected]>
Cc: Tony Luck <[email protected]>, Fenghua Yu <[email protected]>
Cc: Hirokazu Takata <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: Kyle McMartin <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Martin Schwidefsky <[email protected]>
Cc: Paul Mundt <[email protected]>
Cc: Thomas Gleixner <[email protected]>, Ingo Molnar <[email protected]>, "H. Peter Anvin" <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>
---
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(-)
diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt
index f3355b6..bb3bf38 100644
--- a/Documentation/kbuild/kbuild.txt
+++ b/Documentation/kbuild/kbuild.txt
@@ -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
--------------------------------------------------
diff --git a/Makefile b/Makefile
index 3c95e76..b55b47a 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index c877d6d..a357614 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -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
diff --git a/arch/arm/boot/install.sh b/arch/arm/boot/install.sh
index 9f9bed2..06ea7d4 100644
--- a/arch/arm/boot/install.sh
+++ b/arch/arm/boot/install.sh
@@ -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
diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
index 6f9533c..f063b77 100644
--- a/arch/blackfin/Makefile
+++ b/arch/blackfin/Makefile
@@ -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
diff --git a/arch/blackfin/boot/install.sh b/arch/blackfin/boot/install.sh
index 9560a6b..e2c6e40 100644
--- a/arch/blackfin/boot/install.sh
+++ b/arch/blackfin/boot/install.sh
@@ -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
diff --git a/arch/ia64/install.sh b/arch/ia64/install.sh
index 929e780..0e932f5 100644
--- a/arch/ia64/install.sh
+++ b/arch/ia64/install.sh
@@ -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
diff --git a/arch/m32r/boot/compressed/install.sh b/arch/m32r/boot/compressed/install.sh
index 6d72e9e..16e5a0a 100644
--- a/arch/m32r/boot/compressed/install.sh
+++ b/arch/m32r/boot/compressed/install.sh
@@ -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
diff --git a/arch/m68k/install.sh b/arch/m68k/install.sh
index 9c6bae6..57d640d 100644
--- a/arch/m68k/install.sh
+++ b/arch/m68k/install.sh
@@ -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
diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index da6f669..55cca1d 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -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
diff --git a/arch/parisc/install.sh b/arch/parisc/install.sh
index 9632b3e..e593fc8 100644
--- a/arch/parisc/install.sh
+++ b/arch/parisc/install.sh
@@ -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
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index bc35f4e..2be317d 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -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 ''
diff --git a/arch/powerpc/boot/install.sh b/arch/powerpc/boot/install.sh
index 98312d1..b6a256b 100644
--- a/arch/powerpc/boot/install.sh
+++ b/arch/powerpc/boot/install.sh
@@ -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
diff --git a/arch/s390/boot/install.sh b/arch/s390/boot/install.sh
index d4026f6..aed3069 100644
--- a/arch/s390/boot/install.sh
+++ b/arch/s390/boot/install.sh
@@ -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
diff --git a/arch/sh/boot/compressed/install.sh b/arch/sh/boot/compressed/install.sh
index 90589f0..f9f4181 100644
--- a/arch/sh/boot/compressed/install.sh
+++ b/arch/sh/boot/compressed/install.sh
@@ -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
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 1b68659..0b3b961 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -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)'
diff --git a/arch/x86/boot/install.sh b/arch/x86/boot/install.sh
index 8d60ee1..d13ec1c 100644
--- a/arch/x86/boot/install.sh
+++ b/arch/x86/boot/install.sh
@@ -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
--
1.6.2.5
On Mon, 2009-07-20 at 22:05 +0200, Sam Ravnborg wrote:
> 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.
Acked-by: Peter Zijlstra <[email protected]>
Looks good to me, thanks sam!
On Mon, Jul 20, 2009 at 16:05, Sam Ravnborg wrote:
> --- a/arch/blackfin/Makefile
> +++ b/arch/blackfin/Makefile
> @@ -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
> diff --git a/arch/blackfin/boot/install.sh b/arch/blackfin/boot/install.sh
> index 9560a6b..e2c6e40 100644
> --- a/arch/blackfin/boot/install.sh
> +++ b/arch/blackfin/boot/install.sh
> @@ -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
np with this, Acked-by-me
-mike
On Mon, 2009-07-20 at 12:01 +0200, Sam Ravnborg wrote:
> 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..
On Fri, Oct 09, 2009 at 11:02:09AM +0200, Peter Zijlstra wrote:
> On Mon, 2009-07-20 at 12:01 +0200, Sam Ravnborg wrote:
> > 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..
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