From d7b14f48d28a7b05c881be18dfb12ca68781d0cd Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Sat, 19 Dec 2020 12:08:05 -0800 Subject: [PATCH] fusee: fix no-BCT.ini for fusee-secondary --- fusee/fusee-secondary/src/main.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/fusee/fusee-secondary/src/main.c b/fusee/fusee-secondary/src/main.c index 249e41ce7..bbb6f1d6d 100644 --- a/fusee/fusee-secondary/src/main.c +++ b/fusee/fusee-secondary/src/main.c @@ -70,6 +70,18 @@ static void exit_callback(int rc) { } } +static const char *get_default_bct0(void) { + return "BCT0\n" + "[stage1]\n" + "stage2_path = atmosphere/fusee-secondary.bin\n" + "stage2_mtc_path = atmosphere/fusee-mtc.bin\n" + "stage2_addr = 0xF0000000\n" + "stage2_entrypoint = 0xF0000000\n" + "\n" + "[stratosphere]\n" + "\n"; +} + /* Allow for main(int argc, void **argv) signature. */ #pragma GCC diagnostic ignored "-Wmain" @@ -102,7 +114,8 @@ int main(int argc, void **argv) { if (strcmp(g_stage2_args->bct0, "") == 0) { uint32_t bct_tmp_buf[sizeof(g_stage2_args->bct0) / sizeof(uint32_t)] = {0}; if (!read_from_file(bct_tmp_buf, sizeof(bct_tmp_buf) - 1, "atmosphere/config/BCT.ini")) { - fatal_error("Failed to read BCT0 from SD!\n"); + const char * const default_bct0 = get_default_bct0(); + memcpy(bct_tmp_buf, default_bct0, strlen(default_bct0)); } memcpy(g_stage2_args->bct0, bct_tmp_buf, sizeof(bct_tmp_buf)); }