Skip to content

Commit a96c733

Browse files
tangyoulingchenhuacai
authored andcommitted
LoongArch: Add a default install.sh
As specified in scripts/install.sh, the priority order is as follows (from highest to lowest): ~/bin/installkernel /sbin/installkernel arch/loongarch/boot/install.sh Fallback to default install.sh if installkernel is not found. Signed-off-by: Youling Tang <tangyouling@kylinos.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent c006d5d commit a96c733

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

arch/loongarch/boot/install.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
20+
set -e
21+
22+
case "${2##*/}" in
23+
vmlinux.elf)
24+
echo "Installing uncompressed vmlinux.elf kernel"
25+
base=vmlinux
26+
;;
27+
vmlinux.efi)
28+
echo "Installing uncompressed vmlinux.efi kernel"
29+
base=vmlinux
30+
;;
31+
vmlinuz.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+
;;
39+
esac
40+
41+
if [ -f $4/$base-$1 ]; then
42+
mv $4/$base-$1 $4/$base-$1.old
43+
fi
44+
cat $2 > $4/$base-$1
45+
46+
# Install system map file
47+
if [ -f $4/System.map-$1 ]; then
48+
mv $4/System.map-$1 $4/System.map-$1.old
49+
fi
50+
cp $3 $4/System.map-$1
51+
52+
# Install kernel config file
53+
if [ -f $4/config-$1 ]; then
54+
mv $4/config-$1 $4/config-$1.old
55+
fi
56+
cp .config $4/config-$1

0 commit comments

Comments
 (0)