Commit f774f5bb authored by Masahiro Yamada's avatar Masahiro Yamada
Browse files

kbuild: factor out the common installation code into scripts/install.sh



Many architectures have similar install.sh scripts.

The first half is really generic; it verifies that the kernel image
and System.map exist, then executes ~/bin/${INSTALLKERNEL} or
/sbin/${INSTALLKERNEL} if available.

The second half is kind of arch-specific; it copies the kernel image
and System.map to the destination, but the code is slightly different.

Factor out the generic part into scripts/install.sh.

Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
Reviewed-by: default avatarNicolas Schier <n.schier@avm.de>
parent f18379a3
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1298,7 +1298,8 @@ scripts_unifdef: scripts_basic
# to this Makefile to build and install external modules.
# Cancel sub_make_done so that options such as M=, V=, etc. are parsed.

install: sub_make_done :=
quiet_cmd_install = INSTALL $(INSTALL_PATH)
      cmd_install = unset sub_make_done; $(srctree)/scripts/install.sh

# ---------------------------------------------------------------------------
# Tools
+2 −2
Original line number Diff line number Diff line
@@ -318,9 +318,9 @@ $(BOOT_TARGETS): vmlinux
	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
	@$(kecho) '  Kernel: $(boot)/$@ is ready'

$(INSTALL_TARGETS): KBUILD_IMAGE = $(boot)/$(patsubst %install,%Image,$@)
$(INSTALL_TARGETS):
	$(CONFIG_SHELL) $(srctree)/$(boot)/install.sh "$(KERNELRELEASE)" \
	$(boot)/$(patsubst %install,%Image,$@) System.map "$(INSTALL_PATH)"
	$(call cmd,install)

PHONY += vdso_install
vdso_install:

arch/arm/boot/install.sh

100644 → 100755
+0 −21
Original line number Diff line number Diff line
#!/bin/sh
#
# arch/arm/boot/install.sh
#
# This file is subject to the terms and conditions of the GNU General Public
# License.  See the file "COPYING" in the main directory of this archive
# for more details.
@@ -18,25 +16,6 @@
#   $2 - kernel image file
#   $3 - kernel map file
#   $4 - default install path (blank if root directory)
#

verify () {
	if [ ! -f "$1" ]; then
		echo ""                                                   1>&2
		echo " *** Missing file: $1"                              1>&2
		echo ' *** You need to run "make" before "make install".' 1>&2
		echo ""                                                   1>&2
		exit 1
	fi
}

# Make sure the files actually exist
verify "$2"
verify "$3"

# 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 [ "$(basename $2)" = "zImage" ]; then
# Compressed install
+2 −4
Original line number Diff line number Diff line
@@ -162,11 +162,9 @@ Image: vmlinux
Image.%: Image
	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@

install: install-image := Image
zinstall: install-image := Image.gz
install: KBUILD_IMAGE := $(boot)/Image
install zinstall:
	$(CONFIG_SHELL) $(srctree)/$(boot)/install.sh $(KERNELRELEASE) \
	$(boot)/$(install-image) System.map "$(INSTALL_PATH)"
	$(call cmd,install)

PHONY += vdso_install
vdso_install:

arch/arm64/boot/install.sh

100644 → 100755
+0 −21
Original line number Diff line number Diff line
#!/bin/sh
#
# arch/arm64/boot/install.sh
#
# This file is subject to the terms and conditions of the GNU General Public
# License.  See the file "COPYING" in the main directory of this archive
# for more details.
@@ -18,25 +16,6 @@
#   $2 - kernel image file
#   $3 - kernel map file
#   $4 - default install path (blank if root directory)
#

verify () {
	if [ ! -f "$1" ]; then
		echo ""                                                   1>&2
		echo " *** Missing file: $1"                              1>&2
		echo ' *** You need to run "make" before "make install".' 1>&2
		echo ""                                                   1>&2
		exit 1
	fi
}

# Make sure the files actually exist
verify "$2"
verify "$3"

# 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 [ "$(basename $2)" = "Image.gz" ]; then
# Compressed install
Loading