TS-7800-V2 EMMC: Difference between revisions

From embeddedTS Manuals
No edit summary
No edit summary
Line 1: Line 1:
This board includes a Micron eMMC module.  Our off the shelf builds are 4GiB, but up to 64GiB are available for larger builds.  The eMMC flash appears to Linux as an SD card at /dev/mmcblk0.  Our default programming will include one partition programmed with our Debian image.
This board includes a Micron eMMC module.  Our off the shelf builds are 4GiB, but up to 64GiB are available for larger builds.  The eMMC flash appears to Linux as an SD card at /dev/mmcblk0.  Our default programming will include one partition programmed with our Debian image.


The CPU boots out of the boot partitions /dev/mmcblk0boot0 and /dev/mmcblk0boot1.  These are both 16MiB.  The board boots to /dev/mmcblk0boot0 by default, but boot1 can be selected if it has been written with a valid bootloader.  This allows atomic updates in the field of u-boot, but should only be done with care as it can leave your board not booting if a bad image is written before switching the active boot partition.
The CPU boots out of the emmc's hardware boot partitions /dev/mmcblk0boot0 and /dev/mmcblk0boot1.  These are both 16MB, and are separate from the mmcblk0 flash.  Erasing or manipulating /dev/mmcblk0 and its partitions will not affect these hardware partitions.  The board boots to /dev/mmcblk0boot0 by default, but boot1 can be selected if it has been written with a valid bootloader.  This allows atomic updates in the field of u-boot, but should only be done with care as it can leave your board not booting if a bad image is written before switching the active boot partition.
{{Warning|This may need a development board or RMA to recover the board if the CPU fails to boot.  Make certain a valid u-boot is present on a boot device before switching to it.}}
{{Warning|This may need a development board or RMA to recover the board if the CPU fails to boot.  Make certain a valid u-boot is present on a boot device before switching to it.}}
Write a u-boot to mmcblk0boot1 with:
Write a u-boot to mmcblk0boot1 with:

Revision as of 18:50, 7 March 2018

This board includes a Micron eMMC module. Our off the shelf builds are 4GiB, but up to 64GiB are available for larger builds. The eMMC flash appears to Linux as an SD card at /dev/mmcblk0. Our default programming will include one partition programmed with our Debian image.

The CPU boots out of the emmc's hardware boot partitions /dev/mmcblk0boot0 and /dev/mmcblk0boot1. These are both 16MB, and are separate from the mmcblk0 flash. Erasing or manipulating /dev/mmcblk0 and its partitions will not affect these hardware partitions. The board boots to /dev/mmcblk0boot0 by default, but boot1 can be selected if it has been written with a valid bootloader. This allows atomic updates in the field of u-boot, but should only be done with care as it can leave your board not booting if a bad image is written before switching the active boot partition.

WARNING: This may need a development board or RMA to recover the board if the CPU fails to boot. Make certain a valid u-boot is present on a boot device before switching to it.

Write a u-boot to mmcblk0boot1 with:

echo 0 > /sys/block/mmcblk0boot1/force_ro
dd if=/path/to/u-boot.kwb bs=1M of=/dev/mmcblk0boot1

Once the data has been verified as written, the active boot partition can be switched to mmcblk0boot1:

# The argument after enable should be 2 for mmcblk0boot1, or 1 for mmcblk0boot0
mmc bootpart enable 2 1 /dev/mmcblk0

The active partition can be read as part of the extcsd read:

mmc extcsd read /dev/mmcblk0

The eMMC are like SD cards in that they should not be powered down during a write/erase cycle. This eMMC module includes support for setting a fuse for a "Write Reliability" mode, and a "psuedo SLC" mode. With both of these enabled then any writes will be atomic to 512B. If a sector is being written during a power loss, a block is guaranteed to have either the old or new data. This scheme is far more resilient to power loss than more traditional flash media. In cases of old 512B data fsck will still be able to recover a mountable filesystem. In cases where the corrupted file is a database it can still need a mechanism for recovery.

When this pSLC mode is turned on it will reduce the available space to under half, and reduce the write speed.

See our post on preventing filesystem corruption.

The mmc-utils package is used to enable these modes. First determine the exact size of the flash you're using:

mmc extcsd read /dev/mmcblk0 | grep MAX_ENH_SIZE_MULT -A 1
Max Enhanced Area Size [MAX_ENH_SIZE_MULT]: 0x0001cd
 i.e. 1888256 KiB

So in this case, 1888256 KiB is the max size of the enhanced partition. This number should be used for the enh_area command:

mmc write_reliability set -n 0 /dev/mmcblk0
mmc enh_area set -y 0 1888256 /dev/mmcblk0
WARNING: Setting either of those modes is permanent. Using the wrong value it is possible to brick eMMC which will not be covered by the warranty. Evaluation units with fuses set will not be accepted through returns.

After this is run, reboot the board. On all future boots the eMMC will be detected at the smaller size. Changing the enhanced area will erase the drive. After these mmc commands the disk will need to be rewritten.