From c553484f2e5a74af00a669ea4d049c0b35751d0f Mon Sep 17 00:00:00 2001 From: gtxaspec Date: Sun, 21 Jan 2024 04:00:03 -0800 Subject: [PATCH] add env to disable sd card operations at boot --- arch/mips/lib/board.c | 10 ++++++++++ include/configs/isvp_common.h | 1 + 2 files changed, 11 insertions(+) diff --git a/arch/mips/lib/board.c b/arch/mips/lib/board.c index 28313cee..42bcf33d 100644 --- a/arch/mips/lib/board.c +++ b/arch/mips/lib/board.c @@ -405,6 +405,12 @@ handle_gpio_settings("gpio_user"); handle_gpio_settings("gpio_motor_v"); handle_gpio_settings("gpio_motor_h"); +// Try to get the value of the 'sd_present' environment variable +char* sd_present = getenv("sd_present"); + +// Check if 'sd_present' was found and compare its value +if (sd_present != NULL && strcmp(sd_present, "true") == 0) { + // The environment variable 'sd_present' exists and its value is "true" #ifdef CONFIG_AUTO_UPDATE printf("Autoupdate... \n"); run_command("sdupdate",0); @@ -412,6 +418,10 @@ handle_gpio_settings("gpio_motor_h"); #ifdef CONFIG_CMD_SDSTART run_command("sdstart",0); #endif +} else { + // 'sd_present' does not exist or is not "true" + printf("SD card disabled\n"); +} /* main_loop() can return to retry autoboot, if so just run it again. */ for (;;) diff --git a/include/configs/isvp_common.h b/include/configs/isvp_common.h index e6eb7595..8cc84cc0 100644 --- a/include/configs/isvp_common.h +++ b/include/configs/isvp_common.h @@ -265,6 +265,7 @@ "panic_timeout=10\0" \ "serialport=ttyS1\0" \ "restore=n\0" \ +"sd_present=true\0" \ "soc="CONFIG_SOC"\0" \ CONFIG_EXTRA_SETTINGS \ CONFIG_GPIO_SETTINGS \