TS-7670 eMMC Backup

From embeddedTS Manuals
Revision as of 03:35, 11 November 2014 by Kris (talk | contribs)

The eMMC device is set up like a standard SD card when presented to the system, however it does have a few differences. eMMC offers "enhanced mode" which makes the usually MLC device behave like an SLC device. This setting does decrease the effective device size, however the benefit of reliability greatly makes up for it. Another option that eMMC offers is "write reliability." This setting changes the internal behavior of the eMMC, meaning that if a power-off occurs during a write, the guaranteed loss is limited to the currently written 512 byte sector. Aside from those two settings, the device will appear as a standard SD card, with the same partition setup as our standard SD card size, save for the maximum size of the linux partition, the second partition. The first partition contains the raw bootstream (kernel and initramfs in one binary blob); the second partition houses the Debian linux filesystem.

Kernel

Note: At the time of writing this, the implementation of eMMC is still in early development. The instructions below may change as the process is finalized


Since the eMMC device behaves like an SD card, and is partitioned the same, the easiest way to get the kernel on the eMMC device is to just dd the kernel partition. If a bootable SD card is in slot 0, the following command can be used when booted from either said SD card, or eMMC:

kernel_from_sd

In using a USB device to update the kernel of the eMMC, the process is slightly different. The following script expects the file /mnt/usbdev/kernelpart.dd The kernelpart.dd file is created by dd'ing the first partition of a bootable SD card to that file.

kernel_from_usb

Both scripts above will take a few moments and will return with an exit of 0, and print "prog_ok=1" upon success. This command will also destroy and re-create the partition table. As long as the factory partition scheme is used, this command is safe to run without having to update the eMMC filesystem as well.


See the section on our USB update mechanism for more information about utilizing this process.

Filesystem

The process to update the filesystem on eMMC simply uses a tarball of the desired linux filesystem. Technologic Systems strongly recommends to do all development on an SD card and later create a tarball from that Debian filesystem. This allows for easy creation of a tarball from the existing master SD card to be used in production processes.

The tarball can be created from an existing filesystem. A command like the following should be all that is needed.

tar cvf rootfs.tar -C /mnt/source_fs_root/ .

This command will create rootfs.tar in the current directory from the filesystem tree root located at /mnt/source_fs_root/ Many implementations of `tar` will not have issues with creating the output file in the same directory as input. However it is recommended to keep the output file in a different directory than the source, just in case.

This tarball can be used in conjunction with scripts in our initramfs to flash the eMMC device.


Copy rootfs.tar to the root Debian folder (partition 2) of a bootable SD card. Be sure there is enough space available. Our standard image has enough free space to allow this. Boot from the SD card to the initramfs, and use the following command:

filesystem_from_sd

Alternatively, the rootfs.tar can be copied to the root directory of the first partition of a USB drive:

filesystem_from_usb

In this case, the script expects the file /mnt/usbdev/rootfs.tar to exist.


Output from the commands will look like the following:

prog_ok=1



WARNING: The `filesystem_from_*` commands will completely format any existing data that is on the eMMC linux root partition


Using filesystem_from_* when booted from eMMC

This is a special consideration that needs to be addressed. Until a process is defined and tested, be sure to only use the filesystem_from_* commands if the SBC is booted from SD.