A few months back Dave Tulloh let me borrow his XO (one laptop per child machine). It’s pretty sweet and a nice little unit, but I couldn’t use the UI for everyday stuff. So, I decided to build a custom Gentoo system for it – yes, of course optimised for the geode cpu.
What I did is not exactly ground breaking. I didn’t discover anything or work it out, all I did was make a Gentoo system and boot it from a USB memory key. I even cheated and used their kernel and initramfs 🙂 Tisk, tisk! But hey, someone out there might find it interesting.
The goal was to build as small a system as possible, with XFCE4, Firefox, other main applications and multimedia capabilities. Here’s what I did.
I began in the usual fashion by building a Gentoo install within a directory on my main machine. Toolchain consisted of gcc 4.3.1, glibc 2.7-r2, binutils 126.96.36.199.7 and /usr/portage/profiles/default/linux/x86/2008.0 as my profile.
I wanted to take out as many useflags as possible and include only those to give me support for what I wanted (well that’s nothing new I guess). Here is the make.conf that I used:
CFLAGS=”-Os -march=geode -pipe -fomit-frame-pointer”
LDFLAGS=”-Wl,-O1 -Wl,–sort-common -Wl,–as-needed -Wl,–hash-style=gnu”
LINGUAS=”en_AU en_GB en_US”
INPUT_DEVICES=”evdev keyboard mouse”
FEATURES=”buildpkg sandbox usersandbox distfiles parallel-fetch fixpackages”
USE=”3dnow 3dnowext a52 aac -acl acpi alsa -amd64 automount avahi bash-completion -berkdb bindist cpudetection -cups custom-cflags dbus dri dts ffmpeg gcc4 -gnome -gpm gtk gtk2 hal -iconv -ieee1394 -ipv6 -isdnlog -kde libnotify -midi -networkmanager nls nptl nptlonly -minimal mmx mmx2 mmxext mp3 ogg opengl -openmp png -pppd -qt -qt4 real -reflection -spl spell startup-notification theora threads tk truetype unicode userlocales vidix vorbis win32codecs x264 X -xulrunner xvid”
Next it was time to build the base system as per usual Gentoo style. As I had heavily modified the profile, I could remove quite a few built-in apps. Before I was done though, I had to set a root password and edit the fstab like so:
/dev/sda1 / ext2 noatime 0 1
shm /dev/shm tmpfs nodev,nosuid,noexec 0 0
Once I had a base system built I copied it across to a USB key that had a single Linux partition, formatted ext2.
In order to let the XO boot a system other than the default, you need developer keys. Once you have registered and aquired them, copy them from your XO onto to the root of the USB key. I also cheated and just used their initramfs and kernel, so I copied /boot and /lib/modules/2.6.22-20080211.1.olpc.9f4e619336a08dc from the XO onto the stick too.
Now, all that remained was to boot the system 🙂
Booting is really easy. Just plug in the USB key to the side of the XO, turn it on and hold down the ‘tick’ button until you see the boot screen come up. It should automatically start booting the USB key.
From here, the kernel and initramfs should do their thing and Gentoo should start booting! Boot time takes 1 minute 15 seconds, compared to the 1min 25 seconds for the native system – not really much difference there (probably mostly down to using their kernel and initramfs, the fact that I’m using a USB stick instead of MTD and ext instead of jffs2 – in other words, don’t read much into that, but it’s nice to know how long it takes to boot).
Well, I must say it was a fun little project and I am pretty happy with the overall result. The system is slow, but completely usable. It’s nice having firefox, even if it does take 35 seconds to start 🙂 It would make an awesome little notebook to take into lectures or on the bus, I reckon. In this screenshot you can see firefox open, pidgin connected and it’s playing an xvid movie.
I did have an issue with the trackpad button, it seems to sort-of double click when you press and hold it down. This made moving windows and the like impossible. I’m sure there’s an updated driver or special configuration for that somewhere which could fix it, but instead I just used a USB mouse when required.
Anyway, if anyone wants a tarball of the system, let me know. I’m happy to put it online somewhere.