ยง2023-11-10

  1. build depndecies
sudo apt-get build-dep linux linux-image-$(uname -r)
or use git
sudo apt-get install git
  1. correct the correct deb-src lines in /etc/apt/sources.list. For example, on Disco Dingo you should have:
deb-src http://archive.ubuntu.com/ubuntu disco main
deb-src http://archive.ubuntu.com/ubuntu disco-updates main

Or, add these lines
deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted
deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted
deb-src http://archive.ubuntu.com/ubuntu/ jammy universe
deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates universe
# Add more lines if needed
sudo apt update   <-- must run
  1. get kernel source
alexlai@hc4JamGen:~$ apt-cache search linux-source 
linux-source - Linux kernel source with Ubuntu patches
linux-source-5.15.0 - Linux kernel source for version 5.15.0 with Ubuntu patches
linux-source-5.19.0 - Linux kernel source for version 5.19.0 with Ubuntu patches
linux-source-6.2.0 - Linux kernel source for version 6.2.0 with Ubuntu patches

alexlai@hc4JamGen:~$ mkdir -p build/src && cd $_
alexlai@hc4JamGen:~/build/src$ apt source linux-source-5.19.0

alexlai@hc4JamGen:~/build/src$ ls -l
total 212996
drwxrwxr-x 29 alexlai alexlai      4096 Nov 10 15:49 linux-hwe-5.19-5.19.0
-rw-r--r--  1 alexlai alexlai   9825208 Jul 24 23:45 linux-hwe-5.19_5.19.0-50.50.diff.gz
-rw-r--r--  1 alexlai alexlai      8439 Jul 24 23:45 linux-hwe-5.19_5.19.0-50.50.dsc
-rw-r--r--  1 alexlai alexlai 208263574 Nov 22  2022 linux-hwe-5.19_5.19.0.orig.tar.gz

or,
git clone git://kernel.ubuntu.com/ubuntu/ubuntu-<release codename>.git

After the kernel source was setup

$ cp /boot/config-$(uname -r) .config
$ make menuconfig
$ nproc
$ time make -j4
$ make modules_install
$ sudo make install
$ sudo update-initramfs -c -k 5.14.13
$ sudo update-grub
Rebbot!!!
$ uname -mrs