This guide will show how to mount, read from, and write to the phyCORE-i.MX7 onboard eMMC. In order to follow this guide your phyBOARD-i.MX7 development kit must be booting from SD Card.

Be careful with the fdisk command. You can accidentally delete the contents of other memory devices connected to the system.

Step-by-Step Guide

Viewing available eMMC partition information

  • The eMMC corresponds to /dev/mmcblk2 in Linux when booting from SD Card. You can verify the eMMC partitions by using the following command:

    Target (Linux)

    fdisk -l
    CODE
  • The fdisk command line utility will output disk partition information. Search through the list and verify the eMMC is listed. You should find an entry similar to the following:

    Expected Output

    Disk /dev/mmcblk2: 3.6 GiB, 3850371072 bytes, 7520256 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x243d4084
    
    Device         Boot Start     End Sectors  Size Id Type
    /dev/mmcblk2p1       4096   20479   16384    8M 83 Linux
    /dev/mmcblk2p2      20480 7520255 7499776  3.6G 83 Linux
    CODE

Mounting the eMMC

  • In order to read and write to the eMMC you will need to create a directory and then mount the partition you want to read from to that directory. Follow the steps below to mount partition 1 of the eMMC:

    Target (Linux)

    mkdir temp && mount /dev/mmcblk2p1 temp/
    CODE
  • Check the contents of the eMMC by entering the following: 

    Target (Linux)

    ls temp
    CODE

Writing to the eMMC

  • You can write to the eMMC by using the copy or move commands just like in Linux. To demonstrate, first create a test file.

    Target (Linux)

    echo "Hello World" > test.txt
    CODE
  • Now copy this file to the mounted eMMC:

    Target (Linux)

    cp test.txt temp/
    CODE
  • Verify that the file was written to the eMMC (test.txt should be listed in the output): 

    Target (Linux)

    ls temp
    CODE