Customizing NAND images: Difference between revisions

From OLPC
Jump to navigation Jump to search
m (added catergory)
(magic OFW indtructions)
Line 1: Line 1:
{{OLPC}}
{{OLPC}}
This page describes how to create a jffs2 image from a laptop's internal NAND, producing an image that can be flashed onto a different XO.
This page describes how to create a jffs2 image from a laptop's internal NAND, producing an image that can be flashed onto a different XO. The laptop that is being backed up is the "host" laptop, and the laptop receiving the contents of the host laptop is the "target" laptop.


Steps:
Steps:


* Make the changes on the XO machine that you want to be present in the generated image.
* Make the modifications on the host laptop that you want to be present in the generated image. If you've logged into sugar and want the user to see the welcome/login prompt again, you can <tt>rm /home/olpc/.sugar/default/config</tt>.


* Insert a Windows-formatted (VFAT) USB disk into the host laptop, and reboot.
* Download the build tree corresponding to the image currently on the NAND. To find which build number you're running on the NAND, you can <tt>cat /boot/olpc_build</tt> or look in the Developer Console (alt-equals). For build342, the build tree address is http://olpc.download.redhat.com/olpc/streams/development/build342/devel_jffs2/olpc-redhat-stream-development-build-342-20070326_1758-devel_jffs2-tree.tar.bz2


* At the "Type any key to interrupt automatic startup" key, press a key. At the "ok" prompt, type "save-nand disk:\nand.img" and press return. The contents of the NAND will be backed up to the nand.img file on the USB disk. The "ok" prompt will return when the copy has finished, and you can then power the laptop off with the power button.
* Make sure you have the <tt>mtd-utils</tt> package installed on your non-XO machine. It provides /usr/sbin/mkfs.jffs2 and /usr/sbin/sumtool.


* Move to the "target" laptop, and insert the USB disk. Again, interrupt at the prompt, and at the ok prompt type "copy-nand disk:\nand.img". This will copy from nand.img to the internal NAND. When back at the ok prompt, power off, remove the usb disk, and power on again to load from the new NAND image.
* On the non-XO machine, run:
** <tt>mkdir jffs2</tt>
** <tt>cd jffs2</tt>
** <tt>tar xjf ~/olpc-redhat-stream-development-build-342-20070326_1758-devel_jffs2-tree.tar.bz2</tt>

* The jffs2/ directory will now look similar to the root file system of the NAND. We're going to rsync from the laptop to the other machine, which will copy over the files on the NAND that aren't already in the build tree.

* If you've logged into sugar and want the user to see the welcome prompt with your image, you can <tt>rm /home/olpc/.sugar/default/config</tt>.

* <tt>init 1</tt> on the XO machine.

* Bring up networking on the XO and other machine; they need to be able to communicate over ssh.

* On the XO:
** <tt>rsync -a / --exclude=/sys --exclude=/proc --exclude=/dev --exclude=/var/lib/stateless foo@bar.com:/home/foo/jffs2</tt>

* On the other machine, once the XO's prompt has returned and the rsync is finished:
** <tt>sudo /usr/sbin/mkfs.jffs2 -n -e 128KiB -r jffs2/ -o jffs2-pre.img</tt>
** <tt>sudo /usr/sbin/sumtool -n -p -e 128KiB -i jffs2-pre.img -o jffs2.img</tt>

The jffs2.img file is now your image -- you can copy it to a USB disk, and write it to a laptop by interrupting the Open Firmware boot and saying <tt>copy-nand disk:\jffs2.img</tt>.


[[Category:Developers]]
[[Category:Developers]]

Revision as of 21:59, 29 March 2007

  This page is monitored by the OLPC team.

This page describes how to create a jffs2 image from a laptop's internal NAND, producing an image that can be flashed onto a different XO. The laptop that is being backed up is the "host" laptop, and the laptop receiving the contents of the host laptop is the "target" laptop.

Steps:

  • Make the modifications on the host laptop that you want to be present in the generated image. If you've logged into sugar and want the user to see the welcome/login prompt again, you can rm /home/olpc/.sugar/default/config.
  • Insert a Windows-formatted (VFAT) USB disk into the host laptop, and reboot.
  • At the "Type any key to interrupt automatic startup" key, press a key. At the "ok" prompt, type "save-nand disk:\nand.img" and press return. The contents of the NAND will be backed up to the nand.img file on the USB disk. The "ok" prompt will return when the copy has finished, and you can then power the laptop off with the power button.
  • Move to the "target" laptop, and insert the USB disk. Again, interrupt at the prompt, and at the ok prompt type "copy-nand disk:\nand.img". This will copy from nand.img to the internal NAND. When back at the ok prompt, power off, remove the usb disk, and power on again to load from the new NAND image.