Autobooting Linux from U-Boot Print

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 sfboot to boot Linux from the QSPI Flash 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:

=> setenv bootdelay 0
=> saveenv
Saving Environment to SPI Flash...
Erasing SPI flash...Writing to SPI flash...done
Valid environment: 1

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:

U-Boot 2017.09-rc1-imxrt-2.5.3 (Mar 31 2021 - 21:21:46 +0300) CPU: i.MX RT117x at 996MHz Model: NXP i.MXRT1174 EVK DRAM: 64 MiB MMC: FSL_SDHC: 0 SF: Detected is25wp128a with page size 256 Bytes, erase size 64 KiB, total 16 MiB In: [email protected] Out: [email protected] Err: [email protected] Net: eth0: [email protected] Hit any key to stop autoboot: 0 => <INTERRUPT>

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