Ubuntu Precise On OLPC XO

From OLPC
Jump to: navigation, search

Introduction

This guide describes how to install Ubuntu 12.04 LTS (Precise Pangolin) on the OLPC XO-1 or XO-1.5. 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.

Warning: The XO-1.75 is arm-based, so for it this will not work unless you manage to install an arm-ubuntu within a virtual-emulator.

Warning: The XO-1.5 has a different graphics card, so the X-Server and everything graphicky I did not manage to get to work.

This guide tries to be an up-to-date copy of Ubuntu Lucid on OLPC XO, because Ubuntu Precise is in spanish and Ubuntu Gutsy On OLPC XO is heavily out of date.

Requirements


Things known to work

  • XO-1.5: Audio works perfect
  • XO-1.5: WLAN works perfectly using wpasupplicant and dhclient on the console (NetworkManager should work, too, then)
  • XO-1.5: keyboard: fn key works, F* keys unclear

Known issues

  • Graphics do not work on the XO-1.5. XO-Sugar uses "xf86-video-chrome", which I did not manage to compile within ubuntu. Ubuntus "openchrome" driver gives a white screen.
  • TODO: unchecked copy Hardware buttons (around the screen as well as the funky F1-F12 buttons on the XO) are not mapped. The F* buttons should be easy to map with the "Keyboard shortcuts" tool in Gnome's Preferences menu. The directional pad/rotate button/game buttons are slightly trickier, but I believe instructions exist somewhere in this wiki.

Installing Ubuntu on the USB/SD drive

The following is all done on the computer with the virtualization software.

  • You need to have permissions to access your USB flashdrive/SD card as a normal user:
$ sudo usermod -a -G disk <your username>

Now log out, and log back in for this to take effect.

  • Ubuntu likes to automount things. Thus, first make sure your USB flashdrive/SD card is unmounted:
$ sudo umount /dev/sdX

...where sdX is your USB/SD drive.

  • If you are using VirtualBox, add your USB flashdrive or SD card as a virtual hard drive that we can install Ubuntu onto.
$ cd ~/.VirtualBox/HardDisks
$ VBoxManage internalcommands createrawvmdk -filename olpc-xo.vmdk -rawdisk /dev/sdX -register
  • With Qemu, the commandline option "-hda /dev/sdX" should do the trick.
  • Install Ubuntu as you normally would onto the USB/SD drive.

If you need guidance on how to operate your virtualization software or how to 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 Ext2 (Discussion: I believe no journalling should be better on USB/SD, thus ext2, not ext3 or ext4). Do not use the default setting of Ext4.
Also, do not create a swap partition. Flash drives die prematurely from the wear & tear of swapping.

When the installation is complete, you will boot into your new system for the first time in the virtual machine. This is a good time to install the latest and greatest packages and updates:

$ sudo apt-get update
$ sudo apt-get upgrade

Adapting Ubuntu to the XO

The following is done while you're still in the virtual machine.

You might want to install a desktop, e.g. kubuntu-desktop, ubuntu-desktop, xubuntu-desktop, or lubuntu-desktop. They give you the different distribution variants. I listed them in the order I believe take from more to fewer ressources.

Since ubuntu-netbook is gone in favour of unity and unity will be only 3D, you will have to revert to a desktop less graphic intensive. I went for xubuntu-desktop, not installing all recommendations.

$ sudo apt-get install -R xubuntu-desktop

Replacing the kernel with the XO-kernel

The most important fix, however, is to replace the Linux kernel. For some reason, the stock Ubuntu kernel doesn't work on the XO. (It crashes in my case.)

Make sure to get the binary package, and not the source. Example: http://dev.laptop.org/~kernels/public_rpms/f17-xo1.5/kernel-3.3.8_xo1.5-20120822.1309.olpc.1ce9500.i586.rpm

If you're using a more recent version than this one, make sure to change all references to it accordingly in the commands below.

$ sudo apt-get install rpm2cpio
$ cd /

TODO: unchecked copy

$ sudo sh -c "rpm2cpio /home/user/Downloads/kernel-3.3.8_xo1.5-20120822.1309.olpc.1ce9500.i586.rpm | cpio -idmv"
$ sudo depmod 
  • If firmware security is enabled on your XO (it most likely is), you will need a developer key in order to boot anything but the stock Fedora/Sugar OS. Once you have your key, create a folder: "sudo mkdir /security", and save your develop.sig file there.

The last step is to create the Forth script that tells Open Firmware how to boot our system. Save the following as /boot/olpc.fth:

\ Open Firmware boot script for Ubuntu
" sd:\boot\initrd.img-xo" to ramdisk
dcon-unfreeze
boot sd:\boot\vmlinuz-2.6.31_xo1-20100504.1635.1.olpc.7223ce6 ro root=LABEL=OLPCRoot rootdelay=30

This script is for booting from an SD card; if you use a USB drive, replace sd with u.

  • Now, shut down your virtual machine. It will soon be time to try out our creation on the XO!

Attention: You might have noticed that the root partition is referenced by its label in the boot script above. Thus, in order for the Linux kernel to find it, you need to give it the right label at this point:

$ sudo tune2fs /dev/sdX1 -L OLPCRoot

Good luck!

Plug your USB drive or SD card into the XO and boot it up - with any luck, it might work! :]

Just one more thing: it'd be awfully nice if you leave a comment on the Discussion tab above. Just tell us whether it all went smoothly, or if something needs to be worked on. Thanks for contributing!

Since this page is based on Ubuntu Lucid on OLPC XO, the authorship belongs mainly to the authors of that page.