-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdebian_kernel_build_from_upstream_source
executable file
·81 lines (52 loc) · 1.95 KB
/
debian_kernel_build_from_upstream_source
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
#!/usr/bin/env bash
# This script will build debian kernel package from the upstream stable kernel
get_elapsed_time="/usr/bin/time -f"
build_dir=/home/bhaskar/git-linux/debian_kernel_build
existing_config_file="/boot/config-$(uname -r)"
debian_kernel_build() {
# Check if build dir exists, if not then pull and build
if [ ! -d "$build_dir" ];then
echo Gosh! It will take hell lot of time to clone the repo ...take a break ...
echo
$get_elapsed_time "\n\n\tTime Elapsed: %E\n\n" git clone https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git $HOME/git-linux/debian_kernel_build
else
echo Dir exists!! Getting into the git repo ...
cd $build_dir || exit 1
fi
echo Cleaning previous stale stuff and pull new stuffs in
git reset --hard
git clean -dfx
git pull
# echo Getting the build dependencies for kernel build :
# echo
# apt install devscripts
# /usr/bin/mk-build-deps
#Clean the dir
make clean && make mrproper
#Copying existing/running kernel config
cp $existing_config_file .config
ls -al .config
#Disable this option to shorten the compile time
scripts/config --disable DEBUG_KERNEL
grep DEBUG_KERNEL .config
#Disable this option to shorten the compile time
scripts/config --disable DEBUG_INFO
grep DEBUG_INFO .config
#This is needed ,otherwise it won't allow you to build
scripts/config --disable system_trusted_keys
grep CONFIG_SYSTEM_TRUSTED_KEYS .config
#Make sure the flags symbols are set correctly with an updated value
make ARCH=x86_64 olddefconfig
# Now build it
$get_elapsed_time "\n\n\tTime Elapsed: %E\n\n" make ARCH=x86_64 V=1 -j$(getconf _NPROCESSORS_ONLN) deb-pkg
printf "\n\n\n ${Bright}${Green}Install the generated packages aka kernel,headers,modules et al ${NOCOLOR}\n\n\n"
cd ..
dpkg -i *.deb
if [ $? -eq 0 ];then
find /boot -maxdepth 1 -name "vmlinuz-*" -type f -ls
notify-send "Kernel update process done"
else
notify-send "Nope, the package install have trouble."
fi
}
debian_kernel_build