Eee Linux Kernel Hacking

With all my tools and components packed away until I move and get a new job, some of my focus is changing over to playing around with low-level software on two pieces of hardware that are stable and that I’m likely to have with me always — my laptop and my desktop.

My laptop, however, recently died and did so in a way that likely will require the attention of skilled technician to diagnose and repair.  I went though this sort of thing once before when my previous laptop had bad solder joints on the second RAM bay.  Generally speaking, the bench fee alone can be $100, and there’s no guarantee that it’ll get fixed.  So, I cashed in some Best Buy cards from Christmas and bought an Eee.  The general logic is that it’s a laptop that would let me do the basic things I need, including hunt for jobs, and it’d be a certain thing.  I must admit, too that the form factor is really nice, even if the keyboard is a bit small and laid out strangely.  I was also excited by the prospect of having a Linux-based laptop.  In the past, I’ve often found Linux fairly unstable on my computers, especially on my laptops.  Having a hardware platform assembled specifically to support Linux, however, was encouraging.

The first thing I wondered, though, was how hard it would be to get the kernel to compile.  As it turns out, it’s actually pretty easy to do, although there were some bumps and frustrations along the way.  There are some reasonable instructions over on the EEEUser Wiki, but I found that some clarification of these instructions was in order.

First, I think it’s a wise idea to get your kernel hacking environment set up BEFORE applying any of the automatic updates from Asus.  As of the writing of this article, none of the updates appear to be particularly necessary, and they also seem a bit broken, as apt-get keeps complaining about Picasa not being installed.  On top of that, one of the updates appears to install a very exotic version of glibc.  You’ve been warned.

Next, I strongly suggest that you install the development tools (gcc, etc) following the instructions that use the EEE SDK iso.  For my purposes, I purchased an SD card for my Eee and downloaded the iso onto it, then mounted the iso.  The instructions I’ve linked to tell you to add a line to your /etc/apt/sources.list file.  I do not, however, think it’s sufficient to add that line anywhere.  I recommend commenting out the other sources by prepending a # to each line, then adding the line that points to the packages in the mounted iso.  Once this is done, it’s pretty easy to get the build packages installed.

From there, downloading and building the kernel source from the instructions on the EeeUser Wiki was fairly straightforward.  It’s worth noting, however, that installing the build tools and the kernel source will take up enough storage that, on a 900A model like mine, you’ll have almost no space left on the disk.  Of course, there are great instructions out there on how to cut the fat from your RW partition, but I decided it’d be nicer to do all my kernel work off my SD card instead.  The reason for this is that the sectors on solid state storage will survive only so many writes, and compiling things definitely will involve doing a lot of writes.

The first problem I noticed with trying to get the kernel source on my SD card is that, even after I removed the SDK iso, my card seemed to lack any free space.  Since I was planning to just treat this as an extra mostly-permanent disc anyway, I went ahead and reformatted the SD card with the ext3 filesystem.  Then I had no trouble copying the kernel source over.

Unfortunately, this seemed to break the build, as make started returning this error to me:

`target pattern contains no `%’. Stop.’

Rummaging around online suggested that it might possibly be because make was processing a symbol with a colon in it.  That’s when it dawned on me that the culprit was the default mount point for the SD card: “/media/D:”.  Aha!  Making an extra mount point, in my case “/media/sdcard”, and mounting /dev/sdc1 (the SD card device) to this directory did the trick, and now I can build the kernel out of my SD card instead.

It’s worth noting that there are some mild limitations here.  The compiler and library are coming out of Asus’ SDK release, so you can’t necessarily pick and choose versions.  This also can limit the kernel versions that you can compile, and the instructions above basically give you the “canonical Eee kernel source”.  This is, however, very sufficient for my purposes, which include staying sharp on developing kernel modules and playing around with the driver code for the Eee.

And, of course, you can do your kernel hacking from pretty much anywhere, because the Eee is very small and light and it’s got a pretty good battery life.  I’ll have a VMWare machine set aside for my deeper diving and more serious work  This plucky little sub-notebook, though, is a perfect thing to kick around.

Leave a Comment