Building the Ubuntu kernel: initial setupΒΆ

Ubuntu packages (and thus kernels) are always built in a chroot matching their series: e.g., a Lunar package will be built a Lunar chroot, a Mantic kernel will be built in a Mantic chroot, etcetc.

A detailed explanation of what a chroot is and how it works is beyond the scope of this document, please refer to the following chroot page for more information.

At the time of this writing, the UKN tracks the Ubuntu Lunar series, thus the example below will build a Lunar chroot: substitute Lunar with the active Ubuntu devel series at the time of reading this doc.

Once set up, you can reuse your chroot to build as many kernels as you want, this section is a one shot process (and can be skipped if you already have the target chroot).

To setup the chroot, we will be using some helper scripts written by the Ubuntu kernel team:

  1. if your user is not part of the sbuild group, add it:

$ sudo usermod -a -G sbuild $USER
# logout and login to let group change take effect
  1. download the kteam-tools:

$ git clone git://kernel.ubuntu.com/ubuntu/kteam-tools.git
  1. build the Lunar chroot:

$ sudo mkdir -p /usr3/chroots
$ sudo kteam-tools/chroot-setup/make_chroot lunar amd64 http://archive.ubuntu.com/ubuntu
  1. done, your chroot is ready:

$ schroot -l
chroot:lunar-amd64

To enter the chroot:

$ schroot -c lunar-amd64
(lunar-amd64)$

To exit the chroot:

(lunar-amd64)$ exit
logout
$