Backing Up OpenMoko

From SERG

Jump to: navigation, search

Once you get comfortable with the FreeRunner soon one starts experimenting different distribution and applications that daily get released by the community. Even if you are just moving straight soon you might want to make backups of your working images. In this short tutorial we will make a backup of our FR.

Official Method

I am just going to introduce you with the official technique using dfu-util for completeness but along with several others we find that the backups are always buggy, especially the kernel backup. Remember that only backing up with dfu-util is buggy and it is fine to use it for flashing the images.

Instructions on how to install and configure dfu-util are provided in DFU-UTIL. But to make life easier we have the binary available at DFU_UTIL.

After you download it don't forget to add the executable bit on.

 chmod +x dfu-util

To run dfu-util, you need to have /proc/bus/usb mounted and working. Check by running the following command:

 ls /proc/bus/usb

If it is empty then do as follows:

 sudo mount -t usbfs usbfs /proc/bus/usb

Make the following entry in /etc/fstab to enable auto-mounting.

 usbfs   /proc/bus/usb   usbfs   defaults

Now you need to boot your phone into the NOR Boot Menu:

   * Ensure your phone is connected directly to the host computer by the USB data cable.
   * Ensure that you execute all dfu-util commands as root (sudo will also do fine)
   * Power off the phone
   * Hold down AUX
   * Press POWER until the Boot Menu appears 

Once the NOR boot menu shows up then you can run dfu-util command. Using the --list option, you can list the available DFU capable devices, their configuration, interface and alternate settings. An in-depth understanding can be built with this article about boot loaders.

 sudo ./dfu-util --list

The backup commands are the following:

 sudo ./dfu-util -a kernel -R -U good-kernel.bin
 sudo ./dfu-util -a rootfs -R -U good-rootfs.jffs2

It is a good practice to have complete backups. Normally we are not interested in the boot loader, the splash screen and the uboot environment because they do not directly affect the functionalities required from the system that we are changing or enhancing.

 sudo ./dfu-util -a splash -R -U good-splash.bin
 sudo ./dfu-util -a u-boot -R -U good-u-boot.bin
 sudo ./dfu-util -a u-boot_env -R -U good-u-boot_env.bin

For more detail visit Flash Backup.

Common Sense

Common sense is sometimes the best solution as it is commonly understood and known to be good. This is how we do it at SERG:

  1. On the phone:
 mkdir /var/tmp/root
 mount -t jffs2 /dev/mtdblock6 /var/tmp/root
  1. On the USB-attached host:
 sudo ssh root@192.168.0.202 "mkfs.jffs2 -d /var/tmp/root -e 128 --pad --no-cleanmarkers -x lzo" | pv -W > rootfs_backup.jffs2
 sudo scp root@192.168.0.202:/boot/uImage kernel_backup.bin

If you want to be sure that the usb interface is setup then run the following command. If you can't find "usb0" in the output then follow the official method to get it working.

 ifconfig

I have also found out that the new releases are a bit sensitive to Network Manager on Ubuntu distribution (not sure about others). Do not let network manager save a configuration with the name similar to "Auto USB0".

Their can be other smart alternatives and if you find some do update this page :)