User:Donaldaudric/Booting from USB Device

From OLPC
< User:Donaldaudric
Revision as of 15:22, 27 July 2011 by Donaldaudric (talk | contribs) (Part One: On your XO)
Jump to: navigation, search

This page explains how to boot from a USB device. You will need an XO-1 and a USB device of at least 1 GB.

Caveats

This process will remove all data from your XO and the USB device.
To my knowledge, this was only tested by me on build 10.1.3, and it does NOT work on build 10.1.2.
Your USB stick will be mostly formatted in EXT4, which is not a good format for FLASH storage such as USB sticks.
My method works only on XO-1s.

Part One: On your XO

This part will remove all data from your XO.

    1. Go to http://download.laptop.org/xo-1/os/official and
click on the build you want.
    2. Save os***.img.fs.zip onto the top directory of the USB device as fs.zip.
    3. Save os***.img onto the top directory of the thumb drive.
    4. Power off your XO.
    5. Hold down the game keys of your XO as you power it on.  Release the game keys when prompted to.
    6. The XO will show some text on the screen.  If all goes well, you should see blocks on the screen.  Wait
for the XO to prompt you for your name.
    7. If the XO says "Boot failed", the USB device may not have had enough time to initialize.  Power off,
then power on again with the game buttons pressed. This time, hold them for a few seconds after the message
appears. If your USB device has a light, wait until the light goes on before releasing the game
keys. If that does not work, then either the USB device was prepared incorrectly or your firmware is out
of date.

Part Two: The Thumb Drive

    1. Open a terminal either by opening terminal, activity or by doing ctrl-alt-group (the group key is the
one with three circles). Press enter. If you opened terminal activity, type

su
and press enter.

    2. Remove the partition table from the USB device:

dd if=/dev/zero of=/dev/sda bs=512 count=8

    3. Partition the USB device:

parted /dev/sda mkpart primary fat16 0 50MB ; parted /dev/sda mkpart primary ext2 50MB <size> ; parted /dev/sda set 1 boot on
where <size> is the size of your USB device

    4. Create filesystems on the USB devices:

mkdosfs /dev/sda1 ; mkfs.ext4 -L OLPCRoot /dev/sda2

    5. Mount your filesystems:

mkdir /mnt/USB1 /mnt/USB2
mount /dev/sda1 /mnt/USB1 ; mount /dev/sda2 /mnt/USB2

    6. Copy boot data onto the boot partition:

cp /boot /mnt/USB1

    7. Make all the empty OS directories on your other partition:

cd /mnt/USB2 ; mkdir boot bootpart home media mnt ofw opt proc srv sys

    8. Copy the OS to the thumb drive:

cp /bin . ; cp /dev . ; cp /etc . ; cp /lib . ; cp /sbin . ; cp /security . ; cp /tmp . ; cp /usr . ; cp /var . ; cp /versions .

    9. Edit the boot scripts:

rm /versions/boot/current/boot/olpc.fth ; nano /versions/boot/current/boot/olpc.fth

    10. Type:

\ OLPC boot script
" u:\boot\initrd.img" expand$ to ramdisk
" ro root=LABEL=OLPCRoot" expand$ to boot-file
" u:\boot\vmlinuz" expand$ to boot-device
boot

    11. Press ctrl-X and press y to save changes.
    12. Reboot your XO.

Contacting Me

If there is anything wrong with this, you can contact me. My information is at the bottom of my wiki page.