diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2022-05-03 11:47:16 +0900 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2022-05-11 21:45:53 +0900 |
commit | f774f5bb87d132b48bc4a99598c45f35121ac054 (patch) | |
tree | 0a2dc74e70400523f9815d72a68d5264cbf2253a /scripts | |
parent | f18379a30271c0289c2d0e1074e1ed633bfd708c (diff) | |
download | linux-stable-f774f5bb87d132b48bc4a99598c45f35121ac054.tar.gz linux-stable-f774f5bb87d132b48bc4a99598c45f35121ac054.tar.bz2 linux-stable-f774f5bb87d132b48bc4a99598c45f35121ac054.zip |
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: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <n.schier@avm.de>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/install.sh | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100755 index 000000000000..9bb0fb44f04a --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,40 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 1995 by Linus Torvalds +# +# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin +# Common code factored out by Masahiro Yamada + +set -e + +# Make sure the files actually exist +for file in "${KBUILD_IMAGE}" System.map +do + if [ ! -f "${file}" ]; then + echo >&2 + echo >&2 " *** Missing file: ${file}" + echo >&2 ' *** You need to run "make" before "make install".' + echo >&2 + exit 1 + fi +done + +# User/arch may have a custom install script +for file in "${HOME}/bin/${INSTALLKERNEL}" \ + "/sbin/${INSTALLKERNEL}" \ + "${srctree}/arch/${SRCARCH}/install.sh" \ + "${srctree}/arch/${SRCARCH}/boot/install.sh" +do + if [ ! -x "${file}" ]; then + continue + fi + + # installkernel(8) says the parameters are like follows: + # + # installkernel version zImage System.map [directory] + exec "${file}" "${KERNELRELEASE}" "${KBUILD_IMAGE}" System.map "${INSTALL_PATH}" +done + +echo "No install script found" >&2 +exit 1 |