#if !defined(CONFIG_CMD_BUTTON) ||\
!defined(CONFIG_CMD_SLEEP) ||\
!defined(CONFIG_CMD_LED) ||\
+ !defined(CONFIG_CMD_ITEST) ||\
!defined(CONFIG_CMD_SETEXPR)
- #error "Commands setexpr, sleep, button and led{on, off} are required for recovery"
+ #error "Commands setexpr, itest, sleep, button and led{on, off} are required for recovery"
#endif
#if !defined(CONFIG_GPIO_RESET_BTN)
"echo - 3s for web based recovery;"
#define SCRIPT_HTTP_PART_2 \
- "elif test $cnt -ge 3; then " \
+ "elif itest $cnt >= 3; then " \
"echo HTTP server is starting for firmware update...;" \
"setenv stop_boot 1;" \
"echo;" \
"httpd;" \
- "elif test $cnt -lt 3; then "
+ "elif itest $cnt < 3; then "
#else
#define SCRIPT_HTTP_PART_1 ""
#define SCRIPT_HTTP_PART_2 \
- "elif test $cnt -lt 5; then "
+ "elif itest $cnt < 5; then "
#endif
#define CONFIG_ENV_BTN_RECOVERY_SCRIPT \
"if button; then " \
"sleep 600;" \
"setenv cnt 0;" \
+ "setenv stop_boot;" \
"echo Keep button pressed for at least:;" \
SCRIPT_HTTP_PART_1 \
"echo - 5s for U-Boot console;" \
"echo - 7s for network console;" \
"echo;" \
- "while button; do " \
+ "while button && itest $cnt < 0xA; do " \
"ledon;" \
"sleep 300;" \
"echo . \'\\\\c\';" \
"sleep 600;" \
"setexpr cnt $cnt + 1;" \
"done;" \
- "echo $cnt seconds;" \
+ "echo 0x$cnt seconds;" \
"echo;" \
- "if test $cnt -ge 7; then " \
+ "if itest $cnt >= 0xA; then " \
+ "echo \\#\\# Error: 10s limit reached!;" \
+ "echo Continuing normal boot...;" \
+ "echo;" \
+ "elif itest $cnt >= 7; then " \
"echo Starting network console...;" \
"setenv stop_boot 1;" \
"echo;" \
"startnc;" \
- "elif test $cnt -ge 5; then " \
+ "elif itest $cnt >= 5; then " \
"echo Starting U-Boot console...;" \
"setenv stop_boot 1;" \
"echo;" \
"echo \\#\\# Error: button was not pressed long enough!;" \
"echo Continuing normal boot...;" \
"echo;" \
- "fi;"\
+ "fi;" \
+ "setenv cnt;" \
"fi\0"
#endif /* CONFIG_BTN_RECOVERY_SCRIPT */