Programatic way to stop autoboot?


Hi, is there any programatic way that I can skip the autoboot without pressing any key and also programatic way to mimic boot poplar board with pressing USB_BOOT button?

Thank you.


If you are talking about the U-Boot autoboot, you can disable it by setting environment ‘bootdelay’ as -1. For USB_BOOT, we have no idea, as it’s been handled in HiSilicon proprietary firmware.


Hi Shawn, I am talking how to stop the autoboot while the prompt “Hit any key to stop autoboot” pop up.
Is there a programatic way instead of hitting the keyboard to stop autoboot?


I’m not sure what ‘programatic way’ means. But did you try to set environment ‘bootdelay’ as -1, like what I suggested in the first reply?


Like Shawn I don’t find it very clear what you mean by programatic. Given u-boot’s job is more or less to start programs and that the role of autoboot delay is to delay the point at which programs launch then where does the program run?

If you are trying to automate the board boot process and control it from somewhere else (e.g. for automatic testing) then you already have a programatic way to disrupt the normal boot process. Just set the autoboot delay relatively high (5 or 10 seconds) and use an expect-like tool to wait for the “Hit any key…” message and send a key press and some alternative commands via the UART whenever you want to run a custom boot flow.


Hi Shawn and Daniel, I have tried to set the bootdelay, at first it’s not work because I didnt “saveenv” to persistent memory, then after i did that, it’s working now

Here come another question, how can I execute a command (eg “run abc.scr” ) automatically right after the countdown is interrupted?

Sorry that i am really new to u-boot. Thanks


You can’t run a script automatically after the countdown is interrupted;
by sending a keypress you just told it not to run the boot scripts.

When the autoboot timer expires then u-boot automatically runs the
contents of the bootcmd variable. If you want something different to
happen automatically at boot then you should change the bootcmd


Maybe I change a way to ask the question, can I do the recovery by loading the install script using TFTP, which as described in the poplar debian git, but in automatic way?

Link to Poplar Debian Recovery, Flash images onto the Poplar board eMMC, step 4 (



Yes. You could do this simply by creating a very complex boot command but in practice it will be difficult for you to decide when to do a normal boot and when to do a recovery boot (e.g. when the normal boot goes wrong and won’t boot then how do you trigger a recovery boot).

For that reason I find it much more robust to simply point an expect (or pexpect) script at the serial port and send the recovery commands from another machine when needed.


yea, you gave a good point.
I should just use expect to do it