Installing to SD Card

From OLPC
Revision as of 00:26, 2 June 2008 by 84.131.136.226 (talk) (change to sdb ... stay consistent)
Jump to navigation Jump to search

Introduction

First of all, this page is a new work in progress. I am new to the OLPC, having just gotten my G1G1 laptop. While under construction, I won't have linked to other pages much, as I'll go over and do this as a pass later....

This page is to address the following goals I had:

  • Leave my NAND storage to be used only for signed builds, which I will led the kids use.
  • Install an image to a dedicated SD card, and boot the image instead of the NAND when present. (Preferably only booting the SD on a keypress, but for now, I'll accept popping the card out to switch). This is where I will play with new things, try my hand at on-the-hardware development, and do things like run XFCE and additional add-on software.
  • Not so much for testing new builds (I can use a USB key for that) but more for building a semi-permenant alternate install.

This is just an assemblage of information I found in other pages in the wiki, some new, some old, some slightly related to my goals, and shaken out. In many ways, is just the same as the older Installing Fedora Core Page, but using the XO-1/SD instead of developer boards/USB drives.

Assumptions

I have my laptop unlocked after having received my developer key, and as such it may be required for these instructions.

Instructions

Install the image

Since this is to be a semi-permanant installation, it makes sense to track stable releases. Go lookup the latest stable build number at the following URL (but do not download from here, as we need ext3, not jffs2 images...):

http://download.laptop.org/xo-1/os/official/

Once you know the build number, look it up here:

http://xs-dev.laptop.org/~cscott/olpc/streams/ship.2/

And download the ext3 image, you need the file ending in .img.bz2, e.g.,

olpc-redhat-stream-ship.2-build-653-20071214_1708-devel_ext3.img.bz2

(NOTE: I am not certain where the non devel images are, but I am making the (possibly naive) assumption that matching 'devel' build numbers correspond to the signed, stable release... if someone can confirm?)

unzip it, and transfer it to a USB storage device via dd, e.g.,

# bunzip2 olpc-redhat-stream-ship.2-build-653-20071214_1708-devel_ext3.img.bz2
# dd if=olpc-redhat-stream-ship.2-build-653-20071214_1708-devel_ext3.img of=/dev/sdb bs=1024
# sync

Remember to:

  • Make sure any old partitions from the storage device are unmounted.
  • Do this as the super user / root
  • Replace /dev/sdb with the device file of the SD Reader storage device. The images do contain a partition table and boot loader, so make sure to write to the device and not a partition on the device (e.g. not /dev/sdb1)
  • The SD storage device must be 1024 MB or larger. All existing data will be lost.

Enlarging the Partition

The OLPC OS images are 1024MB (to fit the onboard flash), but you may be installing them to a larger drive. Therefore we must enlarge the partition. Once you have transferred the image to the SD Card device (the 'dd' step), and synced all disks (the 'sync' step), get a root shell. Then, start the 'fdisk' command like so:

[root@localhost ~]# fdisk /dev/sdb

Be sure to replace '/dev/sdb' with the actual device name of the USB Hard Disk Drive on which you are installing the OLPC OS.

Next, type 'p' to show the current partition table:

Command (m for help): p
Disk /dev/sdb: 5000 MB, 5000970240 bytes 16 heads, 62 sectors/track, 9846 cylinders Units = cylinders of 992 * 512 = 507904 bytes
Device Boot Start End Blocks Id System /dev/sdb1 1 993 492497 83 Linux Command (m for help):

Next, you wish to delete the existing partition:

Command (m for help): d
Selected partition 1

If you type 'p' again to print the partition table, you'll notice that the partition has been deleted:

Command (m for help): p
Disk /dev/sdb: 5000 MB, 5000970240 bytes 16 heads, 62 sectors/track, 9846 cylinders Units = cylinders of 992 * 512 = 507904 bytes
Device Boot Start End Blocks Id System
Command (m for help):

Next, you wish to re-create the partition with a much larger size:

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)

Type the letter 'p' here to create a new primary partition.

p

Type '1' here to create primary partition number 1:

Partition number (1-4): 1

Just hit return here to start the partition at cylinder #1:

First cylinder (1-9846, default 1): 1

Just hit return here to end the partition at the end of the disk:

Last cylinder or +size or +sizeM or +sizeK (1-9846, default 9846): 
Using default value 9846

You may type 'p' again to print out the new partition table:

Command (m for help): p
Disk /dev/sdb: 5000 MB, 5000970240 bytes 16 heads, 62 sectors/track, 9846 cylinders Units = cylinders of 992 * 512 = 507904 bytes
Device Boot Start End Blocks Id System /dev/sdb1 1 9846 4883615+ 83 Linux

Now, type 'w' to write the partition table to the disk and quit fdisk.

Enlarging the filesystem

Now that the partition is large enough, you must resize the filesystem to take advantage of all the new space. First we have to 'fsck' (file system check) the file system to ensure that it is clean. Be sure to replace the '/dev/sda1' with the actual device you are using, and make sure that you do have the '1' on the end, to specify checking of the first partition, not the entire device.

[root@localhost ~]# /sbin/fsck.ext3 /dev/sdb1
e2fsck 1.39 (29-May-2006)
/dev/sdb1 is mounted.
WARNING!!! Running e2fsck on a mounted filesystem may cause SEVERE filesystem damage.
Do you really want to continue (y/n)? yes

Type 'y' here to continue checking:

OLPCRoot: recovering journal
OLPCRoot: clean, 18986/123464 files, 337653/492496 blocks
[root@localhost ~]# 

Next, you will resize the actual filesystem to use all the available space

[root@localhost ~]# resize2fs /dev/sdb1
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/sdb1 is mounted on /media/OLPCRoot; on-line resizing required
Performing an on-line resize of /dev/sdb1 to 4608000 (1k) blocks.

When that step is complete (it could take a while), type 'sync' to ensure data is flushed to disk. Wait until the disk activity light has stopped before unplugging the disk.

Fixing the boot script

You must now mount the card onto a Linux system (your OLPC booted off the NAND at a root shell will work), and edit the file /MOUNTPOINT/boot/olpc.fth, changing the following items:

  • change any instance of "disk:/" to "/sd/disk:/" (had 4 of these)

Not doing this resulted in a boot error for me.

TODO: I suspect more changes to this file will let me do the 'default internal NAND, need keypress at boot for booting the SD.

Booting the SD Card

Now you should be able to boot the OLPC operating system off the SD Card. Just insert it and power-on/reboot the device. You should see it come up with as if you reset the firmware. (IE: Asks for name and colours). You should check in a terminal window with 'df' to ensure the SD card is your root device.

Other things todo

Now you have a lot of space potentally (with SD prices forever falling), and little risk of making your system unbootable, you can do all sorts of things such as installing packages from YUM, installing/playing with Xfce on your alternate image.

Some other notes will be collected for specific apps, etc.

Installing Pidgin

This *almost* works out of the box, save for one missing dependency in the yum repository.

If you first install the RPM from here:

ftp://rpmfind.net/linux/fedora/core/development/i386/os/Fedora/NetworkManager-glib-0.6.5-2.fc7.i386.rpm

You can then easily do a YUM install of pidgin.

Resolving logos conflict when installing from YUM

Many packages will result is most of GNOME getting pulled in by dependencies. This will cause a problem with the logos package. Resolve as follows from a root shell:

rpm -Uvh \
http://koji.fedoraproject.org/packages/redhat-artwork/7.0.0/11.fc7/i386/redhat-artwork-7.0.0-11.fc7.i386.rpm \
http://koji.fedoraproject.org/packages/fedora-logos/6.0.98/3.fc7/noarch/fedora-logos-6.0.98-3.fc7.noarch.rpm \
--nodeps --force

Using NetworkManager in XFCE

WARNING: Instructions incomplete and almost entirely untested at this time.

WARNING: This will haul in most of the GNOME environment to accomplish this feat. Since many other packages I have installed already did this, it wasn't a big deal really.

Assumes you've visiting the Xfce page and and followed some directions there.

First, install the XFCE support for using GNOME applets:

yum install xfce4-xfapplet-plugin

Then forcibly install the NetworkManager-gnome package from the fedora 7 updates repository:

rpm -Uvh http://download.fedora.redhat.com/pub/fedora/linux/updates/7/i386/NetworkManager-gnome-0.6.5-7.fc7.i386.rpm

Installing Non-OLPC images to SD Cards

Links to other efforts to run from SD cards

Installing Debian to an SD Card

A modification of the manual install instructions found at the debian site here: http://wiki.debian.org/DebianEdu/OLPC/Installation

  • Best done on another system besides your XO-1.
  • create an EXT3 filesystem on the SD card, and mount it as /tmp/debian
  • grab these tar files into /tmp (which may be same as used by olpc-update?):
cd /tmp
wget http://radian.org/~krstic/etch-xfce.tar
wget http://radian.org/~krstic/etch-xfce-home.tar
  • untar as follows
cd /tmp
tar xpvf etch-xfce.tar
mkdir debian/home/olpc
cd debian/home/olpc
tar xpvf /tmp/etch-xfce-home.tar
chown -R 500:500 /tmp/debian/home/olpc
  • edit the file: /tmp/debian/boot/olpc.fth
    • You could go a few ways here... I changed the 'if button pressed' part of the if to load from SD instead of NAND. (IE: default is still to boot from internal NAND, and holding circle on power boots the debian from SD).
    • WARNING: I would recommend if you're dual booting to DEFAULT to your SD card distribution, and only carefully use official images. There is a bug in recent images that causes the partition table of your card.
      • See http://dev.laptop.org/ticket/6163
      • I dont remember this happening with the shipped 650 build or the 653, but the joyride build as of around January started doing it to me, and others report problems with 656 or even 653.
      • I *strongly* suspect that the more aggressive sleep mode is involved
        • Waking up from the console results in angry sounding dmesg output from the MMC module(s)
  • umount the SD card, insert into the XO and power on/reboot.
  • check out steps 4 and 5 of Installing Debian as an upgrade to get Networking up and using apt-get to install more goodies.

Disabling the tap-to-click on trackpad

While the official Sugar builds do not do tap-to-click, the device driver when under debian/ubuntu turns this on, which is excruciatingly sensitive, making it difficult to use. (Well, for me anyways, I've never liked it much on ANY laptop....)

To disable:

  • Edit /etc/modprobe.d/olpc.conf.dist and add:
    options mousedev tap_time=0
  • Reboot
  • Enjoy a trackpad free of constant unintended clicks!