For ubuntu 22.04
- Install VM
- I used ubuntu server iso (I don't need GUI)
- Allocate enough disk size (at least 30GB aside from default os)
sudo -s
- Use root permission
- Install dependencies
apt update && \ apt upgrade -y && \ apt-get install libncurses-dev libssl-dev libelf-dev flex bison pkg-config dpkg-dev libssl-dev libelf-dev dwarves -y
cd /usr/src && install linux-source
cd linux-source-xxxx
(xxx is the version that you downloaded)- Inside the directory, you may see the following files
debian
debian.master
linux-source-xxx.gz.bz2
- Extract the
linux-source-xxx.gz.bz2
withtar -xvf linux*
cd linux-source-xxx
- Copy the
.config
from /bootcp /boot/config-`uname -r` .config
make menuconfig
- Feel free to directly edit the info you want in the
.config
if you are familiar with it.
- Feel free to directly edit the info you want in the
- Select Local version (
press Enter
andenter your student ID
)- DO NOT use capital letters. That violates debian package's naming convention
- Tick Automatically append the local version (
press space
) - Save the config and exit
vim .config
to removeCONFIG_SYSTEM_TRUSTED_KEYS
andCONFIG_SYSTEM_REVOCATION_KEYS
if you are not familiar with the vim editor/CONFIG_SYSTEM_TRUSTED_KEYS
(search words with/
)di"
(delete the word inside ""):wq
(quit the vim editor)
make -j12 deb-pkg
- This may take 20 minutes to finish
-j12
specify the number of CPUs you want to utilize (the number depends on how many CPU you assign when you create a VM)deb-pkg
build debian package
cd ..
to see the packages you builtdpkg -i linux-image-xxx.deb
(the one with your student ID)dpkg -i linux-header-xxx.deb
(the one with your student ID)- update-grub || update-grub2
not necessary
butrecommended
grub
is the kernel manager managing the kernels you can boot fromupdate-grub
is the older version ofupdate-grub2
||
: if the previous command failed do the next command
- Reboot your VM and try the following commands:
uname -a
anduname -r
ifconfig -a
(sudo apt install net-tools)- The command is actually deprecated. I recommend you use
ip a
for your daily usage
- The command is actually deprecated. I recommend you use
ping 140.117.11.1
(Ctrl-c or Ctrl-d to terminate it)