linux/scripts/install.sh
Zhang Bingwu 7efcb39e0d kbuild: Create INSTALL_PATH directory if it does not exist
If INSTALL_PATH is not a valid directory, create it, like what
modules_install and dtbs_install will do in the same situation.

Signed-off-by: Zhang Bingwu <xtexchooser@duck.com>
Reviewed-by: Nicolas Schier <nicolas@jasle.eu>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-07-20 13:34:54 +09:00

45 lines
1.1 KiB
Bash
Executable File

#!/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
if [ -n "${INSTALL_PATH}" ] && ! [ -e "${INSTALL_PATH}" ]; then
mkdir -p "${INSTALL_PATH}"
fi
# 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