Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
stylenone

The Linux autoboot sequence in U-Boot is controlled by the two environment variables called bootdelay and bootcmd.

The bootdelay variable defines a delay, in seconds, before running the autoboot command defined by bootcmd. During the bootdelay countdown, you can interrupt the autobooting by pressing any key. This will let you enter the U-Boot command line interface.

The bootcmd variable defines a command executed by U-Boot automatically after the bootdelay countdown is over. Typically, this would be run netboot to boot Linux from TFTP during development or run mmcboot to boot Linux from the SD Card on deployed units. The latter is how bootcmd is set on the modules at the factory.

In deployed configurations, where boot time to the service provided by your embedded device is critical, you will probably want to set bootdelay to 0:

Code Block
STM32H7-SOM U-Boot > setenv bootdelay 0
STM32H7-SOM U-Boot > saveenv
Saving Environment to UBI... ubi0: detaching mtd2
ubi0: mtd2 is detached
ubi0: default fastmap pool size: 256
ubi0: default fastmap WL pool size: 128
ubi0: attaching mtd2
ubi0: scanning is finished
ubi0: attached mtd2 (name "system", size 31 MiB)
ubi0: PEB size: 4096 bytes (4 KiB), LEB size: 3968 bytes
ubi0: min./max. I/O unit sizes: 1/256, sub-page size 1
ubi0: VID header offset: 64 (aligned 64), data offset: 128
ubi0: good PEBs: 7936, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 5, internal volumes: 1, max. volumes count: 23
ubi0: max/mean erase counter: 2/1, WL threshold: 4096, image sequence 
number: 0
ubi0: available PEBs: 989, total reserved PEBs: 6947, PEBs reserved for bad 
PEB handling: 0
Writing to redundant UBI... done
OK
STM32H7-SOM U-Boot > 

This will make sure that on each power on / reset U-Boot immediately executes the command defined by bootcmd, typically booting Linux from the QSPI Flash.

With bootdelay set to 0 the U-Boot countdown is disabled, so there is a question how you enter the U-Boot command monitor, should you need that for some reason. To do so, push the Ctrl-C keys down on the serial console and don't release them until you have hit the reset button on the baseboard. This will interrupt the U-Boot bootcmd sequence and let you enter the U-Boot command monitor:

Code Block
U-Boot SPL 2019.04- (May 03 2024 - 06:09:05 +0000)
Hit 's' key to enter spl shell:
Trying to boot from SPI


U-Boot 2019.04- (May 03 2024 - 06:09:05 +0000)

Model: STMicroelectronics STM32H7 SOM
DRAM:  32 MiB
SF: Detected n25q512ax3 with page size 256 Bytes, erase size 4 KiB, total 64 MiB
Flash: 128 KiB
MMC:   STM32 SDMMC2: 0
Loading Environment from UBI... ubi0: default fastmap pool size: 256
ubi0: default fastmap WL pool size: 128
ubi0: attaching mtd2
ubi0: scanning is finished
ubi0: attached mtd2 (name "system", size 31 MiB)
ubi0: PEB size: 4096 bytes (4 KiB), LEB size: 3968 bytes
ubi0: min./max. I/O unit sizes: 1/256, sub-page size 1
ubi0: VID header offset: 64 (aligned 64), data offset: 128
ubi0: good PEBs: 7936, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 5, internal volumes: 1, max. volumes count: 23
ubi0: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 0
ubi0: available PEBs: 989, total reserved PEBs: 6947, PEBs reserved for 
bad PEB handling: 0
Read 16384 bytes from volume env1 to d196f520
Read 16384 bytes from volume env2 to d1973540
OK
In:    serial
Out:   serial
Err:   serial
No size specified -> Using max size (2099072)
Read 2099072 bytes from volume splash to d0c00000
Net:   eth0: ethernet@40028000
Hit any key to stop autoboot:  0
STM32H7-SOM U-Boot > <INTERRUPT>

From the command monitor, you would be able to set bootdelay to whatever value makes sense to you.