- prerequisites: sudo apt-get install build-essential kernel-package
-
download the latest kernel source zip archive from kernel.org
-
extract the archive and get to the extracted folder
-
copy the kernel config file from the existing system to the kernel tree: cp /boot/config-
uname -r
.config or other customized config file in /boot. If /boot is empty, config can be found in proc : zcat /proc/config.gz > /usr/local/src/linux-4.4.97/.config) -
bring the config file up to date: make oldconfig (for big version gap :
yes '' | make oldconfig
(all default values, should be checked) -
adjust build settings if necessary: make menuconfig (requires libncurses)
-
clean the kernel source directory: make clean
-
build: make deb-pkg LOCALVERSION=custom -j core (for multicore, number of used cores)
-
install deb files (image, header, libc), then reboot: cd .. && dpkg -i linux-(…)
More details: https://wiki.ubuntu.com/KernelTeam/GitKernelBuild