[Server-devel] Root fs on XO1

James Cameron quozl at laptop.org
Fri Aug 9 07:17:25 EDT 2013


On Fri, Aug 09, 2013 at 05:53:06AM -0400, George Hunt wrote:
> The motherboard flash on an XO1 is 1GB. The kernel, rootfs, provided
> by OLPC Boston for the XO1 occupies 745MB. The server software
> (XSCE) we have been adding on top of the OS occupies about
> 1.3GB.  So obviously an additional SD card is required.

The XO-1 SD card slot is not as reliable as the NAND FLASH, because of
some early mistakes in the electrical interface.  John Watlington
knows more about this than I.  I have never been happy with using the
XO-1 SD card slot.  I've seen problems that were clearly specific to
an XO-1; the same cards worked fine on XO-1.5, XO-1.75, and XO-4,
which do not have the early mistakes.  The problems are consistent
with an electrical cause.

The risk of using the XO-1 SD card slot in your design for XSCE is
that the design won't scale to other XO-1 laptops in the field.

I suggest booting from USB drive may be more reliable and scalable
than SD slot.

Still, you should test rather than blindly accept my speculation.

> My first approach has been to start with a vfat formatted SD card,
> change its format to ext4, without changing its partition layout (I
> think this avoids creating erase block/OS write mismatch, which
> slows and wears SD cards prematurely).

No, not really.  Yes, good that you have not changed the start of the
partition.  But no, by switching from FAT to ext4 there's a risk that
the I/O requests won't be as aligned as the closed-source FTL
designers had anticipated.  You should test rather than speculate.

However, since most of the time the server will be CPU bound rather
than I/O bound, it shouldn't matter much.  You probably won't notice
the effect.

> Then I have been copying large chunks from the JFFS to the SD card,
> and sym-linking to it, so that additional yum install operations are
> diverted to the SD card.

This should work, but you now rely on _two_ devices to be working
well, which decreases the mean time between failure.

> Recently, Jerry has suggested that I just ignore the motherboard
> jffs flash, and run entirely off the SD card.  I've been studying
> how to accomplish this.   It looks to me like the <OS>.img file
> available for the XO1 is in jffs2/mtd format which would be
> appropriate for "dd"ing directly to the motherboard flash, but
> probably not correct for "dd"ing to an SD card.

Yes.  It certainly won't work.  The jffs2 driver in Open Firmware is
only instantiated for the NAND FLASH device, and is not instantiated
for block devices like USB or SD.

There is 32013o0.tree.tar.lzma which is more suitable for the task,
after you create filesystems, but still you may need to do a few
things to make it boot.

> So here is my question: Does it make sense to let the openfirmware
> bios write the OS image to the jffs on the motherboard, and then for
> me to rsync that OS, as data,  to an ext4 formatted (not
> repartitioned) SD card?

No.  Should be less work to use the tar.lzma.

> If I do this will the presence of a signed kernel on the SD card
> cause the boot loader to choose the SD card, ignore JFFS, even if
> the XO is still secured?

For signed boot, on all models, the search order is defined by
all-devices$, which can be displayed:

	ok all-devices$ type
	disk: ext-sba: int-sba: ext: int:

So yes, the SD slot is checked for the files required for signed boot.
The checking order on XO-1 is USB drive, SD slot, then NAND FLASH.

Provided you have no USB drive attached, the SD slot will override the
NAND FLASH.

You must use a filesystem for the first partition on the external SD
slot for which the firmware has support.  I have not tested ext4
seriously on XO-1.  I suggest initial testing with ext2 or ext3.

You must place a /boot/ directory on the filesystem of the first
partition with the signed files.

The next hurdle you face will be that the signed files prepared for
OLPC OS do not have the necessary dracut support for booting an XO-1
from SD slot or USB drive.  You will need to fix the initramfs.

It may be a shorter path, overall, to make a fork of olpc-os-builder
to generate for yourself an XSCE build with all the necessary
additional support.  olpc-os-builder isn't terribly hard to work with.

You might also take an XO-1.5 build, install it to SD card, and
place an XO-1 kernel on the card instead of the XO-1.5 kernel.  As you
know from mktinycorexo, Open Firmware is happy to boot a filesystem
containing every possible kernel.  ;-)

-- 
James Cameron
http://quozl.linux.org.au/


More information about the Server-devel mailing list