Compiling and installing a vanilla custom kernel.org kernel on ubuntu like a normal human being

March 21, 2011
S(kip to the good part)

So I’ve got ubuntu 9.04 (karmic koala) on my laptop, and I decided I’d try installing a custom kernel from kernel.org. I do this all the time at work, so it’s not a big deal, or so I think.

I downloaded 2.6.38 from kernel.org, and unpack it. I think, well, if it’s not too much trouble to find, I’ll start off with the ubuntu config file from my running kernel. Look in /proc for config.gz. It’s not there (SuSE has the config file compiled into the kernel, so you can’t lose it, and can’t get the wrong one. Nice. Don’t know why more distros don’t do that.) Then I decide my laptop is slow enough that I’d better customize the hell out of the config file anyway just to throw out the 90% of drivers for which my laptop has no corresponding hardware. So, I run “make menuconfig” and start tossing stuff out. This takes about half an hour, I guess. Then compile the kernel. That takes two hours. Wow my laptop is old and slow, I guess (kernel.org kernel with a full RHEL6 .config file takes maybe 15 minutes or so to compile on the 8 CPU HP DL380g7 I have at work. Might be getting time to get a new laptop.) Then “make modules_install” and “make install”.

I happen to notice it didn’t make any initrd image. Hmmm.

Start digging around on the net to try to figure out how to install a kernel.org kernel on ubuntu and run into all kinds of bullshit about fakeroot this, and debian package that… Barf. I just want to install my kernel.org kernel like a normal human being. Which is to say, I want to do:

make
sudo su
make modules_install
make install

On Redhat or SuSE, that’d be all there was to it.


Thrash around a bit, and finally find the magic incantation for Ubuntu:

make
sudo su
make modules_install
make install
update-initramfs -c 2.6.38
update-grub

Update-initramfs makes a new initrd image, despite the name of the command.

No telling how long this information will remain accurate. I think Ubuntu doesn’t really like you installing a kernel that you compiled yourself. Check out this thread on ubuntuforums.org which ends:

You are talking about using an unsupported kernel on Ubuntu, and this is clearly a violation of the terms of service and is punishable under court of law. If you engage in this activity I will have to report this activity to a moderator.

LOL WUT?

~ by scaryreasoner on March 22, 2011.

4 Responses to “Compiling and installing a vanilla custom kernel.org kernel on ubuntu like a normal human being”

  1. I read your short thread at the Ubuntu forum. Unless your derived work is distributed with commercial intent, you are well within your rights to tinker with the kernel. Ubuntu only cares about trademark issues related to Ubuntu and Canonical. They don’t want “inferior” variants ruining their brand. I have modified/installed upstream unpatched kernels on my Ubuntu laptop. I saw no benefit but it did introduce some very minor issues with gnome desktop behaviour. I may revisit this when Winter rolls around again but for now the standard issue Ubuntu will do.

    • Yeah, I know. My job involves working on linux drivers for a large company, so I’m pretty familiar with the licensing issues, etc. and since I’m working on drivers for the upstream kernel, obviously I need to compile and test with the upstream kernel.

      And just to be clear, that wasn’t my thread, it was just something I found while googling around trying to figure out how to do what I was trying to do, and I thought it was pretty funny, hence the “LOL WUT?” at the end.

      Maybe I shouldn’t have said, “… Ubuntu doesn’t like …” though to some extent it’s true, in as much as pretty much all distros don’t like you doing that for reasons having to do with support.

  2. Good work,..simple and precise. I am boggling around these fakeroot, and not finding this mkinitrd problem since morning, ending up doing quite a bit of research on it 😛 .
    Wish if I would have been come across this blog before, I could have saved my day .

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: