Flashing my own uboot and wic (w/ rootfs etc.) image to eMMC on Verdin IMX8MPlus with UUU

I’ve been poking around Toradex’s Artifactory and documetation to find an example uuu file that actually flashes
the bootloader to the boot partition and a disk image (ie .wic, that is, including partition table and several partitions)
to the eMMC on a Verdin IMX8MPlus.

All I could find so far are examples of how to load u-boot/imxboot, kernel, etc into RAM and run it that are in some of the builds in the recovery/ subdir.
But I already have that working, now looking at how to flash my own.

And… no, I do NOT want to use the Toradex Easy Installer.

I’ve seen examples that use something like SDP*: write -f <image> -offset 0x??? for the bootloader.
Does that write to the boot0 and boot1 eMMC partitions, just one of them?
I’ve also seen examples using u-boot via fastboot to (apparently) flash the bootloader…
How do I write the disk image?

UUU isn’t particularly well documented, which makes this process more difficult to figure out at first.

1 Like

I ended up figuring it out myself by cobbling together pieces from various sources and experimentation.
My .uuu script looks something like this:

uuu_version 1.4.127

# Load bootloader image into RAM over SDP
SDPS: boot -f imx-boot-<MACHINE>-sd.bin-flash_evk_emmc_fastboot
SDPS: done
# Setup uboot environment for flashing eMMC [must have emmc_dev set in (default) environment, for Verdin IMX8MP, this is set to 2]
FB: ucmd setenv fastboot_dev mmc
FB: ucmd setenv mmcdev ${emmc_dev}
FB: ucmd mmc dev ${emmc_dev}
#  Use FastBoot to send the bootloader image over SDP, and make FastBoot flash it into the 'bootloader' HW partition of ${fastboot_dev}
FB: flash bootloader imx-boot-<MACHINE>-sd.bin-flash_evk_emmc_fastboot
# Determine if BOOT_ACKs are desired (appears that BOOT_ACK should be used for eMMC fast boot) [I have emmc_ack set to 1 in (default) environment]
FB: ucmd if env exists emmc_ack; then ; else setenv emmc_ack 0; fi;
# Flash .wic image to main area of eMMC [.wic is a sparse, whole disk image containing the partition table and partition data, generated by bitbake based on layout in a .wks file]
FB: flash -raw2sparse all my-factory-image-emmc-<MACHINE>.wic
# Done flashing eMMC
FB: done

as mentioned in the commented lines above, you have to set emmc_dev (2 for Verdin IMX8MP) and emmc_ack (turned on, ie. 1) in your default environment. I’ve added it to CONFIG_EXTRA_ENV_SETTINGS in my board config header in include/configs/