Last edited 3 weeks ago

How to configure U-Boot to support Fastboot mode

Applicable for STM32MP13x lines, STM32MP15x lines

This article explains how to configure U-Boot to support Fastboot mode.

1 Fastboot[edit source]

Fastboot is a protocol that was originally created for Android and is primarily used to modify the flash filesystem via a USB connection from a host computer.

2 Configure U-Boot to support Fastboot mode[edit source]

Fastboot is supported in U-Boot but it is not necessarily enabled by default.
A U-Boot binary, and so a fip, can support only one mass storage device for Fastboot.
For instance, if a U-Boot is configured to support Fastboot on eMMC, it cannot be used to program the SD card with Fastboot.

U-Boot configuration must be done according to the mass storage boot device:

  • SD card is on mmc0
  • eMMC is on mmc1

More details can be found in STM32CubeProgrammer flashlayout.

To enable Fastboot or modify Fastboot configuration, U-Boot configuration must be modified. This can be done with the SDK.

Warning white.png Warning
The prerequisites from the Cross-compile with OpenSTLinux SDK article must be executed.

2.1 With menuconfig[edit source]

U-Boot configuration for Fastboot can be done by using make menuconfig in U-Boot source code.
For example, to support Fastboot on SD card on STM32MP157F-EV1 More info green.png, following steps have to be done :

  • First of all, mmc device number must be identified. Information can be seen here.
    For the STM32MP157F-EV1 Evaluation board More info green.png, SD card is on mmc0.
  • Generate the configuration for the board:
make stm32mp15_defconfig
  • Configure Fastboot
make menuconfig

For mmc0 (SD card)

Device Drivers  --->  
    Fastboot support  --->
        [*] Enable USB fastboot gadget
        (0xC0000000) Define FASTBOOT buffer address
        (0x02000000) Define FASTBOOT buffer size
        [*] Enable FASTBOOT FLASH command
        (0) Define FASTBOOT MMC FLASH default device
        [ ] Enable EMMC_BOOT flash/erase
        [ ] Enable eMMC userdata partition flash/erase
        [*] Enable the 'oem format' command
        [ ] Enable the 'oem partconf' command 
        [ ] Enable the 'oem bootbus' command

For mmc1 (eMMC)

Device Drivers  --->  
    Fastboot support  --->
        [*] Enable USB fastboot gadget
        (0xC0000000) Define FASTBOOT buffer address
        (0x02000000) Define FASTBOOT buffer size
        [*] Enable FASTBOOT FLASH command
        (1) Define FASTBOOT MMC FLASH default device
        [*] Enable EMMC_BOOT flash/erase
        (mmc1boot0) Target name for updating EMMC_BOOT1
        (mmc1boot1) Target name for updating EMMC_BOOT2
        [*] Enable eMMC userdata partition flash/erase
        (mmc1) Target name for updating EMMC_USER
        [*] Enable the 'oem format' command
        [*] Enable the 'oem partconf' command 
        [*] Enable the 'oem bootbus' command
  • Build u-boot
make DEVICE_TREE=stm32mp157f-ev1 all
  • Generate the fip
fiptool update \
   --nt-fw u-boot-nodtb.bin  \
    --hw-config u-boot.dtb \
    <FIP location>/fip-stm32mp157c-ev1-optee.bin

2.2 With fragments[edit source]

U-Boot configuration for Fastboot can be done by adding a fragment to the default configuration.
The fragment, to apply, depends on the chosen boot storage:

  • SD card is on mmc0, then it is the fragment fragment-04-fastboot_mmc0.fb_cfg
  • eMMC is on mmc1, then it is the fragment fragment-05-fastboot_mmc1.fb_cfg

More details can be seen in STM32CubeProgrammer flashlayout.

Fragments are delivered in the STM32 MPU Embedded Software Developer Package. They are also available in GitHub:


For example, to support Fastboot on SD card, on STM32MP157F-EV1 More info green.png, following steps have to be followed:

  • First of all, mmc device number must be identified.

For the STM32MP157F-EV1 Evaluation board More info green.png SD card is on mmc0.

  • Append the corresponding fragment to the default configuration
cat ../fragment-04-fastboot_mmc0.fb_cfg >> configs/stm32mp15_defconfig
  • Build U-Boot as usual with the SDK
make -f $PWD/../Makefile.sdk UBOOT_DEFCONFIG=stm32mp15_defconfig DEVICETREE=stm32mp157f-ev1 all