[Question]: Can't checkout _exact_ kernel release
Thadeu Lima de Souza Cascardo
cascardo at canonical.com
Thu Sep 17 23:41:46 UTC 2020
On Fri, Sep 18, 2020 at 12:08:39AM +0100, Maxim Blinov wrote:
> Hi everyone, apologies in advance for the noob question:
> I want to build exactly the same kernel version as the one that ships
> with my Ubuntu 16.04 release (yes I know it's quite old now), "Linux
> 4.4.0-186-generic". But everytime I checkout the git tag called
> "Ubuntu-4.4.0-186.216", `make menuconfig` insists that I'm building
> "4.4.228". Details below...
> So first I git clone the Ubuntu kernel code, and I'm a bit confused -
> there seem to be two git repos:
> (Recommended by this answer:
> (Recommended by official docs:
The second one is where we push things, so should be uptodate. The first one
mirrors the first one, so could be outdated.
> I ofcourse lean towards using official Ubuntu documentation, and use
> the second link. But what is the difference between the two?
> But my major problem, is that I can't seem to checkout _exactly_ the
> same version as my running kernel: If I do `$uname -rs` on my
> workstation, I get "Linux 4.4.0-186-generic"
> So then I do `git tag` to find it in the repo, and I find this:
> Ok, I check it out, and I copy the .config from
> "/usr/src/linux-headers-4.4.0-186-generic/". Then I go into the kernel
> directory, do `make menuconfig`, and I see:
> ".config - Linux/x86 4.4.228 Kernel Configuration"
> at the very top of the ncurses menuconfig window. But I thought I
> checked out 4.4.0-186?
> If I then try to overwrite the .config file, the only change between
> .config and .config.old is like this:
> $ diff .config .config.old
> < # Linux/x86 4.4.228 Kernel Configuration
> > # Linux/x86_64 4.4.0-186-generic Kernel Configuration
> which proves to me that indeed, the git tag name does not seem to
> correspond with the Linux version. If someone could suggest the
> correct procedure for this, it would be greatly appreciated.
> (My motivation is for kernel hacking - I would like to be able to
> evaluate my kernel changes on a desktop system in the context of an
> official distribution.)
> Best Regards,
> Maxim Blinov
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
4.4.228 is the upstream linux version. kernel.org continues supporting 4.4 and
releases 4.4.y. Ubuntu picks up those updates and applies them to its kernels.
However, in order not to have to update the orig.gz tarball (that is Debian
source package parlance) with new upstream versions, it is maintained as if
they are still 4.4.0. That prevents the mirrors from exploding with so many
large files, amongst other things.
After the dash, that is, 186.216, is what is called a Debian revision. More
information about this, you will find at:
Now, 4.4.0-186-generic (or for some, only 186-generic), is what is called ABI,
or rather, ABI-flavour. In practice the flavour is part of the ABI. Now, ABI
may refer to a bunch of interfaces. In this case, it refers to the ABI between
the kernel and its modules. Ubuntu moves the ABI for every version of the
kernel that it releases.
Now that we have all that explained, the way Ubuntu puts the ABI into the
kernel uname is by using the debian build scripts under debian/. If what you
need is to build a kernel that is close to what Ubuntu ships, but you don't
care about these versions and ABIs as long as you are building the same
sources, just keep building the kernel as you are probably used to: make
menuconfig, make modules, etc.
Otherwise, you should be using tools like dpkg-buildpackage, debuild, etc. And
in that case, if you need to tweak the config options, look at
debian.master/config/. Configs are kept there and may be updated after changing
some of its files by running 'fakeroot debian/rules updateconfigs'. Also,
notice there is a debian.master/config/annotations file, and that should be
kept in sync with the config options. It's kept manually, there is no tool to
help you there. So, if you are changing a couple of options, just edit
debian.master/config/config.common.ubuntu and debian.master/config/annotations
manually, run fakeroot debian/rules updateconfigs, commit your changes, then
try building with dpkg-buildpackage.
Now, if you want to trim the config too much, maybe you are better off with
building the old way or maybe just try removing that annotations file, replace
debian.master/config/amd64/config.common.amd64 (or whatever architecture is
yours) with your config and try your luck. Another option is cloning the
linux-kvm repo and check if its config is a better fit for you. This kernel is
based on the same xenial one but has different config options and about 4
patches doing small boot time tweaks. Its repo is at
and if you git fetch --tags, you may find tag Ubuntu-kvm-4.4.0-1077.84 will
match closely Ubuntu-4.4.0-186.216.
More information about the kernel-team