Ubuntu git kernel repository
The debian/
metadata which contains the configs, and the kernel tree are tracked both in a single git repository per release: http://kernel.ubuntu.com/git/ubuntu/ubuntu-bionic.git/
The repo then has a tag for each kernel package, e.g. in my Ubuntu 18.04, I have the package linux-image-4.15.0-36-generic
, which I'm guessing corresponds to the tag: Ubuntu-4.15.0-36.39
.
https://help.ubuntu.com/community/Kernel/Compile explains how to compile the kernel, and therefore how to configure it and how configs are merged into the final config.
The configs all seem to be under debian.master/config/ARCH
which contains:
config.common.ubuntu
config.common.ports
amd64/config.common.amd64
amd64/config.flavour.generic
amd64/config.flavour.lowlatency
so I'm guessing that linux-image-4.15.0-36-generic
will merge config.common.ubuntu
, config.common.amd64
and config.flavour.generic
.
The script that does the merging seems to be debian/scripts/misc/kernelconfig and it contains the comment:
# Merge configs
# We merge config.common.ubuntu + config.common.<arch> +
# config.flavour.<flavour>
TODO: there is also an debian.master/config/annotations
file which seems to contain the value for each config for each arch, how is that used?
Someone should confirm all that by running build scripts in verbose mode somehow, but I'm lazy now, you can build with:
git clone git://kernel.ubuntu.com/ubuntu/ubuntu-bionic.git linux
cd linux
git checkout Ubuntu-4.15.0-36.39
fakeroot debian/rules clean
debian/rules updateconfigs
fakeroot debian/rules build-generic
I have then confirmed that this produces the exact same config that I have locally:
diff debian/build/build-generic/.config /boot/config-4.15.0-36-generic
Note that the Ubuntu kernel git repo also has thousands of patches on top of upstream Linux, so just getting the right config won't be enough to reproduce behavior.
We can also triple check that the kernel we built matches the packaged one by looking at the start of dmesg
of the boot, which contains:
[ 0.000000] Linux version 4.15.0-36-generic (buildd@lgw01-amd64-031) (gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)) #39-Ubuntu SMP Mon Sep 24 16:19:09 UTC 2018 (Ubuntu 4.15.0-36.39-generic 4.15.18)
Config in the .deb
As mentioned by others, the final full config is also present under:
/boot/config-4.15.0-36-generic
which correspond to each Linux kernel image:
/boot/vmlinuz-4.15.0-36-generic
So, for other versions, we can find from which package those come from:
dpkg -S /boot/config-4.15.0-36-generic
which gives:
linux-modules-4.15.0-36-generic: /boot/config-4.15.0-36-generic
and then you can just download the .deb
from https://packages.ubuntu.com/bionic-updates/linux-modules-4.15.0-36-generic
and extract it to get the config:
mkdir config
cd config
wget http://mirrors.kernel.org/ubuntu/pool/main/l/linux/linux-modules-4.15.0-36-generic_4.15.0-36.39_amd64.deb
ar x linux-modules-4.15.0-36-generic_4.15.0-36.39_amd64.deb
tar -xvf data.tar.xz
cat ./boot/config-4.15.0-36-generic
Tested in Ubuntu 18.04.