15

I'm using Maverick with the latest available kernels on kernel.org and building them myself. Until now I've been basing my configuration off the stock Maverick kernel and accepting the make oldconfig defaults. I've been doing this for 3 major releases now so I figure I'm starting to slip behind the current "standard".

I would like to re-base my kernels off the new Natty .config file. Is this available somewhere online or do I have to download the whole kernel package and extract it?

Edit: I've manually pulled in the config from the latest Natty kernel package and I can confirm that I propbably should have done this sooner. A lot of differences between my old "evolved" config and the Natty default. Now if I could just do this without 20 minutes of hunting and downloading the package so I can re-base in the future.

4 Answers 4

35
+100

Each linux-image package contains the exact configuration file that it was built with in /boot/config-*. To see the configuration file for the currently running Linux kernel, do:

  • less /boot/config-$(uname -r)

I have checked with the Ubuntu kernel people (on Freenode #ubuntu-kernel) and they have confirmed my belief that there isn't really "the config", but it is actually constructed at build/compile time by including a number of Kconfig files; these depend on the exact architecture and target (desktop/server/cloud). You should be able to read that (short) conversation at:

A list of that variety can be found using packages.ubuntu.com and the following search:

Hunting, around, it would appear that the .config is also included in the linux-headers-* packages. These are .deb files (which are simple .ar archives that will open with file-roller) and only about 800 kB each. If you know the particular target, architecture and version you're after, you can grab these straight from Launchpad or from the archive itself:

  1. archive.ubuntu.com/ubuntu/pool/main/l/linux/linux-header-2.6*.deb
  2. then look in /usr/src/linux-headers-2.6*/.config

If you want to automate the whole process into one command, you could try the following; make sure you keep it all on one line!

Hope that helps!

2
  • Thanks for investigating this. Having read the irclog, it doesn't look like I'm going to get what I want without significant download. Automation-wise, it's still easier to grab the package and extract its /boot-config-* than trying to emulate the wizardry they use to autogen them at build-time. It's a shame there isn't a way of grabbing one file from a package online (or is there?)
    – Oli
    Mar 15, 2011 at 16:01
  • I think I'll ask that in a separate question.
    – Oli
    Mar 15, 2011 at 16:02
7

The kernel team has posted the configs for Natty here:

Sources:

4

On my Ubuntu 11.10 system the kernel config is in the file '/boot/config-3.0.0-12-generic'.

1
  • 1
    The question is for 11.04, not 11.10. Jan 23, 2012 at 4:13
2

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .