Firmware/Storage

From OLPC

< Firmware
Revision as of 23:00, 1 October 2013 by Quozl (Talk | contribs)
Jump to: navigation, search

Firmware commands that work with internal storage.

Contents

fs-update

  • installs a .zd file to the internal storage,
  • is optimised for maximum speed by overlaying the read and write streams,

The fs-update command has two variants; signed and unsigned.

unsigned

  • used during development,
  • during install, verifies the block hashes in the .zd file against the block data in the .zd file,
  • does not require or use the .zip file,
  • does not reboot on completion,
  • example:
fs-update u:\os.zd

signed

  • used during deployment,
  • triggered by four game key hold during startup,
  • searches for fs.zip or fsN.zip where N is the model tag; this file must be present on boot media,
  • verifies the signature in the .zip file,
  • during install, verifies the block hashes in the .zip file against the block data in the .zd file,
  • reboots automatically on completion,

fs-verify

  • verifies that fs-update worked correctly,
fs-verify filename.zsp
  • reads a .zsp file, in particular the block numbers and block hashes,
  • reads corresponding blocks from internal storage, calculating block hashes,
  • reports progress,
  • reports all block numbers where the calculated hash does not match the hash in the .zsp file,

fs-verify-quick

  • verifies that fs-update worked correctly,
fs-verify-quick filename.zsp
  • like fs-verify but stops on first mismatch,
  • reports the first block number where the calculated hash does not match the hash in the .zsp file,

fs-save

  • writes an .img file using the internal storage as source,
  • is very slow, intended for diagnostic use only.

fs-load

  • installs an .img file to the internal storage, without any verification,
  • is very slow, intended for field support use only.

fs-resize

The fs-resize command enlarges the second partition of the internal storage so that it takes up all the remaining space on the device. It was an interim fix until ticket #10040 was fixed. The partition resize is now handled in OLPC OS by the startup scripts. fs-resize remains applicable to builds that were created before this fix. The method to install them was:

  • on a 4GB or 8GB laptop, use fs-update to install the 2GB build,
  • use fs-resize to resize the partition that holds the root filesystem,
  • boot the build,
  • use resize2fs /dev/mmcblk0p2 to resize the root filesystem to the new size of the partition.

devalias fsdisk

Recipes

How to install to SD card

The laptop has an external SD card slot which can be used instead of internal storage. To install to the SD card requires a special command:

devalias fsdisk ext:0
fs-update u:\os.zd
  • does not work for signed install,
  • does not work on XO-1,
  • requires extra care to type the command properly.

How to automatically install an unsigned build

For signed builds, the install sequence is:

  • prepare the USB drive with signed files, see release notes,
  • insert the USB drive,
  • hold down the four game keys and turn on the laptop,
  • wait for the laptop to turn itself off.

However, for unsigned custom builds the user is often asked to use fs-update manually. As an alternative, an Open Firmware boot script may be used. The laptop must still be unlocked. Here is an example script:

\ OLPC XO-1.5 XO-1.75 XO-4 automatic unsigned install script
: zd$  " u:\32001xx1.zd"  ;
: installer
    visible

    ." press 'y' to install" cr  \ avoid accidental damage
    begin  key  [char] y  =  until
    page

    zd$ $fs-update
    page

    .os
    ." install done," cr
    ." please remove USB drive and turn off."
    begin halt again
;
installer

Place this script in a file olpc.fth in a directory boot on the USB drive. Place the install file on the USB drive. Insert the USB drive in the laptop and turn it on, without holding down the four game keys. The laptop will ask "press 'y' to install". Press 'y' and the install will start.

How to make an image copy of internal storage

  • determine the size of the internal storage, as shown by banner,
  • choose a USB flash drive, USB hard drive, or SD card that is larger than the internal storage size,
  • choose a size higher than the internal storage, because filesystems add some overhead,
  • choose ext2 or FAT filesystems, because these offer the best compatibility,
  • choose a device that has no critical data on it already, because the feature is not well tested and may corrupt filesystems,
  • use the fs-save command to make the image copy, for example:
ok fs-save u:\os.img

The screen will fill with grey blocks, and these will turn red indicating progress.

Note: fs-save and fs-load can be used for backup and restore, or for cloning one laptop to another, but there are much faster methods, such as Tiny Core Linux. The process is very slow, roughly 15 minutes for 4GB to a USB HDD, or three hours over NFS over USB ethernet. See also Imaging_for_XO-1.5 and Imaging/Side_effects.

See Also

Personal tools
  • Log in
  • Login with OpenID
About OLPC
About the laptop
About the tablet
Projects
OLPC wiki
Toolbox
In other languages