CRUX Linux 2.4 on OLPC XO-1

Edit: Unfortunately, the images originally included in this post are gone, because of hosting problems in late 2009. My apologies.

I’m still working out the kinks, but I managed to put Crux 2.4 on the XO last night, and I have a rudimentary Openbox 3.4.6 session working with the default kernel and wired net access, functional browser, file manager and image viewer, and so forth.

It still needs a lot of polishing — my X fonts are absolutely gigantic, and I need to test sound support and things like that — but it works fine, it’s speedy and to be honest, I like it a lot more than Sugar. I haven’t messed with the camera at all, or some of the other frills — so some of that stuff might not work.

It’s funny to me that this was easier with Crux than it was with Ubuntu; I don’t know how or why my Ubuntu attempts (two now) failed, but it’s possible that the core elements that I used in Crux, and the fact that there’s almost nothing in Crux to start with, made it work better.

If you want to try the same trick on your XO, here’s how I got mine started up. Most of these steps are in the Crux handbook and the Ubuntu system slingshot setup method on the OLPC wiki. I’d be thrilled if you have suggestions or tips on how to do this better.

First, I wanted to make sure the kernel I compiled in Crux was going to work on the XO, so I stole the .config-* file out of a pure Sugar installation (version 653, with no updates applied) and transplanted it onto the Crux 2.4 i686 ISO.

That might seem a bit heavy-handed, but it was the easiest way for me. I don’t have net access on a default Crux ISO on my zv6000, which needs the 8139too module for wired access. That wouldn’t be an issue except I was using qemu as the emulator, and I didn’t want to fiddle with trying to mount drives or find extra files just to get that .config file onto the emulated machine.

So in the end, it was quicker to use ISOMaster, implant the .config onto the ISO, and start up the emulator normally. Once I mounted the emulated drive and started the installation process, I just copied the .config out of the root directory and into the chrooted, emulated system.

After that I used make oldconfig to hopefully pick up some of the settings and modules that the original kernel uses, and then make menuconfig to carve out more of the stuff that I didn’t think it needed. I went almost strictly by the information I got from the tech specs on the XO, the standing .config, dmesg and lspci -vvv — all from the live Sugar environment.

(It was actually quite convenient to run an emulator right next to the machine I wanted to install. I’ll have to remember that trick for other systems. 🙂 )

No doubt it’s far from perfect, but there were a lot of default kernel settings that were still being applied in the original .config, and in the interest of speed and size, I took out a lot. I want to test my version further before I share it, but when I have a fairly trustworthy .config file I’ll post it here for future reference, for me and others.

It would be nice to compile more software on my AMD64, but the problem is that once the system is installed in the emulator, the image won’t boot any more. The kernel for the XO, as you might expect, doesn’t like the AMD64, and so the emulator stops with a kernel mismatch error. It might be possible to get around that with a different emulator — qemu’s settings don’t have an “AMD Geode” option, but it’s not that big a deal.

I should note that I set the Marvell chipset for the wireless adapter, but I don’t use wireless so I don’t have any real suggestion if you want that for your network. My Buffalo USB-to-LAN connection used the ASIX usbnet module, as well as the generic megabit options in menuconfig … like I said, once I trust this system a little more, I’ll post the .config file and you can see for yourself.

After that, it was strictly a Crux setup, with make all, make modules_install and setting up the system as if it were an XO. Then I stopped the emulator and dd‘d the USB image to a flash drive.

Then I pretty much followed the OLPC wiki for installing Ubuntu. Since my kernel omitted a lot of the modules from the default system, I didn’t bother copying off the modules from the kernel. In short, I did these things:

cp -rav /media/OLPCRoot/boot /media/OLPCRoot/boot-bkp

That was really just a precaution, since I wanted to keep the entire Crux boot folder pristine, for future reference. Now splice in the Sugar boot files.

cp -ra /boot /media/OLPCRoot/

Add the firmware folders.

cp -ra /lib/firmware /media/OLPCRoot/lib/

Copy the developer’s key — you have to have a developer’s key to do this.

cp -ra /security /media/OLPCRoot/

Use Sugar’s fstab.

mv /media/OLPCRoot/etc/fstab /media/OLPCRoot/etc/fstab.old
cp -ar /etc/fstab /media/OLPCRoot/etc/fstab

Finally, shift the NAND .fth file and create the USB version offered on the wiki.

mv /media/OLPCRoot/boot/olpc.fth /media/OLPCRoot/boot/olpc.fth.nand

I’m a little lukewarm on the whole splicing-system-files thing. As I get better at this, I’ll try to figure out what’s really necessary in those steps, and what’s not. My fear is that kernel updates or other improvements to a standing system will somehow miss out on those files, and then the whole system will crumble. I can be a worrywart at times. 😉

But that was about it. Crux’s first boot is very, very slow — something I learned with the ugly little laptop — so be patient. And after that first boot, it’s much more lively. I get a startup time of about 36 seconds between the snap to the console to the login prompt. It’s not as fast as I’d like (I was hoping for another 25-second wonderboy) but it’s a huge improvement over the 2+ minutes Sugar needs.

I haven’t had much of a chance to work with X yet (I did this all very late last night), but I was getting a lot of crashes and kernel panics with the default xorg-xf86-driver-amd (version 2.7.7.0, I believe) that comes with the default 2.4 ISO.

Recompiling the 2.7.7.6 version off the Xf86 site seems much more stable. I was crashing every time I used the touchpad at first; now my XO has been up and running for about an hour without a problem.

I’m also using the suggested xorg.conf from the wiki, but like I just said, I switched back to the amd driver, rather than fbdev.

By the way, don’t forget to change your /etc/pkgmk.conf file immediately on starting the new system, because the default Crux settings are for an i686 — some of the software you compile might not run. Use the CFLAGS from the Gentoo wiki — which, ironically, are identical to the settings for my ugly old laptop, with the exception of the -Os setting.

My to-do list is basically a kernel update, plus enough ancillary software to make it functional. I might hijack someone’s wired connection just to get my ports updated — solving dependencies manually without rsync is a nightmare for me.

I might also try to move the USB to the NAND, although that could be a catastrophe. I’d just prefer it went straight to Crux on boot, rather than having to hold down the right game key to get a console start, and wait for the USB drive to run.

That’s about it. As I have more information, I’ll add it. 😀

4 thoughts on “CRUX Linux 2.4 on OLPC XO-1

  1. Pingback: Boycott Novell » Links 04/02/2008: OLPC Award, Red Hat in Asia, Linux.conf.au Summed Up

  2. Pingback: An amazing little audio player « Motho ke motho ka botho

  3. Pingback: Farewell, OLPC XO-1 « Motho ke motho ka botho

  4. Pingback: Project #23, Build a crux linux 2.5 iso on Crunchbang | Rage Against The Status Quo

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s