Imaging for XO-1.5: Difference between revisions
Line 22: | Line 22: | ||
{{Template:Software_Side_Effects_Fixes}} |
{{Template:Software_Side_Effects_Fixes}} |
||
Avoid allowing the image to boot. |
Avoid allowing the image to boot. The steps above must be repeated if the image is allowed to boot before being captured. |
||
The next step depends on whether you chose to build the image on internal microSD, or an external SD card. See the appropriate subsection below. |
The next step depends on whether you chose to build the image on internal microSD, or an external SD card. See the appropriate subsection below. |
||
=== Internal microSD === |
=== Capture Internal microSD === |
||
*boot an OLPC build from external SD or use a USB booted Linux (such as [http://lists.laptop.org/pipermail/devel/2010-August/029467.html Tiny Core Linux]) |
*boot an OLPC build from external SD or use a USB booted Linux (such as [http://lists.laptop.org/pipermail/devel/2010-August/029467.html Tiny Core Linux]) |
||
Line 38: | Line 38: | ||
After doing this you will have an fs.img file that contains the raw blocks of the internal microSD. |
After doing this you will have an fs.img file that contains the raw blocks of the internal microSD. |
||
=== External SD === |
=== Capture External SD === |
||
*remove the SD card and insert into a running system, identify the block device from /proc/partitions, |
*remove the SD card and insert into a running system, identify the block device from /proc/partitions, |
||
*capture the image |
*capture the image: |
||
$ dd if=/dev/mmcblk1 of=fs.img bs=131072 count=29489 |
$ dd if=/dev/mmcblk1 of=fs.img bs=131072 count=29489 |
Revision as of 22:18, 30 December 2010
XO-1.5 only. Tested by User:Quozl using os304 on 2010-08-05.
How to build your own operating system image file, by extracting an image from a laptop and using our tools to convert to the format required by the firmware.
You might do this in order to rapidly deploy a customised image, using fs-update or NANDblaster for XO-1.5.
Imaging laptops is not supported for major deployments by OLPCA's deployment support team. However, it is suitable for limited testing. Take particular notice of the need to prevent side-effects of imaging.
Know the image size
- identify the .zd file you are starting with,
- read the first line of the file to determine the amount of space taken by the image,
$ head -1 os304.zd zblocks: 20000 7331
These values are hex. They represent a block size of 131072 decimal, and a block count of 29489 decimal. These are used below.
Prepare image
Using the internal microSD or an external SD card, install an OLPC build using fs-update, add your customisations, and then prepare the image for cloning:
Stop the display manager. The remainder of these fixes must be typed into a virtual console, or a serial port.
sudo service olpc-dm stop
Delete the ".olpc-configured" files which tell olpc-configure it does not have to run again. This allows some of the files deleted below to be checked for and replaced.
sudo rm -vf /.olpc-configured rm -vf /home/olpc/.olpc-configured
Destroy any saved network connections. Otherwise the cloned laptop cannot connect to the networks the original laptop used.
sudo rm -rvf /etc/NetworkManager/system-connections/*
If SSH was enabled, destroy the SSH host key. Otherwise other systems in your network may report problems connecting to the laptops over SSH.
sudo rm -vf /etc/ssh/ssh_host_rsa_key{,.pub}
Destroy the Sugar journal and settings, forcing a first boot name prompt. Otherwise the cloned laptops won't be able to collaborate using activities, or the wrong names will be shown in Chat,
rm -vrf /home/olpc/.sugar /home/olpc/.config/{g,d}conf /home/olpc/.local/share/telepathy
Destroy the developer key request file. Otherwise the cloned laptops will apply for developer keys using the original laptop serial number and UUID.
rm -vrf /home/.devkey.html
Destroy any saved volume settings, forcing defaults. Otherwise the cloned laptop may start with silent speakers or microphone.
sudo rm -vf /etc/alsa/asound.state
Immediately shutdown, to avoid asound.state being saved:
sync && sudo poweroff -f
Avoid allowing the image to boot. The steps above must be repeated if the image is allowed to boot before being captured.
The next step depends on whether you chose to build the image on internal microSD, or an external SD card. See the appropriate subsection below.
Capture Internal microSD
- boot an OLPC build from external SD or use a USB booted Linux (such as Tiny Core Linux)
- prepare an output directory with enough space to hold the image,
- if you are booting an OLPC build from external SD, you must first mount a USB stick larger than the build you are imaging, e.g. mount /dev/sda1 /mnt
- if you are booting from media that is not mounted after boot, as is the case with Tiny Core Linux, you will need to mount it, e.g. mount /dev/sda1 /mnt
- capture the image:
$ dd if=/dev/mmcblk0 of=/mnt/fs.img bs=131072 count=29489
After doing this you will have an fs.img file that contains the raw blocks of the internal microSD.
Capture External SD
- remove the SD card and insert into a running system, identify the block device from /proc/partitions,
- capture the image:
$ dd if=/dev/mmcblk1 of=fs.img bs=131072 count=29489
After doing this you will have an fs.img file that contains the raw blocks of the external SD card.
Convert to ZD
- install some development tools:
# yum install git make gcc zlib-devel libtomcrypt-devel
- clone the git repository of the bios crypto source package and build it:
$ git clone --depth=1 git://dev.laptop.org/bios-crypto $ cd bios-crypto/build $ make zhashfs
- convert the fs.img file to .zd format (this takes a fair while if run on XO-1.5 hardware, but block number progress feedback is provided):
$ ./zhashfs 0x20000 sha256 fs.img fs.zsp fs.zd
Installing
fs-update
- place the fs.zd file on a USB stick,
- at Ok prompt use fs-update to install the image:
ok fs-update u:\fs.zd
The total block count shown after fs-update completes should match the block count determined earlier.
NANDblaster
- place the fs.zd file on a USB stick,
- insert USB stick in sending XO,
- at Ok prompt use nb-update to transmit the image:
ok nb-update
See NANDblaster for more information.