-
Notifications
You must be signed in to change notification settings - Fork 0
/
makekernel2.sh
executable file
·136 lines (126 loc) · 2.76 KB
/
makekernel2.sh
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/bin/bash
FILE="/tmp/out.$$"
GREP="/bin/grep"
#....
# Make sure only root can run our script
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
Output() {
echo "$(date -d "1970-01-01 UTC $2 seconds") - $1"
}
Duration() {
local S=$(echo $FINISH_TIME $BEGIN_TIME | awk '{print$1-$2}')
((h=S/3600))
((m=S%3600/60))
((s=S%60))
printf "Compiling took: %dh:%dm:%ds\n" $h $m $s
}
Begin() {
BEGIN_TIME=$(date +%s)
Output Begin $BEGIN_TIME "$1"
}
Finish() {
FINISH_TIME=$(date +%s)
Output Finished $FINISH_TIME "$1"
Duration
}
Build399() {
clear
cd ~/source/linux-3.9.9-ck1
echo ""
prompt="Do you want to run xconfig? Press [Y] if you do, or [N] to skip it."
echo -n "$prompt"
echo ""
read -n1 char
echo ""
Begin
case "$char" in
[Nn]) echo "" && make clean && make -j3 && make INSTALL_MOD_STRIP=1 modules_install && make INSTALL_MOD_STRIP=1 headers_install && sudo make INSTALL_MOD_STRIP=1 install
;;
[Yy]) echo "" && make xconfig && make clean && make -j3 && make INSTALL_MOD_STRIP=1 modules_install && make INSTALL_MOD_STRIP=1 headers_install && sudo make INSTALL_MOD_STRIP=1 install
;;
esac
echo ""
Finish
echo ""
echo "Done!"
echo ""
read -p "Press [Enter] to continue."
Main
}
Build310() {
clear
cd ~/source/linux-3.10.3-ck1
echo ""
prompt="Do you want to run xconfig? Press [Y] if you do, or [N] to skip it."
echo -n "$prompt"
echo ""
read -n1 char
echo ""
Begin
case "$char" in
[Nn]) echo "" && make clean && make -j3 && make INSTALL_MOD_STRIP=1 modules_install && make INSTALL_MOD_STRIP=1 headers_install && sudo make INSTALL_MOD_STRIP=1 install
;;
[Yy]) echo "" && make xconfig && make clean && make -j3 && make INSTALL_MOD_STRIP=1 modules_install && make INSTALL_MOD_STRIP=1 headers_install && sudo make INSTALL_MOD_STRIP=1 install
;;
esac
echo ""
Finish
echo ""
echo "Done!"
echo ""
read -p "Press [Enter] to continue."
Main
}
Reboot ()
{
clear
echo ""
echo "Rebooting in 5"
sleep 1
echo " 4"
sleep 1
echo " 3"
sleep 1
echo " 2"
sleep 1
echo " 1"
sleep 1
echo "Going down for reboot..."
sleep 1
sudo reboot
}
Main ()
{
clear
while true
do
clear
line='----------------------------------------'
echo "$line"
echo "Linux kernel build script"
echo ""
echo "Select from the following functions"
echo ""
echo " 1 Build 3.10.3 kernel"
echo " R Reboot to test your new kernel"
echo " X Exit"
echo "$line"
tput civis
echo -n " "
read -n1 answer
case "$answer" in
[1]) Build310;;
[Rr]) Reboot;;
[Xx]) clear
echo "Live long and prosper... tristan202"
echo ""
tput cnorm
break ;;
esac
done
exit 0
}
Main