Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 Z. 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 only - but all changes
looks obvious.

Acked-by: Peter Zijlstra <peterz@infradead.org>
Acked-by: Mike Frysinger <vapier@gentoo.org> [blackfin]
Acked-by: Russell King <linux@arm.linux.org.uk> [arm]
Acked-by: Paul Mundt <lethal@linux-sh.org> [sh]
Acked-by: "H. Peter Anvin" <hpa@zytor.com> [x86]
Cc: Ian Campbell <icampbell@arcom.com>
Cc: Tony Luck <tony.luck@intel.com> [ia64]
Cc: Fenghua Yu <fenghua.yu@intel.com> [ia64]
Cc: Hirokazu Takata <takata@linux-m32r.org> [m32r]
Cc: Geert Uytterhoeven <geert@linux-m68k.org> [m68k]
Cc: Kyle McMartin <kyle@mcmartin.ca> [parisc]
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> [powerpc]
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> [s390]
Cc: Thomas Gleixner <tglx@linutronix.de> [x86]
Cc: Ingo Molnar <mingo@redhat.com> [x86]
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>

+50 -32
+16
Documentation/kbuild/kbuild.txt
··· 65 65 INSTALL_PATH specifies where to place the updated kernel and system map 66 66 images. Default is /boot, but you can set it to other values. 67 67 68 + INSTALLKERNEL 69 + -------------------------------------------------- 70 + Install script called when using "make install". 71 + The default name is "installkernel". 72 + 73 + The script will be called with the following arguments: 74 + $1 - kernel version 75 + $2 - kernel image file 76 + $3 - kernel map file 77 + $4 - default install path (use root directory if blank) 78 + 79 + The implmentation of "make install" is architecture specific 80 + and it may differ from the above. 81 + 82 + INSTALLKERNEL is provided to enable the possibility to 83 + specify a custom installer when cross compiling a kernel. 68 84 69 85 MODLIB 70 86 --------------------------------------------------
+3 -1
Makefile
··· 315 315 OBJDUMP = $(CROSS_COMPILE)objdump 316 316 AWK = awk 317 317 GENKSYMS = scripts/genksyms/genksyms 318 + INSTALLKERNEL := installkernel 318 319 DEPMOD = /sbin/depmod 319 320 KALLSYMS = scripts/kallsyms 320 321 PERL = perl ··· 354 353 355 354 export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION 356 355 export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC 357 - export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE 356 + export CPP AR NM STRIP OBJCOPY OBJDUMP 357 + export MAKE AWK GENKSYMS INSTALLKERNEL PERL UTS_MACHINE 358 358 export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS 359 359 360 360 export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
+2 -2
arch/arm/Makefile
··· 279 279 echo ' (supply initrd image via make variable INITRD=<path>)' 280 280 echo ' install - Install uncompressed kernel' 281 281 echo ' zinstall - Install compressed kernel' 282 - echo ' Install using (your) ~/bin/installkernel or' 283 - echo ' (distribution) /sbin/installkernel or' 282 + echo ' Install using (your) ~/bin/$(INSTALLKERNEL) or' 283 + echo ' (distribution) /sbin/$(INSTALLKERNEL) or' 284 284 echo ' install to $$(INSTALL_PATH) and run lilo' 285 285 endef
+2 -2
arch/arm/boot/install.sh
··· 21 21 # 22 22 23 23 # User may have a custom install script 24 - if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi 25 - if [ -x /sbin/${CROSS_COMPILE}installkernel ]; then exec /sbin/${CROSS_COMPILE}installkernel "$@"; fi 24 + if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi 25 + if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi 26 26 27 27 if [ "$(basename $2)" = "zImage" ]; then 28 28 # Compressed install
+2 -2
arch/blackfin/Makefile
··· 155 155 echo '* vmImage.gz - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.gz)' 156 156 echo ' vmImage.lzma - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.lzma)' 157 157 echo ' install - Install kernel using' 158 - echo ' (your) ~/bin/$(CROSS_COMPILE)installkernel or' 159 - echo ' (distribution) PATH: $(CROSS_COMPILE)installkernel or' 158 + echo ' (your) ~/bin/$(INSTALLKERNEL) or' 159 + echo ' (distribution) PATH: $(INSTALLKERNEL) or' 160 160 echo ' install to $$(INSTALL_PATH)' 161 161 endef
+3 -3
arch/blackfin/boot/install.sh
··· 36 36 37 37 # User may have a custom install script 38 38 39 - if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi 40 - if which ${CROSS_COMPILE}installkernel >/dev/null 2>&1; then 41 - exec ${CROSS_COMPILE}installkernel "$@" 39 + if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi 40 + if which ${INSTALLKERNEL} >/dev/null 2>&1; then 41 + exec ${INSTALLKERNEL} "$@" 42 42 fi 43 43 44 44 # Default install - same as make zlilo
+2 -2
arch/ia64/install.sh
··· 21 21 22 22 # User may have a custom install script 23 23 24 - if [ -x ~/bin/installkernel ]; then exec ~/bin/installkernel "$@"; fi 25 - if [ -x /sbin/installkernel ]; then exec /sbin/installkernel "$@"; fi 24 + if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi 25 + if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi 26 26 27 27 # Default install - same as make zlilo 28 28
+2 -2
arch/m32r/boot/compressed/install.sh
··· 24 24 25 25 # User may have a custom install script 26 26 27 - if [ -x /sbin/installkernel ]; then 28 - exec /sbin/installkernel "$@" 27 + if [ -x /sbin/${INSTALLKERNEL} ]; then 28 + exec /sbin/${INSTALLKERNEL} "$@" 29 29 fi 30 30 31 31 if [ "$2" = "zImage" ]; then
+2 -2
arch/m68k/install.sh
··· 33 33 34 34 # User may have a custom install script 35 35 36 - if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi 37 - if [ -x /sbin/${CROSS_COMPILE}installkernel ]; then exec /sbin/${CROSS_COMPILE}installkernel "$@"; fi 36 + if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi 37 + if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi 38 38 39 39 # Default install - same as make zlilo 40 40
+2 -2
arch/parisc/Makefile
··· 118 118 @echo '* vmlinux - Uncompressed kernel image (./vmlinux)' 119 119 @echo ' palo - Bootable image (./lifimage)' 120 120 @echo ' install - Install kernel using' 121 - @echo ' (your) ~/bin/installkernel or' 122 - @echo ' (distribution) /sbin/installkernel or' 121 + @echo ' (your) ~/bin/$(INSTALLKERNEL) or' 122 + @echo ' (distribution) /sbin/$(INSTALLKERNEL) or' 123 123 @echo ' copy to $$(INSTALL_PATH)' 124 124 endef 125 125
+2 -2
arch/parisc/install.sh
··· 21 21 22 22 # User may have a custom install script 23 23 24 - if [ -x ~/bin/installkernel ]; then exec ~/bin/installkernel "$@"; fi 25 - if [ -x /sbin/installkernel ]; then exec /sbin/installkernel "$@"; fi 24 + if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi 25 + if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi 26 26 27 27 # Default install 28 28
+2 -2
arch/powerpc/Makefile
··· 182 182 @echo ' simpleImage.<dt> - Firmware independent image.' 183 183 @echo ' treeImage.<dt> - Support for older IBM 4xx firmware (not U-Boot)' 184 184 @echo ' install - Install kernel using' 185 - @echo ' (your) ~/bin/installkernel or' 186 - @echo ' (distribution) /sbin/installkernel or' 185 + @echo ' (your) ~/bin/$(INSTALLKERNEL) or' 186 + @echo ' (distribution) /sbin/$(INSTALLKERNEL) or' 187 187 @echo ' install to $$(INSTALL_PATH) and run lilo' 188 188 @echo ' *_defconfig - Select default config from arch/$(ARCH)/configs' 189 189 @echo ''
+2 -2
arch/powerpc/boot/install.sh
··· 23 23 24 24 # User may have a custom install script 25 25 26 - if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi 27 - if [ -x /sbin/${CROSS_COMPILE}installkernel ]; then exec /sbin/${CROSS_COMPILE}installkernel "$@"; fi 26 + if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi 27 + if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi 28 28 29 29 # Default install 30 30
+2 -2
arch/s390/boot/install.sh
··· 21 21 22 22 # User may have a custom install script 23 23 24 - if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi 25 - if [ -x /sbin/${CROSS_COMPILE}installkernel ]; then exec /sbin/${CROSS_COMPILE}installkernel "$@"; fi 24 + if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi 25 + if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi 26 26 27 27 # Default install - same as make zlilo 28 28
+2 -2
arch/sh/boot/compressed/install.sh
··· 23 23 24 24 # User may have a custom install script 25 25 26 - if [ -x /sbin/installkernel ]; then 27 - exec /sbin/installkernel "$@" 26 + if [ -x /sbin/${INSTALLKERNEL} ]; then 27 + exec /sbin/${INSTALLKERNEL} "$@" 28 28 fi 29 29 30 30 if [ "$2" = "zImage" ]; then
+2 -2
arch/x86/Makefile
··· 179 179 define archhelp 180 180 echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)' 181 181 echo ' install - Install kernel using' 182 - echo ' (your) ~/bin/installkernel or' 183 - echo ' (distribution) /sbin/installkernel or' 182 + echo ' (your) ~/bin/$(INSTALLKERNEL) or' 183 + echo ' (distribution) /sbin/$(INSTALLKERNEL) or' 184 184 echo ' install to $$(INSTALL_PATH) and run lilo' 185 185 echo ' fdimage - Create 1.4MB boot floppy image (arch/x86/boot/fdimage)' 186 186 echo ' fdimage144 - Create 1.4MB boot floppy image (arch/x86/boot/fdimage)'
+2 -2
arch/x86/boot/install.sh
··· 33 33 34 34 # User may have a custom install script 35 35 36 - if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi 37 - if [ -x /sbin/${CROSS_COMPILE}installkernel ]; then exec /sbin/${CROSS_COMPILE}installkernel "$@"; fi 36 + if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi 37 + if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi 38 38 39 39 # Default install - same as make zlilo 40 40