How to compile a Ubuntu Maverick 2.6.35 kernel for Lucid

The Ubuntu kernel developers are actively back-porting the Ubuntu Maverick kernel to Ubuntu 10.04. This means that as a Ubuntu 10.04 user, you can compile the, as I write this, 2.6.35 kernel with Ubuntu modifications. I’m running this kernel myself without any problems. Because the kernel developers are also maintaining the original 2.6.32 kernel they made some changes on how to compile the kernel. For us users it means you can’t follow my original article on compiling the Lucid kernel for the newer kernel.

Updates to the article

  • 2010-09025 – Added installation of libdw-dev to the preparations.
  • 2010-07-17 – Changed the way to see what 2.6.35 kernels are available in the git repository


This article is written for the Ubuntu-lts 2.6.35 and the Ubuntu-lts-2.6.34 kernel.

I’ll be using git to get the latest kernel version. This is my favorite way to get the sources and it is in my opinion the fastest way to make changes later on when you want to update your own kernel to the latest version.
I suggest adding my Launchpad repository to your system. The repository holds the latest version of git and is usually updated within a day of a new release of git, follow the instructions on the page Git Packages for Ubuntu to add my repository. There is a version available for Lucid as well.

I am compiling the i386 version, if you want to compile for amd64 you need replace i386 for amd64 throughout this article.

I choose the name core2 as the flavor name as for my personal use I’ll build a kernel for a Core2 processor. Besides the change of processor type in the configuration I also select support for 64GB as my laptop has 4GB, which is the main reason I started compiling my own kernels. I have some other changes but that’s beyond this article.

If you used my previous article you can skip to Creating a branch.


Let’s get started by preparing our machine for compiling the Ubuntu Lucid kernel.
Open a terminal.

sudo su -
apt-get install fakeroot build-essential
apt-get install crash kexec-tools makedumpfile kernel-wedge
apt-get build-dep linux
apt-get install git-core libncurses5 libncurses5-dev
apt-get install libelf-dev libdw-dev asciidoc binutils-dev

Create a directory where you would like to build your kernel, this directory will hold the kernel source in a sub directory and all the deb files will end up in this folder. I choose /d1/development/kernel/lucid

Getting the source

cd /d1/development/kernel/lucid
git clone git://  source
cd source

The source code is installed in the directory source.

Creating a branch
If you already created a branch for the non lts 2.6.34 or 2.6.32 branch if you followed my previous arfticles make sure you use a different name for the branch created in this article or remove the branch by typing:

git branch -D core2

We will create a branch in which we will be doing our modifications. That way the master branch will stay in tact which will make it a whole lot easier when we want to update our own Ubuntu Lucid kernel to a newer version.

To see all the 2.6.35 kernels available type the following command:

git tag -l Ubuntu-lts-2.6.35*

The Ubuntu kernel developers tag each version as Ubuntu-lts- and therefore we can checkout the version we want as

git checkout Ubuntu-lts-2.6.35-7.11 -b core2

This will create a branch called core2.

Creating a new config

I’ll be using the method of creating a new flavor, this adds a bit more work but you can always compile the original kernels.

We’ll use the generic flavor as the base for our own flavor being core2.

cp debian.maverick/config/i386/config.flavour.generic debian.maverick/config/i386/config.flavour.core2
fakeroot debian/rules clean
debian/rules updateconfigs

To make changes to the configuration file we need to edit the configuration file. The kernel developers have created a script to edit kernel configurations which has to be called through the debian/rules makefile, unfortunately you will have to go through all the flavors for this script to work properly.

debian/rules editconfigs

The script will ask you if you want to edit the particular configuration. You should not make changes to any of the configurations until you see the core2 configuration

Do you want to edit config: i386/config.flavour.core2? [Y/n] 

Make your changes, save the configuration and then keep going until the script ends.

When you’re done, make a backup of the config flavor file.

cp debian.maverick/config/i386/config.flavour.core2 ../. 

Now we need to clean up the git tree in order to get ready for compilation.

git reset --hard
git clean -xdf

Getting ready for compilation

Because we are going to be creating a new flavor based on a existing flavor (generic in my case) we need to create some extra files. During compilation the process checks the previous release for some settings, as we’re creating a local flavor it doesn’t exist in the source, so we’re creating it. The previous release in this case is 2.6.35-7.10.

ls debian.maverick/abi
cp debian.maverick/abi/2.6.35-7.10/i386/generic debian.maverick/abi/2.6.35-7.10/i386/core2
cp debian.maverick/abi/2.6.35-7.10/i386/generic.modules debian.maverick/abi/2.6.35-7.10/i386/core2.modules

Copy our flavored configuration file back.

cp ../config.flavour.core2 debian.maverick/config/i386/

We need to edit some files:

File: debian.maverick/etc/getabis

Search for the line:

getall i386 generic generic-pae

Change it in:

 getall i386 generic generic-pae core2

File: debian.maverick/rules.d/

Search for the line:

flavours        = generic generic-pae virtual

Change it in:

flavours        = generic generic-pae virtual core2

We need to make the compilation process aware of our own flavor we want to compile.

cp debian.maverick/control.d/vars.generic debian.maverick/control.d/vars.core2

You can edit the file and make it your own.

arch="i386 amd64"
target="Geared toward Core2 desktop systems."
bootloader="grub-pc | grub | lilo (>= 19.1)"
provides="kvm-api-4, redhat-cluster-modules, ivtv-modules, ndiswrapper-modules-1.9"

We need to commit our changes in the git repository.

git add .
git commit -a -m "Core2 modifications"

The text after -m is the message you add to your commit.


It’s finally time for compiling but before we can start the compilation process there is one more step to do. I didn’t put this in the Preparations section as you need to the following step whether you make changes to the configuration or not

fakeroot debian/rules clean

All the packages will be created in the directory /d1/development/kernel/lucid
Create independent packages:

skipabi=true skipmodule=true fakeroot debian/rules binary-indep

The above statement will create the following deb files:


Create the tools packages:

skipabi=true skipmodule=true fakeroot debian/rules binary-perarch

The above statement will create the following deb files:


Create the flavour depended files:

skipabi=true skipmodule=true fakeroot debian/rules binary-core2

The above statement will create the following deb files:



After the compilation is finished we’ll have the above packages in the parent directory.

To install the files

cd ..
sudo dpkg -i  linux-headers-2.6.35-7-core2_2.6.35-7.11~lucid1_i386.deb linux-headers-2.6.35-7_2.6.35-7.11~lucid1_all.deb linux-image-2.6.35-7-core2_2.6.35-7.11~lucid1_i386.deb

Check your bootloader if the newly installed kernel is the default one, for grub check the file /boot/grub/menu.lst or if you run grub2 check /boot/grub/grub.cfg
If you have the linux-tools package installed you should remove this package before installing the new tools package.

Reboot and enjoy your newly installed kernel.

This article is filed under the categories Ubuntu » Compile a kernel and has the following tags associated with it: , , .

For more of the same articles see the page Compile a kernel for Ubuntu overview
  • UncleNekomimi

    Under “Getting the source”, shouldn’t the git clone command be referencing ubuntu-maverick.git rather than ubuntu-lucid.git?

    • Nope, the lucid sources contain the backported version of the maverick kernel.

  • let me try first, btw thanks for the artice

  • Jim

    After getting the source, the “less debian.maverick/changelog” returns “No such file or directory. There is only a debian.master folder in the source folder. A previous kernel version is visible in the change log for the debian.master. Did I do something wrong? Thanks!

    • Which tag did you use to create the new branch?

  • Jim

    I didn’t create a new branch because the kernel tag that was in the changelog was a previous kernel version (2.6.32); so I figured I didn’t get the new 2.6.35 kernel. I stopped at the new branch step.

    • My apologies, apparently I had done something different when I wrote the article. It’s fixed now. To see the latest 2.6.35 kernel use the command:
      git tag -l Ubuntu-lts-2.6.35*

      • Jim

        Gold star for Sean… Thank you SO MUCH for the help and the guide Peter! There is no way I could have installed this without your guide.

  • Sean

    It worked perfectly the first time. Thank you for the guide.

  • cshin9

    For the “Creating a branch” section, I got “fatal: Not a git repository (or any of the parent directories): .git”.

    • You have to be in the source directory. For clarity I added this in the article after you pulled the source.

      • cshin9

        Could you explain how to edit the two files debian.maverick/etc/getabis and debian.maverick/rules.d/

        • Use your favorite editor and follow the instructions posted in the article.

  • Dan

    Worked perfectly. Thank you!

    Oh yeah, one remark, … the line

    flavours = generic generic-pae virtual core2 core2

    seems to have core2 twice there.

    • Thanks for the find, it’s corrected now.

    • charan

      dude its working with ur system can u mail me the steps what u followed i am faceing some problems
      my mail id

      • Follow the steps in the article ๐Ÿ™‚

  • BrollyLSSJ

    Thank you for the guide. This time was the first time I tried to compile my own Kernel on (K)ubuntu and I successfully compiled a working kernel. Before I tried it about 5 or so times with debian, but always failed. But sadly I also need to compile the ATI driver on my own (or atleast download the driver instead of letting ubuntu install it via hardware installer).

    • Good to hear you were able to compile your own kernel.
      yeah I don’t know much about ATI drivers, I run nVdiia and they just let you install the kernel module.

      • BrollyLSSJ

        The built-in ATI driver failed to install (update) on both my own compiled 2.6.35 kernel and the precompiled mainline 2.6.34 kernel. With debian I had no problems installing both ATI and nVidia drivers (the installed compiled them itself for the new kernel). Though I always had to recompile them, when updating the kernel from the repository.

  • xenphor

    At the last step I get:
    ~/dev/source$ skipabi=true skipmodule=true fakeroot debian/rules binary-core2
    make: *** No rule to make target `binary-core2′. Stop.

    What did I do wrong?

    • You probably missed or misspelled something in either one of these two steps:
      Edit the files:

  • Mr.Hunt

    Until august 5, there is a new testing version of Ubuntu with the 2.6.35 kernel

    • Mr.Hunt

      Replace the until with since lol

  • busterbrown

    Great article, it was my first experience of compiling kernel. It works, kernel version 2.6.35-14.20 :).

    1. There is no “386” at the end of the line “getall i386 generic generic-pae” in file:debian.maverick/etc/getabis.
    2. Extra “core2” at end of the line:
    “File: debian.maverick/rules.d/
    Search for the line:
    flavours = generic generic-pae virtual core2”

    • Thanks for the rectifications, I changed the article accordingly.

  • Bytemare

    Your article is the best Howto ever seen.
    Easy to read and it worked for me in the first try. Thank you (I followed your steps blindfolded ๐Ÿ™‚ )!
    I have to mention that I was in need for a new kernel since I used to run loop-AES.

    Now i am stuck in building a new initrd that includes the new loop.ko/mount/loosetup to get root-filesystem encrytion to work.
    I did this before on other distributions, but ubuntu is quite new for me.
    Do you have any hints for me to find a source/Howto ?

    • Bytemare

      I was blind. cpio | lzma did the job to edit and build the initrd.
      So now loop-eas is integrated to boot from encrypted root-partition

  • I get error when I am compiling AMD64 under your instruction. All the configurations are same, except for the AMD64 instead of i386. But I get this:
    install -d /d1/development/kernel/lucid/source/debian.maverick/abi/2.6.35-7.11~lucid1/amd64
    sed -e ‘s/^\(.\+\)[[:space:]]\+\(.\+\)[[:space:]]\(.\+\)$/\3 \2 \1/’ \
    /d1/development/kernel/lucid/source/debian/build/build-core2/Module.symvers | sort > /d1/development/kernel/lucid/source/debian.maverick/abi/2.6.35-7.11~lucid1/amd64/core2
    II: Checking ABI for core2…
    WW: Explicitly asked to ignore ABI, running in no-fail mode
    II: Different ABI’s, running in no-fail mode
    EE: Previous or current ABI file missing!
    install -d /d1/development/kernel/lucid/source/debian.maverick/abi/2.6.35-7.11~lucid1/amd64
    find /d1/development/kernel/lucid/source/debian/build/build-core2/ -name \*.ko | \
    sed -e ‘s/.*\/\([^\/]*\)\.ko/\1/’ | sort > /d1/development/kernel/lucid/source/debian.maverick/abi/2.6.35-7.11~lucid1/amd64/core2.modules
    II: Checking modules for core2…previous or current modules file missing!
    dh_clean -k -plinux-image-2.6.35-7-core2
    dh_clean -k -plinux-headers-2.6.35-7-core2
    dh_clean -k -p-core2
    # The main image
    # compress_file logic required because not all architectures
    # generate a zImage automatically out of the box
    install -m644 -D /d1/development/kernel/lucid/source/debian/build/build-core2/arch/x86_64/boot/bzImage \
    install -m644 /d1/development/kernel/lucid/source/debian/build/build-core2/.config \
    install -m644 /d1/development/kernel/lucid/source/debian.maverick/abi/2.6.35-7.11~lucid1/amd64/core2 \
    install -m644 /d1/development/kernel/lucid/source/debian/build/build-core2/ \
    makedumpfile -g /d1/development/kernel/lucid/source/debian/linux-image-2.6.35-7-core2/boot/vmcoreinfo-2.6.35-7-core2 \
    -x /d1/development/kernel/lucid/source/debian/build/build-core2/vmlinux
    get_debug_info: Can’t create a handle for a new debug session.

    makedumpfile Failed.
    make: *** [install-core2] Error 1

    Did I make something wrong? There should be no /d1/development/kernel/lucid/source/debian.maverick/abi/2.6.35-0.0/amd64/core2.modules, this path should not exist.

    • There actually should be a core2.modules files. It’s copied in section Getting ready for compilation.
      Did you disable the debug options in the Kernel configuration?

      • Yes, I disabled the kernel debug in the Kernel Hacking option. I just thought it will reduce the kernel size. OH, should the kernel debug option useless?

        • Try the following:
          Add no_dumpfile=true when you compile the same way as skipabi=true so for example:
          instead of
          skipabi=true skipmodule=true fakeroot debian/rules binary-core2
          skipabi=true skipmodule=true no_dumpfile=true fakeroot debian/rules binary-core2

          Let us know if that worked

          • That works perfect, all done! Thanks a lot! see:

            ~$ uname -a
            Linux pc7 2.6.35-7-core2 #11~lucid1 SMP PREEMPT Wed Aug 18 21:22:16 CDT 2010 x86_64 GNU/Linux

            But one more question, why do you install two headers? one for the new, and one for what?
            dpkg -i linux-headers-2.6.35-7-core2_2.6.35-7.11~lucid1_i386.deb linux-headers-2.6.35-7_2.6.35-7.11~lucid1_all.deb

  • ElToro

    Argh, second time I needed an hour to find out how to get git trough our firewall… well there is also http protocol for ubuntu git, but it is not so easy to find as address is not the same.
    git clone

    • Luciano

      +1 to this tip.

  • Mat


    If you made your own flavour core2 can you later update your branch by merging a newer tag later on?
    Do you have experience with that. Best regards and thank you for your walkthrough!

  • HotShotDJ

    As always, a wonderful HowTo — just as with your previous versions, I successfully compiled, installed and ran my shiny new 2.6.35 kernel on Lucid. Will you be writing a HowTo for updating our lovely kernels? Or do previous instructions work?

  • mech259

    The install line “sudo dpkg -i linux-headers-2.6.35-7-core2_2.6.35-7.11~lucid1_i386.deb linux-headers-2.6.35-7_2.6.35-7.11~lucid1_all.deb linux-image-2.6.35-7-core2_2.6.35-7.11~lucid1_i386.deb” contains references to previous versions that differ from my setup and since this is my 1st kernel compile, my kernel is 2.6.32-x.xx with the newest one available. I’m sorry, I tried to substitute versions in the statement, but I get errors such as directory does not exist and a couple of other errors. If I post what versions I am working with can you help?

  • mech259

    I will, but I just realized that mine is an AMD Phenom processor, so I will have to start over. Can I just delete the folders and start over?

    • To start over:
      git checkout master
      git branch -D core2

      The git branch -D deletes the core2 branch you created.

      Now you can start over again, starting at:
      git checkout Ubuntu-lts-2.6.35-7.11 -b core2

  • mech259

    Thanks a bunch.

  • mech259

    1st command gets this response:

    root@mechanic-desktop:/home/mechanic/Lucid# git checkout master
    fatal: Not a git repository (or any of the parent directories): .git

    2nd command:

    oot@mechanic-desktop:/home/mechanic/Lucid# git branch -D core2
    fatal: Not a git repository (or any of the parent directories): .git

  • mech259

    sori never mind LOL I figured it out

  • When compiling on amd64, I am getting “drivers/isdn/gigaset/isocdata.c:1007 internal compiler error
    any ideas?

  • Bean Counter

    Just a caution: in the Preparation step, you su to root for the apt-get commands. It’s worth mentioning that users should exit the root shell before continuing, just as a precaution. All the config and build stuff can (should) be done in an ordinary user account; only the last install step needs root privileges. Great article, BTW, and I’m hoping for good things at the office (building a kernel for VirtualBox) and at home (building in support for a Quanta touchscreen).

    • Thanks for the catch, I adjusted it accordingly

  • Matteo Pacini

    Thank you Peter for the amazing guide!
    I succesfully compiled and installed my own version of kernel 2.6.35-22.33!
    I have a question.
    I need to compile a kernel with the real-time patch.
    Is there a way to patch my own kernel?
    Thank you for the answer, keep up the good work ๐Ÿ™‚

    Matteo P.

    • Yes you can patch your own kernel.
      Unfortunately there is no RT patch for the 2.6.35 kernel available at the moent.

      This is from the RT mail listing, posted on August 17, 2010 by Clark Williams:

      When I last talked with Thomas (a bit over a week ago) the plan was to
      release an rt patch for the 2.6.35 tree. My guess is that when Thomas
      gets back (he’s on vacation this week), he will forward port the current to 2.6.35 and we’ll have a new -rt patch.

      So far it has not been released yet.

      The very short version of how to to patch your own kernel:
      Apply the patch
      Commit the patch in git

      If you want more info, post a topic in the forum, we can discuss it there (Better place for longer discussions)

  • MK

    This command didn’t work for me in the beginning:

    git checkout Ubuntu-lts-2.6.35-7.11 -b core2

    It said something like “cannot checkout and select branch at same time” or similar – sorry that I can’t remember it exactly, reason is: When it didn’t work I just decided to skip the creating-a-branch thing. After installing the deb files at the end I just entered it again out of curiosity and lo and behold it suddenly worked then.

  • MK

    skipabi=true skipmodule=true fakeroot debian/rules binary-indep

    will also cause several times this message, although it doesn’t interrupt the process:

    Makefile:512: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev
    Makefile:565: newt not found, disables TUI support. Please install newt-devel or libnewt-dev

    • Run the following command:
      sudo apt-get install libdw-dev
      I added this to the preparations as well.

      You might have selected options in the kernel that require the installation of the libnewt development library, to install these you also need to run:
      sudo apt-get install libnewt-dev

      Both need to be run before compilation.

  • MK

    Ok, after trying the branch-thing again, compiling and installing worked fine, but on rebooting I was prompted with a fatal error, because modules.dep of that flavour name wasn’t found, so I guess this guide just doesn’t work “out of the box”, but I’m missing some prerequisites?

    • This might be solved by after fixing the compile error by following the comments in comment 26.1

  • owa

    Wull, ya dun good, Pilgrum!! Ya dun real good!!
    Well written instructions. I have previously built kernels on earlier versions of Fedora using rpmbuild and downloading source tarballs from which went very smoothly. I’ve also built kernels from scratch using tarballs and cli….. pretty tedious.
    This is the very first time I’ve used git to build a debian/ubuntu kernel. Really quite straight-forward. I did do one thing different, however, which I’ve done in the past. Instead of using the config file from git using the most recent previous version listed, I used my own config file from my running kernel, which was the stock config-2.6.32-25-generic. That way I don’t have to make any changes at all, usually, in the “configure” steps, but just accept everything as it is, since it works just dandy on my running kernel. As yet, I haven’t had any issues at all doing it that way.
    Congratulations, my friend. This is an excellent tutorial.


    • owa

      Oh, By the way. I’m actually running on this shiny new kernel. $ uname -a
      Linux uglybox 2.6.35-9-core2 #14~lucid1 SMP Sat Oct 2 15:33:46 MST 2010 x86_64 GNU/Linux


  • this is amazing and wonderful…I tried fot this doc and found it…can you doocument mydns installation in ubuntu linux

  • RS

    Just want to express my thanks. THANKS A LOT!

  • VMGuy

    Thanks for that. It was very helpful.

    Just one question about it:
    When I patch the kernel (header + source files) I also get the generic kernel headers with the same name and version than the original kernel (e.g. linux-headers-2.6.35-22).
    But my packages has a different (patched) content.

    If I put this package now to a apt-repository aptitude can’t differentiate between them and it always picks the Ubuntu original repository (instead of my own).

    Currently I use apt-pinning, but I would rather move the patched stuff to the flavour specific header package.

    But how to do that?


    • You would have to change the kernel version 2.6.35-22 into something like 2.6.35-22.1.

      I’ll see if I can out what you have to change for that to happen.

    • I just wrote up an article to cover this for Ubuntu 10.10. I most likely will work for Lucid as well.

      • VMGuy

        I already tried the startnewrelease stuff, but it didn’t work with the deb-src package.
        Maybe I’ll try the git version.

        How can I check out exactly the “released” kernel version, e.g. 2.6.35-22 and not the latest development version?

  • Mason

    When I enable * Support for big SMP systems with more than 8 CPUs and Maximum number of CPUs . It will compile fail. I have try many times.

    Any one know how to fix this problem ? Thanks

      • Mason
      • Mason

        I purpose is to build 16 (or 24) Core CPU kernel on Ubuntu 10.04 with I386 platform. I have try many times, it’s no problem when I compile new kernel without big SMP support. Anyway, if I try to enable [*] Support for big SMP systems with more than 8 CPUs , it will compile fail.

        Is it possible to build over 8 CPU on Ubuntu 10.04 I386 platform ???

        Below are error message …

        /root/maverick/source/arch/x86/xen/mmu.c:1030: undefined reference to `page_to_nid’
        arch/x86/built-in.o: In function `page_zone’:
        /root/maverick/source/include/linux/mm.h:560: undefined reference to `page_to_nid’
        arch/x86/built-in.o:/root/maverick/source/include/linux/mm.h:603: more undefined references to `page_to_nid’ follow
        make[2]: *** [.tmp_vmlinux1] Error 1
        make[1]: *** [sub-make] Error 2
        make[1]: Leaving directory `/root/maverick/source’
        make: *** [/root/maverick/source/debian/stamps/stamp-build-core2] Error 2

  • Abhinav

    Hello Peter,
    Thanks for the post. my query is given below.

    Presently, I am on Ubuntu-lts-10.04, Kernel – 2.6.32-38-generic, i686 Architecture. I need to switch to Linux Kernel version for a reason (NVIDIA CUDA-4.1 driver are tested and supported on this kernel version).

    Do you suggest I should let i386 stay as it is in your post throughout or should I change it to i686 everywhere.


    • Peter

      I believe it should be i386, that’s just the directory name they use for non 64bit systems.

      • Abhinav

        Thanks a lot lot lot …. Peter

        It worked Like a charm. I guess I can now get back to my GPU programming.

        Thanks again

  • Martin

    Hi Peter,
    thanks for the excellent post!
    Following your instructions I can compile my 64bit server kernel with no problem.
    However now I want to compile the same kernel on the same system for a 32bit machine, which is too slow to ever compile a kernel on. I suppose it should not be a big deal, but can not find a pointer on how to achieve that.
    Could you please help me out with your experiences?