Ubuntu On OLPC XO: Difference between revisions

From OLPC
Jump to navigation Jump to search
Line 30: Line 30:
$ sudo dpkg -i bochsbios_2.3.5-1ubuntu1_all.deb</pre>
$ sudo dpkg -i bochsbios_2.3.5-1ubuntu1_all.deb</pre>


==Install Ubuntu onto your QEmu image==
==Boot from mini.iso using qemu-launcher and net-install of Ubuntu CLI==


*Disable snapshot mode (in qemu-launcher)
*Run qemu-launcher. In qemu-launcher:
**Disable "Snapshot mode" and enable "Use CD-ROM".

*The CD is the mini.iso image file
**In the "CD-ROM" field, select the mini.iso file you downloaded.
**For Hard Disk 0, click '''New''' and choose '''create a RAW disk image''' (at least 1.5 GB in size) in some location.

**On the Network tab, use '''1''' card. For "Card 0", select '''Use the user mode network stack''', remove any redirects, ignore the IP address, and use the MAC address of the network card that is currently connected to the internet (make sure letters are lower case!). You can get the MAC address by running <b>ifconfig</b> in a terminal.
*Create a RAW disk image (of at least 1.5 GB) and make that the first hard disk in qemu-launcher
**Click '''Launch''' to boot from your image.

*After QEmu boots the ISO, you'll see an Ubuntu grub splash. Type <tt>cli</tt> to proceed with CLI installation.
*In the network tab have one card (Card0) with User Mode Networking, remove any redirects, ignore IP address and use the MAC address of the network card that is currently connected to the internet (make sure letters are lower case!). You can get the MAC address from running <b>ifconfig</b> from a terminal
**You will then go through the text based Ubuntu install. It should find QEmu’s virtual network card and configure it. If not you will have to stop here, go back and fix QEmu's networking.

**Partition the the image manually with just one large partition formatted with the '''ext2''' filesystem, and with a mountpoint at "/" (root). Set the '''noatime''' flag and mark the partition as '''bootable'''. The label should be '''OLPCRoot''' (if you use a different label, be sure to change subsequent instructions accordingly). Ignore the suggestion for swap as it will only eat the flash card.
*When QEmu boots the ISO you will see an Ubuntu grub splash. Enter the option to install a CLI system.
**The netboot install will get all of the latest packages from the repository and install a complete x86 based OS (minus a GUI).

*You will then go through the text based Ubuntu install. It should find QEmu’s virtual network card and configure it. If not you will have to stop here, go back and fix QEmus networking.

*Partition the the image manually with just one large partition as ext2 filesystem, mountpoint as / (root) and set the <b>noatime</b>flag and set the <b>bootable</b> option as well. The label should be <b>OLPCRoot</b> (just for the sake of convention) Ignore the suggestion for swap as it will only eat the flash card.

*netboot install will get all of the latest packages from the repository and install a complete x86 based OS (minus a gui). C


==Boot From Image and Install sysvinit, Xorg, XFCE, etc. ==
==Boot From Image and Install sysvinit, Xorg, XFCE, etc. ==

Revision as of 23:07, 23 February 2008

This How-To was originally published on Free Like GNU blog by Francisco Athens

Disclaimer: I take no responsibility for trashing your flash drive, XO or your relationship with your S.O.

Requirements

  • You will need an SD card or USB flash drive of at least 2GB (1GB might work, it might be a very tight fit if you want a GUI plus apps)
  • For this to work you will need to have a dev key for your OLPC!
  • You should be comfortable messing with Ubuntu at the command line level. If you are in a Ubuntu or GNU/Linux User Group, you will have the best experience ;-)
  • PLEASE ask questions using the talk page tab, I am officially discouraging you from asking me questions about this tutorial in iRC ;-)

Install QEmu and the Ubuntu network installer

You probably don’t like to download a whole CD only to have to spend another hour waiting for updates to download after install. Get the mini.iso for Gutsy instead:

mini.iso (archive.ubuntu.org)

You will need QEmu to boot this ISO and also make sure it is set up for networking.

Assuming you are using Ubuntu to create your boot flash, install qemu

$ sudo apt-get install qemu qemu-launcher qemuctl

If you are using gutsy you may need to use a newer qemu bochs firmware to work properly:

$ wget http://archive.ubuntu.com/ubuntu/pool/universe/b/bochs/bochsbios_2.3.5-1ubuntu1_all.deb
$ sudo dpkg -i bochsbios_2.3.5-1ubuntu1_all.deb

Install Ubuntu onto your QEmu image

  • Run qemu-launcher. In qemu-launcher:
    • Disable "Snapshot mode" and enable "Use CD-ROM".
    • In the "CD-ROM" field, select the mini.iso file you downloaded.
    • For Hard Disk 0, click New and choose create a RAW disk image (at least 1.5 GB in size) in some location.
    • On the Network tab, use 1 card. For "Card 0", select Use the user mode network stack, remove any redirects, ignore the IP address, and use the MAC address of the network card that is currently connected to the internet (make sure letters are lower case!). You can get the MAC address by running ifconfig in a terminal.
    • Click Launch to boot from your image.
  • After QEmu boots the ISO, you'll see an Ubuntu grub splash. Type cli to proceed with CLI installation.
    • You will then go through the text based Ubuntu install. It should find QEmu’s virtual network card and configure it. If not you will have to stop here, go back and fix QEmu's networking.
    • Partition the the image manually with just one large partition formatted with the ext2 filesystem, and with a mountpoint at "/" (root). Set the noatime flag and mark the partition as bootable. The label should be OLPCRoot (if you use a different label, be sure to change subsequent instructions accordingly). Ignore the suggestion for swap as it will only eat the flash card.
    • The netboot install will get all of the latest packages from the repository and install a complete x86 based OS (minus a GUI).

Boot From Image and Install sysvinit, Xorg, XFCE, etc.

  • You will need to start QEmu again and boot from the new RAW image you just installed to so that you can install whatever else you need…
  • Start qemu-launcher and remove the mini.iso from the list. Set the boot option to your newly installed raw image. Be sure your networking is set as well.
  • Boot Ubuntu (ignore the ATA errors (its a harmless bug, really!) Install sysvinit. This is necessary because upstart will not work for us in the XO. (you would get a boot-stopping error message sortly after the kernel boots on the XO)

Thanks to Jeff Waugh for the tip:

<quote> < jdub> freelikegnu: upstart doesn’t like not being pid 1</quote>

$ sudo apt-get install sysvinit
  • if you want xorg and xfce4, now is a good time…
$ sudo apt-get install xfce4 xserver-xorg xfonts-base xfce4-terminal firefox
  • That will install a minimal XFCE desktop and firefox for the web. If you like gdm and don’t mind dependencies add it to the list above, otherwise you can use the command startxfce4 to get your GUI

you can search for all the tasty XFCE related packages with

$ apt-cache search xfce | more
  • There are other, more lightweight Desktop Environments like Fluxbox, but my heart is for the little mouse of the desert…
  • also be aware that some things you may be used to in ubuntu like fusefs may not work as these are not configured in the OLPC Kernel we will be using. You might have better luck with a Debian or custom kernel.
  • Also if you don't use the Debian xserver-xorg-video-amd drivers (mentioned later) you may not have accelerated 3D (or even very fast 2D) so avoid apps that need OpenGL. Audio, wireless and webcam seem to be functional enough tho.
  • once everything is setup and your qemu install of ubuntu is happy, shut it down
$ sudo halt

you can safely shutdown QEmu once the system is halted.

Move the Image to flash USB or SD

  • You will now need a USB flash drive or SD card at least as big as your virtual disk image. It will be wiped COMPLETELY!! Be sure that after you insert the drive that it is not mounted!
$ sudo dd if=<the path to your disk image> of=<device name e.g. /dev/sdb> bs=1M
$ sudo sync

this will do a nice raw write to your flash. Whatever space is left over you can add a handy extra partition with fdisk too!

  • IMPORTANT Reminder:

+Again after the above is done, make sure the drive is unmounted and remove it. Plug it again to check that all is well. If the drive does not have the right label, OLPCRoot, you can use tune2fs, just be sure to unmount it before doing so!

+find out where the drive is mounted:

$mount
$sudo umount /media/<name of mounted sd/usb flash>
  • assuming your flash is /dev/sdb and the mounted partition was from /dev/sdb1
$ sudo tune2fs /dev/sdb1 -L OLPCRoot

Get Boot Folder and Other Files from XO (Kernel and Modules) From XO

  • Plug your flash device into the XO, it should automount and you will now have access to the filesystem of that drive. If you are in XFCE on the XO you will find using a root file manager handy (but be careful!)
$ su
# thunar
  • if not you can do the following from the terminal in Sugar or TTY:
$ su
  • (assuming you labeled your flash drive OLPCRoot, I’m spreading the commands out for clarity, feel free to optimize, but be careful!)
# cp -ra /boot /media/OLPCRoot/
# cp -ra /lib/modules /media/OLPCRoot/lib/
# cp -ra /lib/firmware /media/OLPCRoot/lib/
# cp -ra /security /media/OLPCRoot/
  • make sure your develop.sig is in that security folder!
  • you should rename the /media/OLPCRoot/etc/modprobe.d to modprobe.old or similar
# cd /media/OLPCRoot/etc
# mv modprobe.d modprobe.old
  • Copy your olpc’s modprobe.d to the flash drive (this will load and blacklist the proper modules)
# cp -ra /etc/modprobe.d /media/OLPCRoot/etc/modprobe.d
  • rename the existing fstab to something like fstab.old
# mv fstab fstab.old
  • use the fstab from the olpc
# cp -ar /etc/fstab /media/OLPCRoot/etc/fstab
# wget http://dev.laptop.org/~cscott/xorg.conf -O /media/OLPCRoot/etc/xorg.conf
    • notice that it is not using the AMD xorg driver…
  • then rename (cause it will be handy for internal installs) and create a new olpc.fth in /media/OLPCRoot/boot/
# cd /media/OLPCRoot/boot
  1. mv olpc.fth olpc.fth.nand
  • use one of these olpc.fth files depending on how you want boot:
    • FOR USB BOOT see:

USB_Boot_olpc.fth

    • FOR SD BOOT:

SD_Boot_olpc.fth

  • Make sure that whatever you use is named olpc.fth. You should now be able to boot. Use the Rightmost game button to view the boot messages for debugging…

NETWORKING

  • if you have a WPA network try the following. Check to see if you have a wireless card:
$ iwconfig
  • assuming your wireless is eth1:
$ sudo wpa_passphrase <ESSID> <s3kr1t password> >> /etc/wpa_supplicant.conf
$ sudo wpa_supplicant -Dwext -ieth1 -c /etc/wpa_supplicant.conf -B
$ sudo dhclient eth1
  • If all goes well you can edit your /etc/network/interfaces and add the following under the eth1 entry (you can edit the existing eth0)
pre-up wpa_supplicant -ieth1 -Dwext -c /etc/wpasupplicant.conf -Bw
post-down killall wpa_supplicant
  • then restart networking (it should JustWork on next boot)
$ sudo /etc/init.d/networking restart

Accelerating Video with Modified Debian Drivers

  • There are modified xorg AMD video drivers that will give improved video playback performance and rudimentary (read: slow) openGL functionality. These drivers currently work only in OLPC XO hardware and not on other AMD graphic based computers!!
  • Holger Levsen has backported the xorg AMD drivers from Dilingers SID to ETCH and made a little repository for them. What this means for Ubuntu Gutsy on the XO is having snappy 2D acceleration (no, GLX gears still runs at about 60fps, and thats not likely to change much due to hardware abilities). Games like Frozen Bubble and playing Xvid videos will see a great improvement however! If you already have Gutsy setup on your XO, and are missing accelerated 2D read on:
  • Assuming you are in Ubuntu (with Xfce or some other DE) on your OLPC paste the following into a new file: /etc/apt/sources.list.d/layer-acht.list
deb http://layer-acht.org/debian etch olpc xorg
deb-src http://layer-acht.org/debian etch olpc xorg
  • then
$ sudo apt-get update
$ sudo apt-get install xserver-xorg-video-amd
  • It will remove a bunch of xorg packages, upgrade others and install Holger’s backported video driver.
  • You will then have to grab the OLPC’s original /etc/xorg.conf and add the mouse driver back in or use the Free Like GNU file:
$ cd /etc/X11
$ mv xorg.conf xorg.bak
$ wget http://www.freelikegnu.org/wp-content/uploads/2008/01/xorg.conf
 
  • if x is already running, restart x with ctrl-alt-erase

References:

Thanks to everyone for their help and advice!

TODO

  • Make Ubuntu Kernel, Modules and Video drivers packages instructions
  • XFCE hotkeys setup (should be on its own page)

See Also