1#!/bin/sh
2#
3# This file is subject to the terms and conditions of the GNU General Public
4# License.  See the file "COPYING" in the main directory of this archive
5# for more details.
6#
7# Copyright (C) 1995 by Linus Torvalds
8#
9# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
10# Adapted from code in arch/i386/boot/install.sh by Russell King
11#
12# "make install" script for the LoongArch Linux port
13#
14# Arguments:
15#   $1 - kernel version
16#   $2 - kernel image file
17#   $3 - kernel map file
18#   $4 - default install path (blank if root directory)
19
20set -e
21
22case "${2##*/}" in
23vmlinux.elf)
24  echo "Installing uncompressed vmlinux.elf kernel"
25  base=vmlinux
26  ;;
27vmlinux.efi)
28  echo "Installing uncompressed vmlinux.efi kernel"
29  base=vmlinux
30  ;;
31vmlinuz.efi)
32  echo "Installing gzip/zstd compressed vmlinuz.efi kernel"
33  base=vmlinuz
34  ;;
35*)
36 echo "Warning: Unexpected kernel type"
37 exit 1
38 ;;
39esac
40
41if [ -f $4/$base-$1 ]; then
42  mv $4/$base-$1 $4/$base-$1.old
43fi
44cat $2 > $4/$base-$1
45
46# Install system map file
47if [ -f $4/System.map-$1 ]; then
48  mv $4/System.map-$1 $4/System.map-$1.old
49fi
50cp $3 $4/System.map-$1
51
52# Install kernel config file
53if [ -f $4/config-$1 ]; then
54  mv $4/config-$1 $4/config-$1.old
55fi
56cp .config $4/config-$1
57