User:NeoAmsterdam/Installing build 8.0.2 to a bootable SD card
Jump to navigation
Jump to search
This document will explain how to make a bootable SD card for use with your XO (and then abuse your newfound storage capacity).
Read Me First
Warnings
- This procedure will erase and overwrite everything stored on the XO and the SD card. Back up your data!
- Do not execute this procedure on battery power. Any power interruption could lead render your XO irrecoverable.
- This procedure requires the use of fdisk for partitioning. Do not attempt this procedure if you are a Linux novice.
- Execute this procedure at your own risk. I will provide clarifications and explanations if requested, but I will not provide tech-support-style help.
Caveats
- The SD card will be formatted as an ext3 filesystem. This is not an ideal filesystem for SD cards.
- This document assumes you already have a developer key.
- This document assumes that fdisk automatically recognizes the starting and ending cylinders for the SD card.
- The XO may not boot automatically from the SD card if devices are plugged in to the USB slots (I have no idea why this may be).
Notes
- This document assumes that the USB drive is already formatted as a vfat/ms-dos file system.
- All the instructions on this page are verbose. Even though it takes longer, it'll allow you to keep tabs on the XO's progress.
- Children should get permission from a parent, guardian, teacher, and/or Linux guru before attempting this procedure.
Adult supervision is not required, but is highly recommended.
Requirements
- An XO
Obviously. - A USB drive
512 MB is barely large enough, 1 GB will do nicely. - An SD card
512 MB is barely large enough, 1 GB will do, but larger will always be better. - A developer's key
The instructions for obtaining a developer's key can be found here. - Internet connectivity
You will need to download two files.
Optional
- You will probably want to use a second computer to download two required files and to back up the XO's data.
The Procedure
Safeguarding Your Data
- Plug in the USB drive, insert the SD card.
- Backup your data by copying files/activities to your USB drive.
- Drop into the the console.
Press ◆ ctrl + ◇ alt + f1 to enter the console, then press enter to log in as root. - Determine the USB drive's mount point.
mount will output a series of mounted devices. Look for something like /dev/sda1 on /media/USB type vfat: make note of the mount point (/media/USB in this example). - Copy the developer key to the USB drive.
mkdir -pv /media/USB/security ; cp -v /security/develop.sig /media/USB/security - Return to the graphical environment.
Press ◆ ctrl + ◇ alt + f3. - Enter the Journal and unmount the USB key.
Unmounting is explained here - Unplug the USB drive.
Acquiring the Software
The directions in this section assume that you're using a second computer.
- Backup your data by copying files/activities from your USB drive.
- Download fs.zip and os802.img to your USB drive.
You should now have fs.zip, os802.img, and a folder called security which contains develop.sig on the USB drive. - Eject the USB drive.
The remainder of this document assumes that you're using the XO.
Preparing for Installation
- Drop into the the console.
- Stop Sugar and the automounting daemon by lowering the runlevel.
/sbin/init 3 - Determine mounted devices
mount will list all the mounted devices.
If you see /dev/mmcblk0p1 mentioned, run umount /dev/mmcblk0p1.
If the XO responds with the device is busy error message, try cd / ; umount /dev/mmcblk0p1.
If the device still can't be unmounted, stop what you're doing - you cannot proceed any further. - Quick-format the SD card
dd if=/dev/zero of=/dev/mmcblk0 bs=512 count=8 - Paritition the SD card.Note to Self:
137 heads,
39 sectors,
5873 cylinders
fdisk /dev/mmcblk0
You will now be running fdisk interactively. Create a new primary partition that runs the length of the drive, flag it as bootable, make sure it's type 83 (Linux), and write the changes. - Format the SD card
mkfs.ext3 -L "OLPC-SD" /dev/mmcblk0p1 - Turn off the XO
shutdown -h now
Installing the OS
- With the XO powered off, plug in the USB drive.
- Hold down all four game keys (╳, ✓, ○, and ◻) while your power on the XO.
Do note release the four game keys until you see "Release the game keys to continue" at the top of the screen.
Once you release the game keys, the XO will begin installing the OS to the NAND. - Wait.
- I recommend setting up a fresh pot of coffee during this intermission. By the time you turn on the coffee machine, the XO will present you with the registration screen.
- Drop into the the console.
◆ ctrl + ◇ alt + f1. - Mount the USB drive.
mkdir /mnt/USB ; mount -t vfat /dev/sda1 /mnt/USB - Mount the SD card.
mkdir /mnt/SD ; mount -t ext3 /dev/mmcblk0p1 /mnt/SD - Copy the developer key from the USB drive to the SD card.
cp -rv /mnt/USB/security /mnt/SD - Copy the OS from the NAND to the SD card.
cp -prv /versions/pristine/802 /mnt/SD - Wait.
- Remember that fresh pot of coffee you set up a short while ago? Now is the time to pour yourself a cup. By the time you're halfway through the coffee, the XO will be ready for you.
- Create the olpc user's home directory.
mkdir -pv /mnt/SD/home/olpc ; chown -rv olpc:olpc /mnt/SD/home/olpc - Unmount the USB drive and SD card.
umount /mnt/USB ; unmount /mnt/SD - Remove the temporary directories.
rmdir -v /mnt/USB /mnt/SD - Restart.
shutdown -r now
You should now be booting off of the SD card.
Post-Install Tricks
Since you now have a fairly large storage drive, you may want to take advantage of the space to create a swap file or install packages onto the XO that aren't included in the "standard" OS with yum. This post-install section addresses both temptations.
Prevent Package-Induced Chaos
- Drop into console and log in as root.
- Alter the list of excluded packages.
Optional: Archive a copy of the exclusion list with bzip2 -v9k /etc/yum/olpc-exclude- nano /etc/yum/olpc-exclude
You'll want to keep the following on the exclusion list:- NetworkManager and all its affiliated files
- cerebro
- telepathy
- Any package beginning with olpc or sugar
- portaudio
- initscripts
- yum
- Save /etc/yum/olpc-exclude and yum install your packages.
- nano /etc/yum/olpc-exclude
Creating a Swap File
- Based upon instructions found here. Please read the instructions regarding /etc/fstab if you want the swap space to be started automatically on startup.
- Drop into console and login as root.
- Create a blank file ≥256 MB to be used for swap space.
For some reason (out of memory error?), a large blank file can't be made on demand in one fell swoop. In order to get around this, create a 1 MB file and repeatedly concatenate it to the intended swap file. This example makes a 512 MB swapfile:
dd if=/dev/zero of=/var/1m bs=1048576 count=1 ; for i in {1..512} ; do echo -en "$i\t"; cat /var/1m >> /var/vm && echo "OK" ; done && rm /var/1m - chmod 600 ; mkswap /var/vm
You now have an on-demand swapfile ready for use via swapon /var/vm.