-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmakekernel
48 lines (47 loc) · 1.63 KB
/
makekernel
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
#!/bin/bash
#Initialisation
read -p 'Which major version of the kernel do you want to install (3-6)[6]?: ' gen
if [[ $gen -eq "" ]]; then
gen='6'
fi
read -p "Which version of the kernel do you want to install (at least $gen.0.1)?: " ver
if [[ $ver -eq "" ]]; then
ver="$gen.0.1"
fi
link="https://www.kernel.org/pub/linux/kernel/v$gen.x/linux-$ver.tar.xz"
read -p 'Skip the download [y/N] ' skip
read -p 'Do you want to install developer packages? [y/N] ' dev
read -p 'Do you want to reconfigure the kernel manually? [y/N] ' manual
read -p 'Do you want to remove the kernel after installation? [y/N] ' remdeb
#working #working (for Ubuntu 22.04+ Kernel Package should be installed manually from deb )
case $dev in
y|Y) apt-get -y install make kernel-package fakeroot wget build-essential bc libncurses-dev flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf ;;
n|N|*) echo "Developer package installation has been skipped" ;;
esac
cd /usr/src
case $skip in
y|Y) echo "Sources download has been skipped" ;;
n|N|*) wget --secure-protocol=auto $link ;;
esac
echo Installing linux kernel $ver
tar xvf linux-$ver.tar.xz
rm linux
ln -s linux-$ver linux
cd /usr/src/linux
cp /boot/config-`uname -r` ./.config
make oldconfig
case $manual in
y|Y) make menuconfig ;;
n|N|*) echo "Configuration is based on the old config" ;;
esac
make-kpkg clean
fakeroot make-kpkg --initrd kernel_image kernel_headers kernel_doc kernel_source
cd /usr/src
dpkg -i linux-headers-$ver*.deb
dpkg -i linux-image-$ver*.deb
dpkg -i linux-doc-$ver*.deb
case $remdeb in
y|Y) rm -f *.deb ;;
n|N|*) echo "Your *.deb files in the /usr/src" ;;
esac
exit