Skip to content

Commit

Permalink
add env to disable sd card operations at boot
Browse files Browse the repository at this point in the history
  • Loading branch information
gtxaspec committed Jan 21, 2024
1 parent f99a9c6 commit c553484
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions arch/mips/lib/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,13 +405,23 @@ 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);
#endif
#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 (;;)
Expand Down
1 change: 1 addition & 0 deletions include/configs/isvp_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit c553484

Please sign in to comment.