-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_kernel.jupiter-cs
executable file
·83 lines (65 loc) · 1.48 KB
/
install_kernel.jupiter-cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
function die()
{
echo " (EE) $1"
exit 1
}
function info()
{
echo " (II) $1"
}
function silent()
{
OUTPUT=`$*`
if [ "$?" != "0" ]; then
echo $OUTPUT
die "$* failed!"
fi
}
if [ ! -f "./.config" ]; then
CURDIR=`pwd`
die "No kernel .config exists in $CURDIR!"
fi
if [ ! -f "./Makefile" ]; then
die "No Makefile present!"
fi
NAME=`cat include/config/kernel.release`
if [ -z "$NAME" ]
then
die "Could not determine kernel version!"
fi
info "Detected kernel version $NAME"
if [ $UID != "0" ]; then
die "Must be root to install kernel!"
fi
# (1) copy modules
if [ "$1" != "-m" ]; then
info "Installing modules..."
silent make -j8 modules_install
else
info "Skipping installing modules."
fi
# (2) copy kernel
info "Installing kernel..."
silent cp -v arch/i386/boot/bzImage /boot/vmlinuz-$NAME
silent cp -v System.map /boot/System.map-$NAME
# (3) build ramdisk
info "Building module dependencies"
silent depmod -v $NAME
info "Building initial ramdisk..."
silent mkinitcpio -g /boot/kernel-$NAME.img -k $NAME
# (4) make bootloader entry
ALREADY_PRESENT=`grep "kernel /boot/vmlinuz-$NAME" /boot/grub/menu.lst `
if [ ! -z "$ALREADY_PRESENT" ]; then
info "Bootloader entry appears to be already present."
else
info "Creating bootloader entry..."
cat >> /boot/grub/menu.lst <<__EOE__
# Custom kernel
title Kernel $NAME
root (hd0,5)
kernel /boot/vmlinuz-$NAME root=/dev/sda6 ro vga=791
initrd /boot/kernel-$NAME.img
__EOE__
fi
info "Kernel $NAME has been installed."