xref: /linux/scripts/install.sh (revision a1ff5a7d78a036d6c2178ee5acd6ba4946243800)
1f774f5bbSMasahiro Yamada#!/bin/sh
2f774f5bbSMasahiro Yamada# SPDX-License-Identifier: GPL-2.0-only
3f774f5bbSMasahiro Yamada#
4f774f5bbSMasahiro Yamada# Copyright (C) 1995 by Linus Torvalds
5f774f5bbSMasahiro Yamada#
6f774f5bbSMasahiro Yamada# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
7f774f5bbSMasahiro Yamada# Common code factored out by Masahiro Yamada
8f774f5bbSMasahiro Yamada
9f774f5bbSMasahiro Yamadaset -e
10f774f5bbSMasahiro Yamada
11f774f5bbSMasahiro Yamada# Make sure the files actually exist
12f774f5bbSMasahiro Yamadafor file in "${KBUILD_IMAGE}" System.map
13f774f5bbSMasahiro Yamadado
14f774f5bbSMasahiro Yamada	if [ ! -f "${file}" ]; then
15f774f5bbSMasahiro Yamada		echo >&2
16f774f5bbSMasahiro Yamada		echo >&2 " *** Missing file: ${file}"
17f774f5bbSMasahiro Yamada		echo >&2 ' *** You need to run "make" before "make install".'
18f774f5bbSMasahiro Yamada		echo >&2
19f774f5bbSMasahiro Yamada		exit 1
20f774f5bbSMasahiro Yamada	fi
21f774f5bbSMasahiro Yamadadone
22f774f5bbSMasahiro Yamada
23*7efcb39eSZhang Bingwuif [ -n "${INSTALL_PATH}" ] && ! [ -e "${INSTALL_PATH}" ]; then
24*7efcb39eSZhang Bingwu	mkdir -p "${INSTALL_PATH}"
25*7efcb39eSZhang Bingwufi
26*7efcb39eSZhang Bingwu
27f774f5bbSMasahiro Yamada# User/arch may have a custom install script
28f774f5bbSMasahiro Yamadafor file in "${HOME}/bin/${INSTALLKERNEL}"		\
29f774f5bbSMasahiro Yamada	    "/sbin/${INSTALLKERNEL}"			\
30f774f5bbSMasahiro Yamada	    "${srctree}/arch/${SRCARCH}/install.sh"	\
31f774f5bbSMasahiro Yamada	    "${srctree}/arch/${SRCARCH}/boot/install.sh"
32f774f5bbSMasahiro Yamadado
33f774f5bbSMasahiro Yamada	if [ ! -x "${file}" ]; then
34f774f5bbSMasahiro Yamada		continue
35f774f5bbSMasahiro Yamada	fi
36f774f5bbSMasahiro Yamada
37f774f5bbSMasahiro Yamada	# installkernel(8) says the parameters are like follows:
38f774f5bbSMasahiro Yamada	#
39f774f5bbSMasahiro Yamada	#   installkernel version zImage System.map [directory]
40f774f5bbSMasahiro Yamada	exec "${file}" "${KERNELRELEASE}" "${KBUILD_IMAGE}" System.map "${INSTALL_PATH}"
41f774f5bbSMasahiro Yamadadone
42f774f5bbSMasahiro Yamada
43f774f5bbSMasahiro Yamadaecho "No install script found" >&2
44f774f5bbSMasahiro Yamadaexit 1
45