Skip to content

Flashing the eMMC (ST)

Programming the eMMC requires booting from an SD card with a working st-image-weston image. See Flashing an SD Card first.


Default Partition Table

Engicam STM32MP SOMs ship with the eMMC already partitioned. The default GPT layout:

# Name Size Notes
1 metadata1 512 KiB TF-A metadata
2 metadata2 512 KiB TF-A metadata
3 fip-a 4 MiB Firmware Image Package A
4 fip-b 4 MiB Firmware Image Package B
5 u-boot-env 512 KiB U-Boot environment
6 bootfs 64 MiB Kernel + DTB
7 vendorfs 183 MiB Vendor filesystem
8 rootfs 3 GiB Root filesystem
9 userfs 4 GiB User data

MAC Address

The SOM stores its MAC address in the U-Boot environment on mmcblk1p2.
Formatting this partition erases it. To restore it, set it from the U-Boot CLI:

setenv ethaddr "12:34:56:78:9a:bc"
saveenv

Prepare the Files

After building the image, collect the following files from the deploy directory:

build/tmp-glibc/deploy/images/<machine>/

Rename them for the flashing scripts:

Yocto Output Required Name
st-image-weston-...<machine>.tar.xz rootfs.tar.xz
st-image-bootfs-...<machine>.tar.xz bootfs.tar.xz
st-image-userfs-...<machine>.tar.xz userfs.tar.xz
st-image-vendorfs-...<machine>.tar.xz vendorfs.tar.xz
arm-trusted-firmware/tf-a-<machine>-optee-emmc.stm32 tf-a.stm32
arm-trusted-firmware/metadata.bin metadata.bin
fip/fip-<machine>-optee-emmc.bin fip.bin

Copy all renamed files to a USB stick.

Tip

If you want to keep the factory TF-A and FIP (bootloader), skip tf-a.stm32, metadata.bin, and fip.bin.


Flash Procedure

Boot the board from the SD card. Once running:

  • SD card is at /dev/mmcblk0
  • eMMC is at /dev/mmcblk1

Mount the USB stick:

mount /dev/sda1 /mnt

Available Scripts

Script What it flashes
emmc_full_image.sh Full eMMC — creates GPT, installs everything
emmc_bootfs_fs.sh bootfs + vendorfs + rootfs + userfs
emmc_rootfs.sh rootfs only (/dev/mmcblk1p7)
emmc_fip.sh FIP (mmcblk1p3 and mmcblk1p4)
emmc_tfa.sh TF-A (mmcblk1boot0 and mmcblk1boot1)
emmc_tfa_metadata.sh TF-A metadata (mmcblk1p1 and mmcblk1p2)

Run any script with -h for usage details.

Flash Filesystem Only (Keep Bootloader)

emmc_bootfs_fs.sh /dev/mmcblk1 /mnt/emmc

Flash Full Image

emmc_full_image.sh /dev/mmcblk1 /mnt/emmc -p /usr/share/eng-emmc-tools/gpt-emmc

gpt-emmc is the default partition table backup included in the eng-emmc-tools recipe.

STM32MP2 SmarCore

SmarCore modules only support eMMC boot. Do not overwrite the bootloader.
Use emmc_bootfs_fs.sh or emmc_rootfs.sh only (partitions 6–9).


Customize the Partition Layout

To change the GPT layout, boot from SD and use standard Linux tools (gdisk, sgdisk) on /dev/mmcblk1. After saving changes, back up the new layout:

sgdisk --backup=/gpt_emmc_new /dev/mmcblk1

Use gpt_emmc_new as the -p argument to emmc_full_image.sh for future flashing.