Skip to content

Commit caa27b6

Browse files
committed
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: 0f8e2d6 ("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>
1 parent 78f28b7 commit caa27b6

17 files changed

Lines changed: 50 additions & 32 deletions

File tree

‎Documentation/kbuild/kbuild.txt‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,22 @@ INSTALL_PATH
6565
INSTALL_PATH specifies where to place the updated kernel and system map
6666
images. Default is /boot, but you can set it to other values.
6767

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.
6884

6985
MODLIB
7086
--------------------------------------------------

‎Makefile‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
315315
OBJDUMP = $(CROSS_COMPILE)objdump
316316
AWK = awk
317317
GENKSYMS = scripts/genksyms/genksyms
318+
INSTALLKERNEL := installkernel
318319
DEPMOD = /sbin/depmod
319320
KALLSYMS = scripts/kallsyms
320321
PERL = perl
@@ -353,7 +354,8 @@ KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
353354

354355
export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
355356
export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
356-
export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE
357+
export CPP AR NM STRIP OBJCOPY OBJDUMP
358+
export MAKE AWK GENKSYMS INSTALLKERNEL PERL UTS_MACHINE
357359
export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
358360

359361
export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS

‎arch/arm/Makefile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ define archhelp
279279
echo ' (supply initrd image via make variable INITRD=<path>)'
280280
echo ' install - Install uncompressed kernel'
281281
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'
284284
echo ' install to $$(INSTALL_PATH) and run lilo'
285285
endef

‎arch/arm/boot/install.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
#
2222

2323
# 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
2626

2727
if [ "$(basename $2)" = "zImage" ]; then
2828
# Compressed install

‎arch/blackfin/Makefile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ define archhelp
155155
echo '* vmImage.gz - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.gz)'
156156
echo ' vmImage.lzma - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.lzma)'
157157
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'
160160
echo ' install to $$(INSTALL_PATH)'
161161
endef

‎arch/blackfin/boot/install.sh‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ verify "$3"
3636

3737
# User may have a custom install script
3838

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} "$@"
4242
fi
4343

4444
# Default install - same as make zlilo

‎arch/ia64/install.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121

2222
# User may have a custom install script
2323

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
2626

2727
# Default install - same as make zlilo
2828

‎arch/m32r/boot/compressed/install.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424

2525
# User may have a custom install script
2626

27-
if [ -x /sbin/installkernel ]; then
28-
exec /sbin/installkernel "$@"
27+
if [ -x /sbin/${INSTALLKERNEL} ]; then
28+
exec /sbin/${INSTALLKERNEL} "$@"
2929
fi
3030

3131
if [ "$2" = "zImage" ]; then

‎arch/m68k/install.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ verify "$3"
3333

3434
# User may have a custom install script
3535

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
3838

3939
# Default install - same as make zlilo
4040

‎arch/parisc/Makefile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ define archhelp
118118
@echo '* vmlinux - Uncompressed kernel image (./vmlinux)'
119119
@echo ' palo - Bootable image (./lifimage)'
120120
@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'
123123
@echo ' copy to $$(INSTALL_PATH)'
124124
endef
125125

0 commit comments

Comments
 (0)