Thursday, January 14, 2010

Building a Custom Ubuntu Linux Kernel on a Dell Latitude E6400

I am now running on a custom build of the 2.6.31.6 kernel. I haven’t made any source mods yet, but I am now armed and dangerous. This post will cover what I had to go through.

More or less, I had a smooth experience aside from one bug. I will try and recap what I did. I didn’t take notes, so this list comes from looking back over the reference guides. There may be some things missing, sorry.

1. Found a few good references

2. Download the source

  • I used Synaptic to get a source archive instead of going with Git
  • I grabbed linux-source-2.6.31

3. Unpack the source into ~/dev/linux-source-2.6.31

  • cp /usr/src/linux-source02.6.31.tar.bz2 ~/dev
  • cd ~/dev
  • tar xjf linux-source02.6.31.tar.bz2

4. Grab a whole mess of dev stuff

  • sudo apt-get install fakeroot kernel-wedge build-essential makedumpfile
  • sudo apt-get build-dep linux
  • I didn’t take good notes, but I remember having to grab more things. You’re on your own, kid.

5. Create a kernel config file using the current as a base

  • cp /boot/config-[whatever] ~/.config

6. Run menuconfig

  • cd ~/dev/linuxwhatever
  • make menuconfig
  • Note the instruction on turning off “Kernel hacking” –> “Compile the kernel with debug info”

7. Gets me some compiler go fast

  • export CONCURRENCY_LEVEL=3

8. Compile, and then wait

  • fakeroot make-kpkg --initrd --append-to-version=-plaird kernel-image kernel-headers
  • Be sure to replace plaird with something meaningful to you
  • This took about 30 minutes for me
  • It puts two .deb files into the parent directory (~/dev)

9. Install the kernel, unsuccessfully

  • sudo dpkg -i linux-image-xxx_i386.deb
  • sudo dpkg -i linux-headers-xxx_i386.deb

This should have worked, but there currently is a weird bug in dkms that affects folks with nvidia graphic cards:

run-parts: /etc/kernel/postinst.d/nvidia-common exited with return code 20

10. Find fix for Bug #292606

It turns out this bug is known, and there is a fix. Since it took the devs a while to figure out the solution, there were some dead ends before I found the right fix.

  • sudo gedit /etc/kernel/postinst.d/kernel_postinst.d_dkms
  • add ‘> /dev/null’ after ‘start dkms_autoinstaller KERNEL=$inst_kern’

11. Install the kernel, successfully

Rerun step 9.

12. Make sure /boot/grub/menu.lst has an entry for your new kernel

  • The install process might have already done this if you haven’t manually modified menu.lst (I had)

13. Reboot and enjoy

  • Armed and dangerous.

No comments:

Post a Comment