-
Notifications
You must be signed in to change notification settings - Fork 329
Buildin emmc_all script
A "block map" (bmap) of the image file, which essentially records which blocks of the file contain actual data and which are empty or contain only zeros.
bmap-file is created by yocto, which speeds up the flashing process.
Some commands can extract the bootloader from the wic image. This is done by using the "tag" at the end of the bootloader. If you’re building using yocto, there is the uuu_bootloader_tag.bbclass that does this: https://github.com/nxp-upstream/meta-freescale/blob/master/classes/uuu_bootloader_tag.bbclass
without the tag, uuu can’t automatically extract the bootloader and you have to explicitly supply it when calling uuu.
-
load u-boot (="_flash.bin") into the RAM (using SDP/SDPU/SDPV protocol) and execute it.
-
in the last block of the file, you see the "FB" lines. This is the Fastboot protocol. It originates from the Android project, but is just a generic protocol to communicate with the bootloader: https://docs.u-boot.org/en/latest/android/fastboot-protocol.html
Here, you can see two commands being used:
which just calls u-boot commands like setenv and mmc:
https://docs.u-boot.org/en/latest/usage/cmd/env.html (setenv `is an alias of `env set)
https://docs.u-boot.org/en/latest/usage/cmd/mmc.html
One more thing to note: the EMMC (or SD-card, which is similar) has "hardware partitions": https://www.pengutronix.de/en/blog/2020-10-15-anpassen-einer-emmc.html https://www.embeddedartists.com/wp-content/uploads/2020/04/Working_with_eMMC.pdf When booting from emmc, the i.mx looks at the bootpartition switch and boots from one of the two boot partitions.
when using the FB command to flash the bootloader into one of the eMMC’s boot partition, this command is used:
FB: flash -scanterm -scanlimited 0x800000 bootloader _flash.bin
The string bootloader (or bootloader0) is hard-coded in NXP’s own u-boot branch, and tells their u-boot into which hardware-partition the data should be written to.
https://github.com/nxp-imx/uboot-imx/blob/lf_v2025.04/include/fb_fsl.h
#define FASTBOOT_PARTITION_BOOTLOADER "bootloader"
this is used by NXP’s (formerly Freescale → FSL) fastboot implementation:
drivers/fastboot/fb_fsl/fb_fsl_dev.c
drivers/fastboot/fb_fsl/fb_fsl_boot.c
drivers/fastboot/fb_fsl/fb_fsl_partitions.c
This always writes the bootloader to boot partition 1. So if you’re using mainline u-boot, take care because you might have to modify the uuu scripts.
In the end, there is then the call of the mmc partconf subcommand.
https://docs.u-boot.org/en/latest/usage/cmd/mmc.html
The boot_partition value is set to 1, which refers to Boot partition1 enabled for boot.
(for older u-boot versions, partconf might be replaced by hwpartition instead)
For mainline u-boot, grep for these strings:
EMMC_HWPART_BOOT, EMMC_BOOT_PART_, CONFIG_FASTBOOT_MMC_BOOT
Go back to Home