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
#
11
# "make install" script for i386 architecture
12
#
13
# Arguments:
14
#   $1 - kernel version
15
#   $2 - kernel image file
16
#   $3 - kernel map file
17
#   $4 - default install path (blank if root directory)
18
#
19
20
# heavily modified by Grissiom
21
# please link this into /sbin
22
23
verify () {
24
	if [ ! -f "$1" ]; then
25
		echo ""                                                   1>&2
26
		echo " *** Missing file: $1"                              1>&2
27
		echo ' *** You need to run "make" before "make install".' 1>&2
28
		echo ""                                                   1>&2
29
		exit 1
30
 	fi
31
}
32
33
# Make sure the files actually exist
34
verify "$2"
35
verify "$3"
36
37
if [ $(md5sum /boot/vmlinuz 2>/dev/null | cut -d ' ' -f 1) = $(md5sum "$2" | cut -d ' ' -f 1) ]; then
38
	echo "You may have already installed the kernel. So quit here."
39
	exit 1
40
fi
41
42
back_up () {
43
	if [ -f "$1" ]; then
44
		mv $1 $1.old
45
	fi
46
}
47
48
echo_instl_in () {
49
	echo $1 "installed in" $2
50
}
51
echo_linked_to () {
52
	echo $1 "linked to" $2
53
}
54
55
echo "install modules..."
56
make modules_install
57
echo "Done."
58
echo
59
60
cat $2 > $4/vmlinuz-$1 && echo_instl_in "Kernel Image" "$4/vmlinuz-$1"
61
back_up "$4/vmlinuz"
62
ln -sf $4/vmlinuz-$1 $4/vmlinuz && echo_linked_to "Kernel Image" "$4/vmlinuz"
63
echo
64
65
cp $3 $4/System.map-$1 && echo_instl_in "System.map" "$4/System.map-$1"
66
back_up "$4/System.map"
67
ln -sf $4/System.map-$1 $4/System.map && echo_linked_to "System.map" "$4/System.map"
68
echo
69
70
cp .config $4/config-$1 && echo_instl_in "Kernel config" "$4/config-$1"
71
back_up "$4/config"
72
ln -sf $4/config-$1 $4/config && echo_linked_to "Kernel config" "$4/config"
73
echo
74
75
back_up "$4/initrd.gz"
76
echo "Run mkinitrd..."
77
mkinitrd -F -k $1 -o $4/initrd-$1.gz
78
ln -sf $4/initrd-$1.gz $4/initrd.gz && echo_linked_to "initrd" "$4/initrd.gz"
79
echo
80
81
if [ -x /sbin/lilo ]; then
82
	echo "Run lilo..."
83
	/sbin/lilo
84
	echo "You may have to adjust /etc/lilo.conf and re-run lilo."
85
else
86
	echo "Hrm, maybe you use grub."
87
	echo "please edit /boot/grub/menu.lst accordingly to boot installed kernel."
88
fi