-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepare.sh
executable file
·70 lines (59 loc) · 1.53 KB
/
prepare.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
#!/bin/bash
# I made this script to upgrade the kernel, using your custom .config file, and it shoud to be on youur home folder and called '.custom-kernel'
#
#
#
# Stage 0.1 - Version chooser
verch(){
echo 'which kernel version EG: 3.x'
echo 'series supported : 3.x and 4.x '
read ser
echo 'which version do you want to install EG: 4.4.1'
read ver
}
# Stage 1 - Creating and/or changing to build diretory
dirch(){
if [ -e ~/kernelbuild ];
then
cd /home/$USER/kernelbuild
echo 'exist'
else
echo 'creating the build directory'
mkdir -v /home/$USER/kernelbuild
cd ~/kernelbuild
fi
}
# Stage 2 - Download and extracting the source code
sourced(){
if [ -e ~/kernelbuild/linux-$ver ] ;
then
echo "you has downloaded and extracted source code of this verson"
cd linux-$ver
else
echo $ver
wget https://cdn.kernel.org/pub/linux/kernel/v$ser/linux-$ver.tar.xz
tar xf linux-$ver.tar.xz
cd linux-$ver
fi
}
# Stage - 3 Preparing the compiling
preparemake(){
make clean && make mrproper
if [ -e ~/.custom-kernel ];
then
cp -v ~/.custom-kernel .config
else
make menuconfig
cp -v .config ~/.custom-kernel
fi
echo "how many cores your CPU have?"
read $cores ## It is for optimization of the make process
}
# Stage 3.1 - removing the old modules and boot image
rem_old(){
sudo rm -rf /usr/lib/modules/*-CUSTOM-KERNEL
sudo rm -rf /usr/lib64/modules/*-CUSTOM-KERNEL
sudo rm /boot/*-CUSTOM-KERNEL*
echo "now you can type 'make'"
}
verch && dirch && sourced && preparemake && rem_old && exit 0