User:NeoAmsterdam/Installing build 8.0.2 to a bootable SD card: Difference between revisions
Jump to navigation
Jump to search
NeoAmsterdam (talk | contribs) (With gratitude to the folks at irc://irc.oftc.net/olpc-devel for their guidance. A longer, more explicative version is on my "to do" list.) |
NeoAmsterdam (talk | contribs) (How did I manage to omit *that*?) |
||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<div style="float: right;">__TOC__</div> |
|||
<div style="background: #faa; border: thin solid red; color: red;"><span style="font-weight: bold; font-size: 141.4%;">WARNING:</span><br />The procedures outlined in this document will cause data to be overwritten. Do not proceed without taking the appropriate steps to safeguard your data.</div> |
|||
This document will explain how to make a bootable SD card for use with your XO (and then abuse your newfound storage capacity). |
|||
= Short Version = |
|||
= Read Me First = |
|||
== Warnings == |
|||
* <span style="color: red;">This procedure will erase and overwrite everything stored on the XO and the SD card. Back up your data!</span> |
|||
* <span style="color: red;">Do not execute this procedure on battery power. Any power interruption could lead render your XO irrecoverable.</span> |
|||
* <span style="color: red;">This procedure requires the use of <tt>fdisk</tt> for partitioning. Do not attempt this procedure if you are a Linux novice.</span> |
|||
* <span style="color: red;">Execute this procedure at your own risk. I will provide clarifications and explanations if requested, but I will not provide tech-support-style help.</span> |
|||
== Caveats == |
|||
* <span style="color: orange;">The SD card will be formatted as an ext3 filesystem. This is not an ideal filesystem for SD cards.</span> |
|||
* <span style="color: orange;">This document assumes you already have a developer key.</span> |
|||
* <span style="color: orange;">This document assumes that <tt>fdisk</tt> automatically recognizes the starting and ending cylinders for the SD card.</span> |
|||
* <span style="color: orange;">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).</span> |
|||
== 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.<br />Adult supervision is not required, but is highly recommended. |
|||
== Requirements == |
== Requirements == |
||
* An [[XO]]<br />Obviously. |
|||
* A USB drive: |
|||
* A [[USB]] drive<br />512 MB is barely large enough, 1 GB will do nicely. |
|||
** FAT-32/vfat format. |
|||
* An [[SD]] card<br />512 MB is barely large enough, 1 GB will do, but larger will always be better. |
|||
** 512 MB or larger. |
|||
* A developer's key<br />The instructions for obtaining a developer's key can be found [[Activation and developer keys|here]]. |
|||
== Instructions == |
|||
* Internet connectivity<br />You will need to download <!--at least--> two files. |
|||
# Store [http://download.laptop.org/xo-1/os/official/802/jffs2/fs.zip fs.zip] and [[http://download.laptop.org/xo-1/os/official/802/jffs2/os802.img os802.img]] to the USB drive. |
|||
# Clean-install as described [[Clean-install procedure|here]]. |
|||
== Optional == |
|||
# Upon reboot, enter the [[Console#The_Console|console]]. |
|||
* You will probably want to use a second computer to download two required files and to back up the XO's data. |
|||
# Repartition and format the SD card for ext3. |
|||
# Mount the SD card. |
|||
= The Procedure = |
|||
# Copy <tt>/versions/pristine/802</tt> to the SD card recursively with the preserve permissions flag set. |
|||
== Safeguarding Your Data == |
|||
# Make the <tt>/home/olpc</tt> directory on the SD card and change the owner to <tt>olpc:olpc</tt>. |
|||
# |
# Plug in the USB drive, insert the SD card. |
||
# <span style="color: red;">Backup your data</span> by copying files/activities to your USB drive. |
|||
# Unmount the SD card. |
|||
# Drop into the [[Console#The_Console|the console]].<br />Press <b>◆ ctrl</b> + <b>◇ alt</b> + <b>[[Image:Mesh key f1 small.png|12px]] f1</b> to enter the console, then press <b>[[Image:Key enter.jpg|12px]] enter</b> to log in as root. |
|||
The SD card and NAND are now bootable and in pristine condition. |
|||
# Determine the USB drive's mount point.<br /><b><tt>mount</tt></b> will output a series of mounted devices. Look for something like <tt>/dev/sda1 on /media/USB type vfat</tt>: make note of the mount point (<tt>/media/USB</tt> in this example). |
|||
= Long Version = |
|||
# Copy the developer key to the USB drive.<br /><b><tt>mkdir -pv /media/USB/security ; cp -v /security/develop.sig /media/USB/security</tt></b> |
|||
<i>Yet to be written</i>. |
|||
# Return to the graphical environment.<br />Press <b>◆ ctrl</b> + <b>◇ alt</b> + <b>[[Image:Home key f3 small.png|12px]] f3</b>. |
|||
# Enter the [[Journal]] and unmount the USB key.<br />Unmounting is explained [[Journal Activity#External storage devices|here]] |
|||
# Unplug the USB drive. |
|||
== Acquiring the Software == |
|||
The directions in this section assume that you're using a second computer. |
|||
# <span style="color: red;">Backup your data</span> by copying files/activities from your USB drive. |
|||
# Download [http://download.laptop.org/xo-1/os/official/802/jffs2/fs.zip fs.zip] and [http://download.laptop.org/xo-1/os/official/802/jffs2/os802.img os802.img] to your USB drive.<br />You should now have <tt>fs.zip</tt>, <tt>os802.img</tt>, and a folder called <tt>security</tt> which contains <tt>develop.sig</tt> on the USB drive. |
|||
<!-- |
|||
# <i>Optional:</i> |
|||
## Make a directory/folder on the USB drive called "Activities". |
|||
## Download activities, such as [[Browse]] or [[Terminal]], into the "Activities" folder. A list of all activities can be found [[Activities/All|here]]. |
|||
--> |
|||
# Eject the USB drive. |
|||
The remainder of this document assumes that you're using the XO. |
|||
== Preparing for Installation == |
|||
# Drop into the [[Console#The_Console|the console]]. |
|||
# Stop [[Sugar]] and the automounting daemon by lowering the runlevel.<br /><b><tt>/sbin/init 3</tt></b> |
|||
# Determine mounted devices<br /><b><tt>mount</tt></b> will list all the mounted devices.<br />If you see <tt>/dev/mmcblk0p1</tt> mentioned, run <b><tt>umount /dev/mmcblk0p1</tt></b>.<br />If the XO responds with the <tt>device is busy</tt> error message, try <b><tt>cd / ; umount /dev/mmcblk0p1</tt></b>.<br />If the device still can't be unmounted, <b>stop what you're doing</b> - you cannot proceed any further. |
|||
# <span style="color: red;">Quick-format the SD card<br /><b><tt>dd if=/dev/zero of=/dev/mmcblk0 bs=512 count=8</tt></b></span> |
|||
# <span style="color: red;">Paritition the SD card<br /><b><tt>fdisk /dev/mmcblk0</tt></b><br />You will now be running <tt>fdisk</tt> interactively. Create a new primary partition that runs the length of the drive, flag it as bootable, make sure it's type <tt>83</tt> (Linux), and write the changes.</span> |
|||
# <span style="color: red;">Format the SD card<br /><b><tt>mkfs.ext3 -L "OLPC-SD" /dev/mmcblk0p1</tt></b></span> |
|||
# Turn off the XO<br /><b><tt>shutdown -h now</tt></b> |
|||
== Installing the OS == |
|||
# With the XO powered off, plug in the USB drive. |
|||
# Hold down all four game keys (<b>╳</b>, <b>✓</b>, <b>○</b>, and <b>◻</b>) while your power on the XO.<br />Do note release the four game keys until you see "<tt>Release the game keys to continue</tt>" at the top of the screen.<br />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 [[Console#The_Console|the console]].<br /><b>◆ ctrl</b> + <b>◇ alt</b> + <b>[[Image:Mesh key f1 small.png|12px]] f1</b>. |
|||
# Mount the USB drive.<br /><b><tt>mkdir /mnt/USB ; mount -t vfat /dev/sda1 /mnt/USB</tt></b> |
|||
# Mount the SD card.<br /><b><tt>mkdir /mnt/SD ; mount -t ext3 /dev/mmcblk0p1 /mnt/SD</tt></b> |
|||
# Copy the developer key from the USB drive to the SD card.<br /><b><tt>cp -rv /mnt/USB/security /mnt/SD</tt></b> |
|||
# Copy the OS from the NAND to the SD card.<br /><b><tt>cp -prv /versions/pristine/802 /mnt/SD</tt></b> |
|||
# 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.<br /><b><tt>mkdir -pv /mnt/SD/home/olpc ; chown -rv olpc:olpc /mnt/SD/home/olpc</tt></b> |
|||
<!-- |
|||
# If you downloaded activities onto your USB drive, install them to the SD card. |
|||
## Copy the Activities folder to the olpc user's home directory.<br /><b><tt>cp -rv /mnt/USB/Activities /mnt/SD/home/olpc</tt></b><br />These files will have to be decompressed later. |
|||
--> |
|||
# Unmount the USB drive and SD card.<br /><b><tt>umount /mnt/USB ; unmount /mnt/SD</tt></b> |
|||
# Remove the temporary directories.<br /><b><tt>rmdir -v /mnt/USB /mnt/SD</tt></b> |
|||
# Restart.<br /><b><tt>shutdown -r now</tt></b> |
|||
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 <tt>yum</tt>. 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.<br /><i>Optional:</i> Archive a copy of the exclusion list with <b><tt>bzip2 -v9k /etc/yum/olpc-exclude</tt></b> |
|||
## <b><tt>nano /etc/yum/olpc-exclude</tt></b><br />You'll want to keep the following on the exclusion list: |
|||
##* <tt>NetworkManager</tt> and all its affiliated files |
|||
##* <tt>cerebro</tt> |
|||
##* <tt>telepathy</tt> |
|||
##* Any package beginning with <tt>olpc</tt> or <tt>sugar</tt> |
|||
##* <tt>portaudio</tt> |
|||
##* <tt>initscripts</tt> |
|||
##* <tt>yum</tt> |
|||
## Save <tt>/etc/yum/olpc-exclude</tt> and <b><tt>yum install</tt></b> your packages. |
|||
=== Creating a Swap File === |
|||
* Based upon instructions found [http://sanjaykatiyar1.blogspot.com/2007/08/create-swap-file-in-fedora-linux.html here]. Please read the instructions regarding <tt>/etc/fstab</tt> 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.<br />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:<br /><b><tt>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</tt></b> |
|||
# <b><tt>chmod 600 /var/vm ; mkswap /var/vm</tt></b><br />You now have an on-demand swapfile ready for use via <tt>swapon /var/vm</tt>. |
|||
= See Also = |
|||
* [[Installing to SD Card]] |
|||
[[Category:Hardware]] |
Latest revision as of 17:01, 13 February 2011
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
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 /var/vm ; mkswap /var/vm
You now have an on-demand swapfile ready for use via swapon /var/vm.