Scroll to navigation

mmc-utils(1) General Commands Manual mmc-utils(1)

NAME

mmc - a tool for configuring MMC storage devices

SYNOPSIS

mmc [options] [ mmc-block-device]...

DESCRIPTION

mmc-utils is a single-threaded tool that will perform a specified type of mmc action as specified by the user.
The typical use of mmc-utils is to access the mmc device either for configuring or reading its configuration registers.

OPTIONS

Read and prints the extended csd register
Write value at offset to the device's extcsd
Print the boot partitions write protect status
Set the boot partition write protect status for the device.
If number is passed (0 or 1), only protect that specified eMMC boot partition, otherwise protect both.
It will be write-protected until the next boot.
Set the write protect configuration for the specified region of the user area for the device.
start-block specifies the first block of the protected area.
blocks specifies the size of the protected area in blocks.
NOTE! The area must start and end on Write Protect Group boundaries, Use the "writeprotect user get" command to get the Write Protect Group size.
type is one of the following:
Clear temporary write protection.
Set temporary write protection.
Set write protection until the next power on.
Print the user area's write protect configuration for the device.
Set the eMMC data sector size to 4KB by disabling emulation on the device.
Create general purpose partition for the device.
NOTE! This is a one-time programmable (irreversible) change.
To set enhanced attribute to general partition being created set enh-attr to 1 else set it to 0.
To set extended attribute to general partition set enh-attr to 1,2 else set it to 0.
dry-run is one of the following:
PARTITION_SETTING_COMPLETED in the extcsd will get set and the partitioning operation will take effect and be finalized.
more partitioning settings are still to come - partitioning operation will not take effect.
These changes will not take effect neither now nor after a power cycle.
Enable the enhanced user area for the device.
NOTE! This is a one-time programmable (irreversible) change. dry-run is as above.
Enable write reliability per partition for the device.
NOTE! This is a one-time programmable (irreversible) change. dry-run is as above.
Print the response to STATUS_SEND (CMD13).
Enable the boot partition for the device. Disable the boot partition for the device if is boot-partition set to 0.
To receive acknowledgment of boot from the card set send-ackn to 1, else set it to 0.
Set Boot Bus Conditions.
boot-mode is one of the following: single_backward, single_hs, or dual.
reset-boot-bus-conditions is one of the following: x1 or retain.
boot-bus-width is one of the following: x1, x4, or x8.
Enable the eMMC BKOPS feature on the device. The auto (AUTO_EN) setting is only supported on eMMC 5.0 or newer.
NOTE! Setting manual (MANUAL_EN) is one-time programmable (irreversible) change.
mode is one of the following:
Auto bkops is set
Manual bkops is set
Permanently enable the eMMC H/W Reset feature on the device.
NOTE! This is a one-time programmable (irreversible) change.
Permanently disable the eMMC H/W Reset feature on the device.
NOTE! This is a one-time programmable (irreversible) change.
Send Sanitize command to the device. This will delete the unmapped memory region of the device.
Program authentication key which is 32 bytes length and stored in the specified file.
Also you can specify '-' instead of key file path to read the key from stdin.
NOTE! This is a one-time programmable (irreversible) change.
Counter value for the rpmb-device will be read to stdout.
Blocks of 256 bytes will be read from rpmb-device to output file or stdout if '-' is specified. If key is specified - read data will be verified.
Block of 256 bytes will be written from data file to rpmb-device.
Also you can specify '-' instead of key file path or data file to read the data from stdin.
Enable the eMMC cache feature on the device.
NOTE! The cache is an optional feature on devices >= eMMC4.5.
Disable the eMMC cache feature on the device.
NOTE! The cache is an optional feature on devices >= eMMC4.5.
Print CSD data from device-path. The device path should specify the csd sysfs file directory.
Print CID data from device-path. The device path should specify the cid sysfs file directory.
Print SCR data from device-path. The device path should specify the scr sysfs file directory.
Run Field Firmware Update with image-file-name on the device.
[chunk-bytes] is optional and defaults to its max - 512k. should be in decimal bytes and sector aligned.
if [chunk-bytes] is omitted, mmc-utils will try to run ffu using the largest possible chunks: max(image-file, 512k).
Send Erase CMD38 with specific argument to the device.
NOTE!: This will delete all user data in the specified region of the device.
type is one of the following: legacy, discard, secure-erase, secure-trim1, secure-trim2, or trim.
Send GEN_CMD (CMD56) to read vendor-specific format/meaning data from the device.
NOTE!: [arg] is optional and defaults to 0x1. If [arg] is specified, then [arg] must be a 32-bit hexadecimal number, prefixed with 0x/0X. And bit0 in [arg] must be 1. Normally this command is aimed to extract a device-health info from the device.
Issues a CMD0 softreset, e.g. for testing if hardware reset for UHS works

Does the alternative boot operation and writes the specified starting blocks of boot data into the requested file. Note some limitations:
1)
The boot operation must be configured first, e.g. via bootbus and/or bootpart commands
2)
The MMC must currently be running at the bus mode that is configured for the boot operation (HS200 and HS400 not supported at all).
3)
Only up to 512K bytes of boot data will be transferred.
4)
The MMC will perform a soft reset, if your system cannot handle that do not use the boot operation from mmc-utils.
Show the help
Show detailed help for that specific cmd or subset of commands.

RPMB COMMANDS

The RPMB partition on the eMMC devices is a special area used for storing cryptographically safe information signed by a special secret key.
To write and read records from this special area, authentication is needed.
The RPMB area is *only* and *exclusively* accessed using ioctl()s from user-space.
RPMB commands are send using the mmc multi-ioctl, thus ensures that the atomic nature of the rpmb access operation.
The rpmb device given as a parameter to the rpmb commands is not a block device but a char device.
This was done to help the mmc driver to account for some of the rpmb peculiarities.

EXAMPLES

RPMB examples

Program rpmb key using the stdin option:

$ echo -n AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHH | mmc rpmb write-key /dev/mmcblk0rpmb -

Read 2 blocks starting address 2 and output the received content to stdout. Verify the received frames using the key (not mandatory):

$ echo -n AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHH | mmc rpmb read-block /dev/mmcblk0rpmb 0x02 2 -

Read 2 blocks without verification starting address 2 and output the received content to /tmp/block:

$mmc rpmb read-block /dev/mmcblk0rpmb 0x02 2 /tmp/block

Write a string of 'a's to address 2. both the input and key uses stdin interface:

$ (awk 'BEGIN {while (c++<256) printf "a"}' | echo -n AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHH) | mmc rpmb write-block /dev/mmcblk0rpmb 0x02 - -

Field Firmware Update (ffu) examples

Do ffu using max-possible chunk size: If the fluf size < 512k, it will be flushed in a single write sequence.

$ mmc ffu IO4e0aC2056001801M1100042AE1.fluf /dev/mmcblk0

Same as above, this time use a 4k chunks:

$ mmc ffu IO4e0aC2056001801M1100042AE1.fluf /dev/mmcblk0 4096

AUTHORS

mmc-utils was written by Chris Ball <cjb@laptop.org> and <chris@printf.net>.
It is currently maintained by Ulf Hansson <ulf.hansson@linaro.org>.

REPORTING BUGS

Report bugs to the mmc mailing list <linux-mmc@vger.kernel.org>.

SEE ALSO

For further documentation see README.
A short intro - https://docs.kernel.org/driver-api/mmc/mmc-tools.html
official git tree - https://git.kernel.org/pub/scm/utils/mmc/mmc-utils.git

April 2024 User Manual