From d74880eccc99d9de6d8756c5329fb02b18e2895b Mon Sep 17 00:00:00 2001 From: Shuanglei Tao Date: Mon, 17 Jun 2024 19:08:39 +0800 Subject: [PATCH] add support for failsafe boot via env (#62) To use it in openwrt, run: fw_setenv failsafe 1 --- uboot-mtk-20220606/common/main.c | 8 ++++++++ uboot-mtk-20230718-09eda825/common/main.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/uboot-mtk-20220606/common/main.c b/uboot-mtk-20220606/common/main.c index 46076d93b..ddc20bd18 100644 --- a/uboot-mtk-20220606/common/main.c +++ b/uboot-mtk-20220606/common/main.c @@ -60,6 +60,14 @@ void main_loop(void) efi_launch_capsules(); } + if (env_get("failsafe") != NULL) { + env_set("failsafe", NULL); + env_save(); + + led_control("led", "system_led", "on"); + run_command("httpd", 0); + } + run_command("glbtn", 0); s = bootdelay_process(); diff --git a/uboot-mtk-20230718-09eda825/common/main.c b/uboot-mtk-20230718-09eda825/common/main.c index 10b234a74..34447c8d6 100644 --- a/uboot-mtk-20230718-09eda825/common/main.c +++ b/uboot-mtk-20230718-09eda825/common/main.c @@ -61,6 +61,14 @@ void main_loop(void) efi_launch_capsules(); } + if (env_get("failsafe") != NULL) { + env_set("failsafe", NULL); + env_save(); + + led_control("led", "system_led", "on"); + run_command("httpd", 0); + } + run_command("glbtn", 0); s = bootdelay_process();