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/

Hi @mbessler,
is it working for you?
are you able to flash custom uboot into emmc and boot from there.
do you have any debug logs it would very helpful.

Thanks & Regards,
Musthafa av

@Musthafa yes, it is working. I don’t have debug logs. Where is it failing for you?

Hi,
it is booting the imx-boot image, but looks like the imx-boot image and wic image is not flashing. please find the attched logs.

U-Boot SPL 2020.04-5.7.1-devel+git.35d43dd2f823 (Nov 30 2022 - 07:55:49 +0000)
DDRINFO: start DRAM init
DDRINFO: DRAM rate 4000MTS
Training FAILED
Quad die, dual rank failed, attempting dual die, single rank configuration.
DDRINFO: start DRAM init
DDRINFO: DRAM rate 4000MTS
DDRINFO:ddrphy calibration done
DDRINFO: ddrmix config done
Normal Boot
Trying to boot from BOOTROM
Find FIT header 0x4803a7a0, size 969
Need continue download 1024
Download 841072, total fit 842192
NOTICE: BL31: v2.2(release):toradex_imx_5.4.70_2.3.0-g2fa8c6349e
NOTICE: BL31: Built : 12:30:42, May 17 2022

U-Boot 2020.04-5.7.1-devel+git.35d43dd2f823 (Nov 30 2022 - 07:55:49 +0000)

CPU: i.MX8MP[8] rev1.1 1800 MHz (running at 1200 MHz)
CPU: Commercial temperature grade (0C to 95C) at 34C
Reset cause: POR
DRAM: 2 GiB
MMC: FSL_SDHC: 1, FSL_SDHC: 2
In: serial
Out: serial
Err: serial
Model: Toradex Verdin iMX8M Plus Quad 2GB V1.0B, Serial# 06849286
Carrier: Toradex Verdin Development Board V1.1A, Serial# 10807567

BuildInfo:

  • ATF 2fa8c63
  • U-Boot 2020.04-5.7.1-devel+git.35d43dd2f823

Setting variant to nonwifi
Detect USB boot. Will enter fastboot mode!
Net: eth1: ethernet@30be0000, eth0: ethernet@30bf0000 [PRIME]
Fastboot: Normal
Boot from USB for mfgtools
*** Warning - Use default environment for mfgtools
, using default environment

Run bootcmd_mfg: fastboot 0
Hit any key to stop autoboot: 0

uuu.auto (1.1 KB)

please find the scripts i have used
emmc_dev set to 2 and emmc_ack is set to 1 in CONFIG_EXTRA_ENV_SETTINGS and build is done