Last edited 2 months ago

How to configure U-Boot to support Fastboot mode

Applicable for STM32MP13x lines  STM32MP15x lines    STM32MP23x lines  STM32MP25x lines

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

1. Fastboot[edit | 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, see U-Boot Documentation android/fastboot.rst for details.

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

Fastboot is supported in U-Boot but it is not necessarily enabled by default with configuration symbols defined in fastboot Kconfig file .

A U-Boot binary, and so a fip, can support only one mass storage device for Fastboot, defined in the used defconfig file.
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, for STMicroelectronics boards we have:

  • SD card is on mmc0.
  • eMMC is on mmc1.

Refer to STM32CubeProgrammer flashlayout for more information.

To enable Fastboot or to modify the Fastboot configuration, the 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 | edit source]

U-Boot configuration for Fastboot can be done by using make menuconfig in the U-Boot source code.
Follow these steps to enable Fastboot support on SD card on STM32MP157F-EV1 More info green.png:

  • Identify the mmc device number. 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 | edit source]

U-Boot configuration for Fastboot can be done by adding a fragment to the default configuration.
The fragment is different depending on the chosen boot storage:

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

Refer to STM32CubeProgrammer flashlayout for more information.

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


Follow these steps to enable Fastboot support on SD card on STM32MP157F-EV1 More info green.png:

  • Identify the mmc device number.

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 using the SDK:
make -f $PWD/../Makefile.sdk UBOOT_DEFCONFIG=stm32mp15_defconfig DEVICETREE=stm32mp157f-ev1 all