I had a need to build a custom Ubuntu 18.04 kernel with a minor config option change.
The build script is based on these instructions from the Ubuntu wiki.
- Enables interrupt support for the PCA9535 GPIO controller
- Excludes the Nvidia DKMS modules
It is recommended that the compilation be done in a Docker container:
# Ubuntu 18.04 Bionic
docker run --rm -it \
-v "$(pwd):/output" \
-e DISTRIB_CODENAME=bionic \
-e KERNELVERS=4.15.0-122-generic \
ubuntu:bionic \
/output/build.sh
# Ubuntu 20.04 Focal
docker run --rm -it \
-v "$(pwd):/output" \
-e DISTRIB_CODENAME=focal \
-e KERNELVERS=5.4.0-65-generic \
ubuntu:focal \
/output/build.sh
Note that it can take several hours to build the kernel and drivers.
The resulting .deb
files will appear in the current directory.
The build script applies patches that are prefixed with the Ubuntu version codename, e.g., bionic-01-blah-blah.patch
.