User:SDGathman

From OLPC
Jump to navigation Jump to search

Hi! My dad bought an XO-1 via G1G1 for my daughter for Christmas. She has outgrown it, but now I use it with a USB keyboard and mouse. It has been very fun configuring a full F11 desktop to run in 256M, booting from an 8G SDHC. The process has provided the excuse to try a number of alternative applications due to lower memory requirements. Ekiga, Pidgin, terminal, firefox, claws-mail, all work beautifully. I've spent many work hours outdoors in the sun (ok, shade - I don't like sunburn) with an easily read screen. I'm waiting for a netbook with Pixel Qi display and adult keyboard. I want a foot treadle generator (easily used while seated) to charge my XO/netbook while working.

You can read more about me here:

http://gathman.org/vitae/

Running XO-1 from an SDHC Card

Installing to an SD Card.

Version 14 - Fedora 18

I tried upgrading from 853 to 13.2.1, it removed all my personal files and made the SD unbootable. I had made a backup first. So on to a fresh install.

The requirements are that the SD card or USB disk must be partitioned in the way that is produced by the sd_card_image module of olpc-os-builder. That is, the first partition includes boot contents, and the second includes the main filesystem.

For this install I bought a 48MB/s Samsung 16G SD card for $10 (the 64G cards are mainstream now). The FAT filesystem preinstalled on the SD card was aligned to 4M (8192 sectors), so I aligned all partitions to 8192 sectors. Partition 1 (/bootpart) is about 300M (way more than needed), partition 2 (rootfs) is 8G, partition 3 (swap) is 1G. Partitions do not have to be in physical order, so partition 2 is positioned where it can be easily expanded if needed. I made the root fs ext4, since this has the best benchmarks on flash media.

I bought a USB SD card reader/writer to set up the SD card without using the XO-1, so PARTITION1 was /dev/sdb1 - but naming may be different depending on where you are preparing the SD card.

  1. extract the entire contents of the tarball onto the 2nd partition. The tree tarball should work, but I used the jffs2 image (32014o0.img), mounted using block2mtd, and copied using rsync.
  2. look at the name of the directory in versions/pristine (e.g. "14"). This is the fs version number and will be referred to as FSVERSION below.
  3. On the first partition (PARTITION1), create security and boot-versions toplevel directories
  4. Create directory PARTITION1/boot-versions/FSVERSION
  5. copy PARTITION2/versions/pristine/FSVERSION/boot/* into PARTITION1/boot-versions/FSVERSION
  6. create a symlink at PARTITION1/boot that points at boot-versions/FSVERSION

I put the card in my XO-1, and the Sugar desktop came up. You will need the swap active to be able to use yum.

Sorry, but you've wasted your time doing this, it's all done automatically now. Please read our SD card installation instructions. No need to create filesystems. Many new features and fixes are in the 13.2.4 release notes, so please upgrade. --Quozl 01:27, 9 June 2015 (UTC)

Version 852 - Fedora 14

Version 852 of the OLPC software is a wonderful release. You can switch between sugar and Gnome desktop, and it tracks Fedora 11. However, there is hardly any room left on the 1G flash to actually use it. Back in the Fedora 9 based releases, I tried to run from an SDHC card, but a driver bug trashed the card by removing power without the proper protocol on a suspend (at least, that is what I gathered from the discussions). I was ready to try again, this time with an 8G Adata turbo SDHC.

To boot from SDHC, you need a developer key, a system image, and the SDHC card. I partitioned the card into 2 partitions. The first partition must be the root filesystem (the firmware looks there for the boot code - it could be /boot if you did some hacking). I use the second partition for swap.

Both ext3 and swap read and write the card in 8 sector (4k) blocks. Since flash drives often have 4k write blocks internally, I thought it wise to align both partitions on a 4k byte boundary:

# fdisk -H224 -S56 /dev/mmcblk0

This aligns partition 1 on a 4k boundary, and as a bonus, the swap partition is aligned on a 128k erase block boundary (in case that makes a difference). The Adata turbo claims 6Mbyte/sec write speed. I have observed peak write speeds of 5.9M, so it doesn’t seem to hurt at least. The default partition table that came on the card had 63 sectors per track (no alignment with write or erase blocks), so it may not matter. I reserved about 300M for swap:

 Disk /dev/mmcblk0: 245696 cylinders, 4 heads, 16 sectors/track
 Warning: The partition table looks like it was made
   for C/H/S=*/224/56 (instead of 245696/4/16).
 For this listing I’ll assume that geometry.
 Units = cylinders of 6422528 bytes, blocks of 1024 bytes, counting from 0
    Device Boot Start     End   #cyls    #blocks   Id  System
 /dev/mmcblk0p1          0+   1199    1200-   7526372   83  Linux
 /dev/mmcblk0p2       1200    1252      53     332416   83  Linux
 /dev/mmcblk0p3          0       -       0          0    0  Empty
 /dev/mmcblk0p4          0       -       0          0    0  Empty


http://www.usenix.org/event/fast10/tech/full_papers/boboila.pdf

There were two system images available with the 852 release, os852.img and os852.fs.tree.lzma. Both of these have the same files. os852.img is a jffs2 filesystem image, and os852.fs.tree.lzma is a tar archive compressed with lzma. I had trouble extracting the tar archive because tar on the XO-1 did not create invalid symlinks - and the absolute symlinks were of course all invalid. It turned out to be easy to use the jffs2 image instead thanks to the block2mtd driver (not included on the XO-1). After partitioning, I created

 # mke2fs -i 8192 -LOLPCRoot /dev/mmcblk0p1
 # mkswap /dev/mmcblk0p2

The OLPCRoot label is required, the boot code looks for it. On another PC, I downloaded os852.img, and then mounted it:

 # losetup /dev/loop0 os852.img
 # modprobe block2mtd block2mtd=/dev/loop0,131072
 # modprobe mtdblock 
 # mkdir /mnt/olpc
 # mount -t jffs2 -r /dev/mtdblock0 /mnt/olpc

The 131072 is the 128k erase block size of the on board flash.

Now, on the olpc, I could rsync the files:

 # mkdir /mnt/f11
 # mount /dev/mmcblk0p1 /mnt/f11
 # rsync -ravH bigpc:/mnt/olpc/ /mnt/f11

I had to edit /mnt/f11/boot/olpc.fth to add rootwait:

    “ root=LABEL=OLPCRoot rootfstype=ext3 rootwait”

This waits for SDHC to initialize before attempting to mount it. You could also change the filesystem label here (and relabel the filesystem) if you wanted.

I also copied my developer key to /mnt/f11/security (optional, but allows escaping to firmware).

Then I unmounted and added the journal.

 # umount /mnt/f11
 # tune2fs -j /dev/mmcblk0p1

A reboot, and the sugar desktop came up! Sugar now has an option to switch to the Gnome desktop. I switched to Gnome.

To update with yum, I needed to enable swap, and expand /var/cache/yum. After opening a terminal:

 # swapon /dev/mmcblk0p2
 # mount -o remount,size=256M /var/cache/yum
 # yum update

I edited /etc/fstab to make swap permanent. The writes to swap are small compared to filesystem writes (except during yum update), so it wasn’t worth it to add swap manually when needed. You could get a little better performance by using a USB flash key for swap, since they would both write in parallel.

With 7.3G available, I was able to install lots of additional software, like xmms, pidgin, claws-mail, openvpn, vim-X11, vim-enhanced, gkrellm, ekiga, tigervnc. With swap enabled, I can browse the web, read email, talk on VOIP, use another desktop via VNC, chat on IM, listen to music, all simultaneously. Flash content is unusable,but javascript is fine. Thunderbird is too big (haven’t actually tried it, however), but claws-mail works great. To watch youtube, use http://tinyogg.com (HD overwhelms CPU, but standard content consumes only about 60%). The bottom line, is that 433Mhz is plenty for most tasks, barring inefficient code.