Programming eMMC on i.MX platforms
Published on April 21, 2020
This post intends to answer the question of programming the eMMC memory you can find on our devices. Although there are many different approaches available based on Linux or the MFG Tools, this post will focus on two solutions provided under U-Boot.
Solution #1: Using U-Boot USB Mass Storage Gadget
This feature is fully explained here:
Here is a quick summary:
- Plug a micro-USB cable from your host machine to the target
- Connect the board serial output (console) to your computer
- On the host machine, start a terminal software such as
minicom
for Linux orTeraTerm
for Windows - Set the connection baudrate to 115200 with no hardware flow control
- On the host machine, start a terminal software such as
- Power up the board and stop auto-boot process to get U-Boot prompt
- Simply enter any character on the terminal software to stop auto-boot
- Enable the UMS Gadget for the eMMC . (If your emmc is mmc 1, use 1 instead of 0)
- Inside uboot type the following command:
=> ums 0 mmc 0:0
- At this stage you should now see a new USB drive attached, you can now flash it
- On Linux you can simply use the dd utility
~/$ zcat [your image name].img.gz | sudo dd of=/dev/sdX bs=1M
-
- On Windows we recommend using the Etcher utility to flash the eMMC: balena-etcher
Solution #2: Using Fastboot
Here is a quick summary:
- Connect the board serial output (console) to your computer
- On the host machine, start a terminal software such as
minicom
for Linux orTeraTerm
for Windows - Set the connection baudrate to 115200 with no hardware flow control
- On the host machine, start a terminal software such as
- Power up the board and stop auto-boot process to get U-Boot prompt
- Simply enter any character on the terminal software to stop auto-boot
- Go into Fastboot Mode on the Board
- This can be done by simply using the following command in u-boot on the board:
=> fastboot 0
- Please download android platform tools from the following link and install it.
- Plug a USB cable from your host machine to the target (either micro-USB or TypeC)
- For Android, please use the flashing script provided
$ ./device/boundary/scripts/flash_fastboot.sh
- For other OSes, first make sure your U-Boot is up-to-date (2022.04+)
$ gunzip image.img.gz
$ img2simg image.img image.simg
$ fastboot flash emmc image.simg
Solution #3: Auto Programming in Uboot Using SD Card or USB Flash Drive
Here is a quick summary:
- Get the autoprogram_emmc package using the following command:
boundary@boundary:~/$ wget -r -np -nH -R "index.html*" \
linode.boundarydevices.com/autoprogram_emmc/
boundary@boundary:~/$ cd autoprogram_emmc/ && chmod +x *.sh
- Copy your image file to the same directory as scripts. (Lets assume your image file name is ubuntu.img.gz)
- Determine whether your eMMC is "mmc 0" or "mmc 1" using the following command in uboot:
=> mmc list
FSL_SDHC: 0 (eMMC)
FSL_SDHC: 1 (SD)
- Run the following command on your host machine: (here we assume that emmc is: mmc 0)
~/autoprogram_emmc$ ./create_autoprogram_image.sh 0 ubuntu.img.gz out.img
- At this stage the out.img image is created, you can now flash it onto your SD Card or USB flash drive:
- On Linux we recommend the dd utility
~/autoprogram_emmc$ sudo dd if=out.img of=/dev/sdX bs=1M
-
- On Windows we recommend using Alex Page's USB Image Tool
- In addition, you can use the etcher utility to flash the eMMC: balena-etcher
- On Windows we recommend using Alex Page's USB Image Tool
- Put the SD Card or USB flash drive onto the board, turn on the board, and let it automatically flash emmc. You can also monitor the process through serial console.
Solution #4: Using U-Boot 'gzwrite' command manually
This feature is fully explained here:
Here is a quick summary:
-
- Connect the board serial output (console) to your computer
- On the host machine, start a terminal software such as
minicom
for Linux orTeraTerm
for Windows - Set the connection baudrate to 115200 with no hardware flow control
- On the host machine, start a terminal software such as
- Power up the board and stop auto-boot process to get U-Boot prompt
- Simply enter any character on the terminal software to stop auto-boot
- Load the gzipped image into RAM
- This can be done by reading the image from USB, TFTP or MMC
- Below is an example if the image is copied on a SD Card
- Connect the board serial output (console) to your computer
=> load mmc 0 10008000 my.img.gz
- Once loaded, you can flash the image onto the eMMC
Contact us if you have any questions or comments!