Ubuntu Lucid on OLPC XO

From OLPC
Revision as of 16:50, 7 April 2010 by 71.98.58.74 (talk)
Jump to: navigation, search

Introduction

This guide describes how to install Ubuntu Lucid (10.04) on the OLPC XO. At the time of writing, Lucid is still in the development phase, but will soon be released in a stable version. The method of installing Ubuntu described herein is aimed at power users who know what they're doing and know what they want - but plain old folks are welcome to give it a try, of course. This guide solves the problem that earlier methods had with Upstart, so we won't have to take a step backwards to sysvinit.

Requirements

You will need a USB flashdrive or an SD card big enough to fit the Ubuntu system, 4 GB should work. You will also need a computer other than the XO, to create the Ubuntu system on. We will be using a virtualisation software on this computer to create the Ubuntu image which will be written to the flashdrive/SD card. I will be using an Ubuntu system (surprise!) with VirtualBox. Qemu should work too.

Creating the Ubuntu Image

Create a disk image in VirtualBox or Qemu, slightly smaller than your destination flashdrive/SD card. Then continue with installing Ubuntu Lucid as you normally would. If you need guidance on how to operate your virtualisation software or install Ubuntu in it, please look elsewhere - the Internet has plenty of guides on that.

Attention: Make sure to use the manual partition editor during the installation, and format the root partition as Ext3. Do not use the default setting of Ext4, as it is not yet supported by the OpenFirmware bootloader in the XO.

After installing Ubuntu and running "sudo apt-get upgrade" to install the latest packages, you might want to install the "Netbook Remix" packages. They give Ubuntu a new desktop interface optimized for netbooks, which works nicely on the XO's small display. To do so, run "sudo apt-get install ubuntu-netbook".

Writing image to the drive

Shut down your virtual Ubuntu machine. Now convert your virtual disk image to a raw format that can be written to your flashdrive/SD card. If you are using VirtualBox, the command to do this is:

$ VBoxManage internalcommands converttoraw <vbox-image>.vdi ubuntu-image.raw

If you are using Qemu or something else, you're on your own to figure out how to do this.

Now write the image to your flashdrive/SD card:

$ dd if=ubuntu-image.raw of=/dev/sdX bs=1M

...where sdX is your drive (do not include partition number - use e.g. sda instead of sda1) This will apply the partition table created with the Ubuntu installer - and needless to say, all data on the drive will vanish. Now, the root partition on the drive has to be renamed in order for the bootloader to find it:

$ sudo tune2fs /dev/sdb1 -L OLPCRoot

Making Ubuntu bootable on the XO

The XO uses OpenFirmware as its "BIOS" and bootloader (the GRUB bootloader in your new Ubuntu system will not be used), and we need to add a couple of files that tell OpenFirmware what to do. First, your XO probably has firmware security enabled. When this is the case, you need a developer key in order to make it boot anything but the original XO system on the builtin NAND drive. Secondly, we need a bootloader script file that tells OpenFirmware how to boot our system.

After writing the image to your drive in the previous step, unplug your drive and plug it back in, and most linux distros will automatically mount your drive again to give you access to the ubuntu root partition. Create a folder called "security" in the root, and save your developer key there, with the filename "develop.sig". Now, in the boot folder, create a file named olpc.fth. This is a Forth script for controlling the OpenFirmware bootloader.

For USB drives, use this script:

" root=LABEL=OLPCRoot ro quiet splash" to boot-file
" disk:\vmlinuz" to boot-device
" disk:\initrd.img" to ramdisk
unfreeze
boot

If you are using an SD card, use the following script:

" root=mmcblk0p1 ro quiet splash" to boot-file
" sd:\vmlinuz" to boot-device
" sd:\initrd.img" to ramdisk
unfreeze
boot