How to compile a Ubuntu 10.10 (Maverick) kernel

Ubuntu 10.10 was released in October and I have been writing articles on “How to compile a kernel for Ubuntu …” for a few releases and there is no exception for Ubuntu 10.10.
The Ubuntu kernel developers have decided to change things up yet again for the Ubuntu 10.10 kernel, I guess it will change every Ubuntu release.

Introduction

git
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 Ubuntu 10.10 as well.

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

Flavor
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.

Preparations

Let’s get started by preparing our machine for compiling the Ubuntu 10.10 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
exit

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/maverick

Getting the source

cd /d1/development/kernel/maverick
git clone git://kernel.ubuntu.com/ubuntu/ubuntu-maverick.git  source
cd source

The source code is installed in the directory source.

Creating a branch
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 10.10 kernel to a newer version.

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

git tag -l | sort -V

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

git checkout Ubuntu-2.6.35-23.37 -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 this way you can always compile the original kernels.

We’ll use the generic flavor as the base for our own flavor being core2, as discovered by one of the readers of this blog, this extension needs to be in small caps.

cp debian.master/config/i386/config.flavour.generic debian.master/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.master/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-23.36

ls debian.master/abi
cp debian.master/abi/2.6.35-23.36/i386/generic debian.master/abi/2.6.35-23.36/i386/core2
cp debian.master/abi/2.6.35-23.36/i386/generic.modules debian.master/abi/2.6.35-23.36/i386/core2.modules

Copy our flavored configuration file back.

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

We need to edit some files:

File: debian.master/etc/getabis

Search for the line:

getall i386 generic generic-pae virtual

Change it in:

getall i386 generic generic-pae virtual core2

File: debian.master/rules.d/i386.mk

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.master/control.d/vars.generic debian.master/control.d/vars.core2

You can edit the file and make it your own.

arch="i386 amd64"
supported="Core2"
target="Geared toward Core2 desktop systems."
desc="x86/x86_64"
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.

Compilation

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/maverick
Create independent packages:

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

The above statement will create the following deb files:

linux-headers-2.6.35-23_2.6.35-23.37_all.deb
linux-tools-common_2.6.35-23.37_all.deb
linux-doc_2.6.35-23.37_all.deb
linux-source-2.6.35_2.6.35-23.37_all.deb 

Create the tools package:

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

The above statement will create the following deb file:

linux-tools-2.6.35-23_2.6.35-23.37_i386.deb

Create the flavour depended files:

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

The above statement will create the following deb files:

linux-headers-2.6.35-23-core2_2.6.35-23.37_i386.deb
linux-image-2.6.35-23-core2_2.6.35-23.37_i386.deb

Installation

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-23-core2_2.6.35-23.37_i386.deb linux-headers-2.6.35-23_2.6.35-23.37_all.deb linux-image-2.6.35-23-core2_2.6.35-23.37_i386.deb

Check your bootloader if the newly installed Ubuntu 10.10 kernel is the default one, for grub check the file /boot/grub/menu.lst or if you run grub2 check /boot/grub/grub.cfg

Reboot and enjoy your newly installed Ubuntu 10.10 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
  • sounds great. i will give it a try.

    a few questions:
    * is there any change needed for compiling a PAE kernel?
    * changing the vars files – is it for human read only, or does this affect the compilation? in other words, do i need to change it to my arch and core number?

    • The kernel source comes with a generic-pae configuration. If you would like to compile a PAE kernel and don’t want to make changes to the kernel configuration you can just start at the Compilation section.
      Change
      skipabi=true skipmodule=true fakeroot debian/rules binary-core2
      to
      skipabi=true skipmodule=true fakeroot debian/rules binary-generic-pae

      The vars changes are strictly for human read only.

      • Mel

        Everything was working good until this:

        So what do I do to fix it? I am attempting this for the first time ๐Ÿ˜‰
        root@ubuntu:~# apt-get build-dep linux
        Reading package lists… Done
        Building dependency tree
        Reading state information… Done
        E: Could not open file /var/lib/apt/lists/ppa.launchpad.net_pdoes_ppa_ubuntu_dists_maverick_main_source_Sources – open (2: No such file or directory)

        • Looks like you added the source repo of my PPA, which doesn’t exists.

  • RajW

    Are there any special instructions for the Intel Atom D510?

    Is it possible for me to compile the Atom kernel on my faster 64-bit system (cross compile?)

    Thanks!

  • Justme

    Should not “cd /d1/development/kernel/lucid” be “cd /d1/development/kernel/maverick” ? I am pretty much a newbie but I am giving it a try.

    • Yup you’re right.

  • Thanks for your article. It worked great.

    A question though. When I ran through the article the latest kernel was 2.6.35-23.39 but now .40 is released. What’s the easiest way to pull in the new changes to my own git repository?

    Would it just be easiest to rm the source folder (keeping my config of course) and run through all the steps again? (with the exception of reconfiguring my kernel).

    • I’ll write something up to updating to the next version in the next few days. Stay tuned.

  • Tom

    Great article! The only step that seemed very hazy was “Make your changes, save the configuration and then keep going until the script ends.” under “Create Your Own Config”. My goal was to get an amd64 kernel optimized for my Core2 laptop rather than a generic processor. Are there any good guides that explain all of these config file options?

    • Tom

      Also, did you ever end up writing the update process for new kernels that Daniel requested?

      • Expect this in the next few days.

    • I haven’t seen a guide that explains all the kernel configuration options. It’s to much to write down I guess. There might be some books out, but I don’t know.

      Have you read the article Configuration tips for the Ubuntu Lucid kernel? It explains just a few but it might help, these options also apply to the maverick kernel.

      • Tom

        Do you have any experience with using the scripts/kconfig/streamline_config.pl script in order to generate a bare-bones config? I’ve tried unsuccessfully a couple times to pull that into the workflow you’ve described here in order to generate a config for me.

        • No unfortunately I don’t. When I find some time I’ll take a look at it.

          • Tom

            Since kernel 2.6.32, apparently you’re supposed to be able to call “make localmodconfig” to generate a config with only the kernel features your current system is using (a very nifty and exciting feature!). Make localconfig calls scripts/kconfig/streamline_config.pl… unfortunately, calling this script from the makefile seems to have a bug that keeps it from working as advertised. However, calling streamline_config.pl manually does its job well it seems.

            My problem essentially boils down to once I have this cool .config file in the main directory of the kernel source, how do I pull it into your workflow?

          • Tom,

            After you create the .config take the following steps:
            1. Copy this config to /d1/development/kernel/maverick
            2. cd /d1/development/kernel/maverick/source
            3. git reset –HARD
            4. git clean -xdf
            5. Copy the config to debian.master/config/i386/config.flavour.core2
            6. fakeroot debian/rules clean
            7. debian/rules updateconfigs

            You can continue in the section Creating a new config right after the code block at the sentence “To make changes to the configuration file….”

            Let us know how it went.

  • ahmed

    Hi,

    I’m having this error when I try to execute apt-get build-dep linux

    error : E: Could not open file /var/lib/apt/lists/extras.ubuntu.com_ubuntu_dists_maverick_main_source_Sources – open (2: No such file or directory)

    any help pls !!

    • Sounds like you haven’t enabled the sources repository.
      Follow the instructions on the Ubuntu wiki and enable Source Code in the Ubuntu Software tab.

  • ahmed

    thanks peter ,

    I found a solution it was the public key missing !! so i did this to solve the problem :

    sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys 16126D3A3E5C1192

    it works fine.

  • I have a question not related to this article but hoping you don’t mind helping me. If you don’t want to it’s all right with me. I’m using Ubuntu 10.10 on a Compaq Presario CQ-60-210US and I’ve been using my wi-fi with no problems till one day it stop working all of a sudden. I haven’t been able to get it back working since. It’s using the Antheros wi-fi card. If you can help me that would be awesome if not I understand.

    • Sorry but I wish I could help you but I really don’t know what the solution would be.

    • Tom

      Ubuntu Forums is a great resource that you should explore if you haven’t. Lots of knowledgeable people who have resolved similar problems.
      http://ubuntuforums.org/

  • Vinay

    Hi Peter,

    Thanks for posting these steps, I’ve an error at the compilation stage when I’m trying to create flavour dependent files using “skipabi=true skipmodule=true fakeroot debian/rules binary-core2”.

    I get the error message as “make: *** No rule to make target `binary-core2′. Stop.”

    And if I check in “/d1/development/kernel/maverick/source/debian/rules.d”, I do not find *-binay-core2.mk file, I’m puzzled as to know what’s causing this.

    Any help would be appreciated.

    Thanks

    • This usually indicates a typo in the files you edited, debian.master/etc/getabis and/or debian.master/rules.d/i386.mk

      • Vinay

        I checked those files, they look good no typos there!

        • Post your edited files on my support forum, it’s easier to read there and keep the conversation going.

    • Daniel

      I have the same issue when following the instructions verbatim on an amd64 machine.
      In this case, replace “i386” with “amd64” throughout and try again.
      (e.g. Instead of “debian.master/config/i386/” use /debian.master/config/amd64/)

  • raoufeh

    Thanks for your useful guide,
    I haven`t seen such a complete tutorial before ๐Ÿ™‚

    I went through this instruction and everything worked fine, now i have two kernels installed with my Ubuntu 10.10. but i have a big problem after installation, the Internet connection is gone ! I have the driver module installed and the output of ifconfig shows that both of my network cards are up and have IP, I can also ping other computers connected to the switch but i can not ping any other computer ( ex. Google IP address). The wired connection icon in the upper panel is gone! and there is no connection on the list of wired connections !
    the problem exists even when i boot from my old kernel!

    I was wondering if it can be related to the new kernel installation?

    • I don’t think it is related to the new kernel.
      I take it you have a wifi and nic connection?

      • raoufeh

        Hello Peter,

        the problem was solved by assigning an static internal IP to one of the NICs and setting up the other one to use DHCP.

        I am not sure if it was related to the new kernel or not!

        Thanks

  • Steve

    Maverick 10.10 64 bit w/2.6.35.23, is the current OS and kernel. Want to upgrade to 2.6.36. Will your process get the upgrade done.

    Thanks in advance for your support.

    • Sorry but it won’t. There’s no 2.6.36 in the Ubuntu 10.10 kernel git repository.
      Ubuntu Natty is currently at 2.6.37 but using the Natty kernel on Ubuntu 10.10 is not covered in this article.

      • Steve

        Thank you for your response!!

  • Klaus

    When running “apt-get install libelf-dev libdw-dev asciidoc binutils-dev”
    > 800MB size of SW will be installed!?!? Are all those packages required?

    How about adding “–no-install-recommends” to that line?

    • The total amount of data depends on what you already had installed. I can’t tell you if every package is needed either. I remember somebody commenting that he/she needed more packages to compile the kernel. It all depends on the options you select during the kernel configuration.
      Give the option a try and see if it works.

  • hakan

    Hi this is a great article, but i have some questions.
    +Is this way work to compiling a kernel for “arm architecture”?

    I install ubuntu 10.10 on BeagleBoard, but it has too many unnecessary things that makes it slow. I want to re-compile it’s kernel for my requirements.

    Regards,

    • I never tried so I can’t give a definite answer right now. As I’m kind of busy at the moment I will look into this in January 2011. In the mean time I suggest you might want to have a look at this site: http://elinux.org/BeagleBoardUbuntu

      • hakan

        Thanks. But i would like to hear about your work about arm arhitecture. please inform us.

        Regards,

  • Greg

    I tried it, and after little more than an hour, I booted in my own kernel.

  • rich

    I’m patching my kernel and I’d like to bump the package version number. The traditional solution is to append “krp1” to whatever the previous number was. That way my patch is lexically later than the original yet earlier than the next thing to come from upstream which works well with local package repositories.

    When I add a changelog entry to debian/changelog, though, it fails to build producing several errors.

    How do I change the package version?

    • I just wrote up an article to cover this.

      • rich

        Thank you.

  • Wojtek

    Hi,
    I want to change one option in the configuration (CONFIG_ACPI_DEBUG) but otherwise keep the kernel the same as the stock. (since I think there is a bug related to acpi)
    Is there a way to find out which was the tag that the stock kernel I am running was built from? I am now running 2.6.35-23-generic
    I see 6 tags:

    Ubuntu-2.6.35-23.36
    Ubuntu-2.6.35-23.37
    Ubuntu-2.6.35-23.38
    Ubuntu-2.6.35-23.39
    Ubuntu-2.6.35-23.40
    Ubuntu-2.6.35-23.41

    – which one do I pick?

    Thanks,
    Wojtek

    • rich

      uname -a

      Look for the number after the #. The -23 part you can see already. The number after the # in uname is the number after the period in the package numbering.

  • NoImage-deb

    I run thru all the steps, everything runs fine up to “dpkg-gencontro…..”

    dh_gencontrol -plinux-image-2.6.35-25-LKM1
    dpkg-gencontrol: error: Illegal package name `linux-image-2.6.35-25-LKM1′

    I replaced core2 with LKM1 for my flavor, are the capitals the issue?

    I will recompile under lkm1 to check…

    • NoImage-deb

      That did it!

      • Interesting find. I’ll make sure to add this info to the article.

  • M_e_71

    Hi,

    when I run this command

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

    I got this error messages

    Checking for dupe aliases in core2…
    Could not open /home/marco/linux/maverik/source/debian/linux-image-2.6.35-27-core2/lib/modules/2.6.35-27-core2/modules.alias at debian/tests/check-aliases line 10.
    run-parts: debian/tests/check-aliases exited with return code 2
    make: *** [install-core2] Error 1

    I am compiling for amd64.

    Marco

    • Did you set CONFIG_LOCALVERSION_AUTO ?

      • M_e_71

        YES. I removed it and I could compile it.

      • Johannes

        Hello Peter,

        I have the same problem as M_e_71
        Where can I set “CONFIG_LOCALVERSION_AUTO”
        Is it the option in debian/rules editconfigs under “General” -> “Automatically append version……”?

        Thank you,
        Johannes

  • dig

    I am getting the new kernels in grub.conf but it is not displaying anything at boot up time and still booting up with old one how can I change the default kernel.

    • If you have confirmed your newly compiled kernel is listed in /boot/grub/grub.cfg and it’s not the kernel used to start up change the line

      set default=”0″

      to the number your kernel menuentry is. Remind you, it starts with 0.

      • dig

        it worked great !!
        i have another lame question.
        If I am developing something and I have to configure and test kernels frequently then how many steps should I repeat each time.

        lets assume I want to modify something in core2 only and recompile it and test it. and want to repeat it few times.

        • If you don’t change the configuration:
          Make your source changes

          git add .
          git commit -a –amend

          And continue from Compilation

  • dig

    Yeah you are right about source changes but what about configuration ?

  • Forrestdg

    Great post! I am using this to compile a custom kernel for my tablet.

    However, when I installed the custom kernel, it fails on this:

    run-parts: executing /etc/kernel/header_postinst.d/dkms 2.6.35-25-archos9 /boot/vmlinuz-2.6.35-25-archos9
    * dkms: running auto installation service for kernel 2.6.35-25-archos9
    * psb-kernel-source (4.42.0)…[fail]
    * bcmwl (5.60.48.36+bdcom)… [fail]

    Which left me without graphics and wireless modules. X fails on the reboot because of that. Any guess where to look to fix this?

    • Sounds like you disabled them in your kernel config.

  • stabilo

    after
    # git clone git://kernel.ubuntu.com/ubuntu/ubuntu-maverick.git source
    i have error message

    kernel.ubuntu.com[0: 91.189.94.216]: errno=Connection timed out
    fatal: unable to connect a socket (Connection timed out)

    hmmmm – witch port i need to unblock on my iptables ???

    • Open up port 9418

      • stabilo

        very nice ! – it’s working now.
        Peter can you tell us what we can delete after all done ?
        Can you prepare a list of packets for apt-get remove/purge ?

        Thanks vm

  • stabilo

    I just delete /dl directory … Everything works fine.
    Peter i have last question about kernel version..

    At (kernel.ubuntu.com/ubuntu) i found only 2.6.35-27 as the newest ver of kernel.
    At (kernel.org) i found 26.37.2 as the nevest ver. of kernel.

    Is it possible to compile 26.37.2 with git ? Thank for reply ..

    • The kernels at kernel.org are referred to as vanilla kernels. You can compile them for Ubuntu but they won’t have the “sauce” Ubuntu puts on them. The Ubuntu kernel developers patch the vanilla kernel and add extra to make compilation on Ubuntu easier.
      This article isn’t written to build a kernel using the vanilla kernel.

  • Tom

    One other suggestion I have for you is to add DEB_BUILD_OPTIONS=parallel=X to each of your debian/rules build lines, and advise people to set X to their ideal thread count + 1. In my experience this speeds things up nicely.

  • Why we create the tools package if we don’t use it?

    Is there any way to pass a FLAG to Ubuntu kernel compile? I would like pass the FLAG: “-march=native”

  • Hannah

    Im stuck here: skipabi=true skipmodule=true fakeroot debian/rules binary-core2

    make: *** No rule to make target `binary-core2′. Stop.

    What went wrong?!

    • Usually indicates a typo in one of the files, getabis, i386.mk

  • Johannes

    Hello Peter,

    I am still struggling with the following error:

    Checking for dupe aliases in johannes…
    Could not open /home/johannes/d1/development/kernel/maverick/source/debian/linux-image-2.6.35-28-johannes/lib/modules/2.6.35-28-johannes/modules.alias at debian/tests/check-aliases line 10.
    run-parts: debian/tests/check-aliases exited with return code 2
    make: *** [install-johannes] Error 1

    All I did different is that I changed the local version string:
    I checked for LOCAL
    #
    # Config options for config.flavour.johannes automatically generated by splitconfig.pl
    #
    # CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
    CONFIG_HIGHMEM4G=y
    # CONFIG_HIGHMEM64G is not set
    CONFIG_INTEL_IDLE=y
    CONFIG_LOCALVERSION=”johannes”
    # CONFIG_PHYS_ADDR_T_64BIT is not set
    CONFIG_SCSI_SPI_ATTRS=m
    CONFIG_SCSI_SYM53C8XX_2=m
    # CONFIG_SYS_HYPERVISOR is not set
    CONFIG_VIRTIO=m
    CONFIG_VIRTIO_BLK=m
    CONFIG_VIRTIO_NET=m
    CONFIG_VIRTIO_PCI=m
    CONFIG_VIRTIO_RING=m

    So, the CONFIG_LOCALVERSION_AUTO is not set, which solved the issue for another user,
    Thank you for your help,

    Johannes

    • I think you have to remove the CONFIG_LOCAL_VERSION as well.

      Due to the way the building process is setup you don’t have to do this. It will be appended.
      You can change this in General -> Local version – append to kernel release

      • Johannes

        Peter, thank you for your help

        The task I have to fulfill is compile Ubuntu from sources with local version to be extend by my firstname so it shows my firstname when using UNAME -R.
        Don’t know how many times I already tried, but always ended up with the same error (could not open … modules.alias) after 2 hours of compiling

        Thank you for any hints!

        • I know it’s going to be a pain but try compiling your own kernel without any changes made to the configuration and see what happens.

          So just start over and in the section Creating a new config don’t do debian/rules editconfigs

  • Jim A

    Thanks for the clear instructions. I followed them and may have found one preparation package that I needed in addition to what was listed. libnewt-dev seemed to be needed in what of the compile steps, but don’t know why.

    My questions is where in this process do you add in the source code of a missing driver and modify the config to reflect that addition?

    Jim A

    p.s. my system was a Core i5 Ubuntu 10.10 2.6.25-28 #49 before I started the rebuild.

    • If you want to add code and modify the config I suggest doing this in the section Getting ready for compilation right before We need to commit our changes in the git repository.

      • Jim Abernathy

        I have some 2.6.35 drivers for hardware not support in the Ubuntu 10.10 release. Can you point me to information that would help me integrate my drivers into the kernel not that I know how to rebuild it?

        Jim A

  • Carl

    Everything goes fine until skipabi=true skipmodule=true fakeroot debian/rules binary-nugs

    after 20 min or so of compiling i error out with

    rivers/staging/rtl8192su/built-in.o:/home/nuggie/kernel/source/drivers/staging/rtl8192su/r8192U_core.c:7599: first defined here
    make[4]: *** [drivers/staging/built-in.o] Error 1
    make[3]: *** [drivers/staging] Error 2
    make[3]: *** Waiting for unfinished jobs….
    CC drivers/xen/xenbus/xenbus_client.o
    LD drivers/xen/xenfs/built-in.o
    CC drivers/xen/cpu_hotplug.o
    CC drivers/xen/xenbus/xenbus_comms.o
    CC drivers/xen/balloon.o
    CC drivers/xen/xenbus/xenbus_xs.o
    CC drivers/xen/xenbus/xenbus_probe.o
    CC drivers/xen/sys-hypervisor.o
    LD drivers/xen/xenbus/xenbus.o
    LD drivers/xen/xenbus/built-in.o
    LD drivers/xen/built-in.o
    make[2]: *** [drivers] Error 2
    make[1]: *** [sub-make] Error 2
    make[1]: Leaving directory `/home/nuggie/kernel/source’
    make: *** [/home/nuggie/kernel/source/debian/stamps/stamp-build-nugs] Error 2

    any suggestions?

  • thanks for sharing this nice information i will follow this tips.

  • soreau

    A couple of things I’m wondering.. what does skipmodule=true do? Hopefully it doesn’t prevent modules from building as modules. Also, I tried this but when I do skipabi=true skipmodule=true fakeroot debian/rules binary-radeon-tv (I changed all instances of core2 to radeon-tv) I get the following at the end of the build:

    GEN .version
    CHK include/generated/compile.h
    LD .tmp_vmlinux1
    Killed
    make[2]: *** [.tmp_vmlinux1] Error 137
    make[1]: *** [sub-make] Error 2

    Any idea what went wrong?

  • soreau

    UPDATE: Turns out this error message was actually caused by the system running low on system ram, which was remedied by terminating firefox.

  • D0rk

    This page style stinks. Have you tried printing it? Why not include a printer friendly version that removes the incredibly narrow table width and the comments?

    • You can print using the PrinterFriendly option located in the Share/Save button.

  • Joe Goldthwaite

    Hi Peter,

    Thanks for putting these instructions together. I’m a beginner.

    I got to the step where you’re creating a new config. The command;

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

    gives me an error message;

    cp: target `updateconfigs’ is not a directory

    If I create an updateconfigs directory and try it again I get;

    cp: cannot stat `fakeroot’: No such file or directory
    cp: cannot stat `clean’: No such file or directory
    cp: warning: source file `debian/rules’ specified more than once

    I don’t see any fakeroot, clean or even debian/rules anywhere in source. There’s a debian/rules.d.

    I’m probably working at a lower level of knowledge than most of the people here but if you’ve got any idea as to what I’m doing wrong, I’d appreciate it.

  • Paul

    Thank you very much for this top-notch guide, with this I was able to create my own kernel with very little difficulty, which on my first attempt ever ran much smoother than the generic version I have been used to.

    Although for me a few commands don’t work, I was able to successfully create my own kernel without any problems whatsoever, the commands aren’t important, just something about enabling PAE, which, on a laptop that only has support for 2GB is a none-issue.
    I am currently making a second one as a few things needed changing in the first one, and I couldn’t figure out how to access the first attempt to modify it, so I’m starting afresh ๐Ÿ™‚

    The laptop feels much much snappier when using the modified kernel, but still has the same memory footprint of before, which I was kinda hoping it wouldn’t, but oh well, maybe I was expecting too much, or I had selected the wrong things, I dunno ^__^

    Again, thank you so much for perhaps the absolutely best guide to creating a custom kernel that exists, and that is even better than the documentation that Ubuntu provides themselves.

    I’ve been looking into making my own kernel for quite some time, and this is the only one that even comes close to making sense or actually working in the first place, everything else made better stereo instructions in Japanese than they did kernel compiling instructions. ๐Ÿ˜€

  • Vinay B

    I had the same issue as the other Vinay above, the last step of making binary-core2 gives a “No rule to make” error. Can you tell me if this has been resolved ?

  • sivan

    I accidentally have deleted /usr/src/linux directory so, my computer only works under safeX mode. Do these processes save my system?

    thanks in advice.

  • Vinay B

    Is there a missing step to update the debian/rules file with the new target ? I am unable to get rid of the No rule to make binary-core2 error.

  • Vinay B

    I found what the issue was – I was using the incorrect architecture folder. Mine happens to be a 64bit installation, I should have been making the above modifications in the amd64 directory instead of the i386 directory. The way you can figure out your architecture is uname -S command.

    Thanks, and sorry for the confusion.

  • Renjith

    I cant locate pakages using sudo apt-get install ‘xxxxx’

    It’s showing error like Unable to locate pacakage ‘xxxxx’

    • Peter

      Did you changed directory after the compilation is finished?
      The .deb files are placed in the parent directory of the directory you ran your compilation in.
      Example:
      /d1/kernel/source โ€“ holds the kernel source, where you run you compilation
      /d1/kernel โ€“ holds the .deb files.

  • nasir amin

    I have got an error You don’t have enough free space in /var/cache/apt/archives/.
    after running this command apt-get install libelf-dev libdw-dev asciidoc binutils-dev.
    Help me plz how can i fix it and can complete my kernal compilation….

    • Peter

      Free up more diskspace.

  • alan

    Dear Sir:

    I tried to follow your steps and work well until final step to have error “dpkg-gencontrol: error: Illegal package name `linux-image-3.2.0-23-ULinq’

    Do you tell me how to fix this condition in detail?

    Thank you!

    • Peter

      You can only use lowercase and numerics in the flavor name.