3

I'm trying to build my own kernel, as I want to write a kernel program which I need to compile into the kernel. So what did I do? Download from kernel.org, extract, do the make menuconfig and configure everything as needed, do a make, do a make modules_install, do a make install and finally do a update-grub. Result: It doesn't boot at all....

Now I had a look here and it describes a different way of compiling a kernel. Could this be the reason whz my way did not work? Or does anyone else have an idea why my kernel doesn't work?

######## Edit

Great answer, ty. Oli. But I tried it the old fashioned way, and after one hour of compiling I got this message:

install -p    -o root -g root  -m  644 ./debian/templates.master /usr/src/linux-2.6.37.3/debian/linux-image-2.6.37.3meinsmeins/DEBIAN/templates
dpkg-gencontrol -DArchitecture=i386 -isp         \
        -plinux-image-2.6.37.3meinsmeins -P/usr/src/linux-2.6.37.3/debian/linux-image-2.6.37.3meinsmeins/
dpkg-gencontrol: error: package linux-image-2.6.37.3meinsmeins not in control info
make[2]: *** [debian/stamp/binary/linux-image-2.6.37.3meinsmeins] Error 255
make[2]: Leaving directory `/usr/src/linux-2.6.37.3'
make[1]: *** [debian/stamp/binary/pre-linux-image-2.6.37.3meinsmeins] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.37.3'
make: *** [kernel-image] Error 2

2 Answers2

7

A few pointers based on what you've said:

  • Use make-kpkg! You really don't want to mess around with make install for a kernel. Kernels are fairly huge things you want them in packages where you can quickly go "get rid of this please!" with a quick "apt-get remove".

  • The "old fashioned way" as described in the Kernel/Compile document is the single best way I know how to compile kernels on Ubuntu with random (non-Ubuntu-specific) sources like Kernel.org.

  • Skip the make localmodconfig step. It can be useful but more times than not, it just seems to break things (for me).

  • I wouldn't suggest you configure the entire kernel by yourself. Pull in the latest copy of the Ubuntu configuration and base off that. That will get you a good sane default that you can prune down. When you build the next version just pull the config forward and do a make oldconfig to see if there are any new options (common when jumping between major versions).

  • If you're building 2.6.38 on Maverick, I suggest you pull back Natty's config. You'll need to download the package from packages.ubuntu.com and extract the config file from its boot folder. I've already asked if there's an easier way of doing this, but there doesn't appear to be.

In short: Just follow the "old fashioned way" to the letter. Once you've built yourself a few packages and you know what you're doing, play around with the formula.

Oli
  • 293,335
  • Ty :) I'll probably try it again from scratch following this tut. See my edit above :) –  Mar 15 '11 at 13:03
0

Compilig kernel in ubuntu is really easy. I used the alternate build method a few weeks back, and it worked perfectly. I think you should try that method because it does several things automatically for you, meaning less things that can be screwed up.

However, the method you describe should also work in general, so chances are that you perhaps followed an outdated guide or did something wrong.

apoorv020
  • 1,014