Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm needing to custom compile a kernel to enable some very specific hardware features that are not on by default and have to be compiled in. I started following this guide but it seems to be slightly outdated for 12.04 onwards as some commands fail with missing source packages.

What is the easiest way to rebuild the current kernel source so I can tweak the options I need?

share|improve this question

These steps are very general and apply to every package in Ubuntu/Debian.

  1. This will download the source package and applies all Ubuntu patches.

    apt-get source linux-image-3.... # select the exact package you want
  2. Install all build dependencies.

    sudo apt-get build-dep linux-image-3...
  3. Enter the directory of the source.

    cd linux-... # change accordingly
  4. Do the changes to the source you need.

  5. After finishing the edits, add a new version to the changelog (else it's going to complain the source doesn't match):

    dch --local mysuffix
  6. Build it with unsigned changes file and unsigned source package (for local testing):

    debuild -uc -us

    This will take a while!

  7. Find the packages one level below:

    ls -al ../*.deb
  8. Install them like any other package.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.