aboutsummaryrefslogtreecommitdiff
path: root/arch/sandbox/cpu/start.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-10-31 14:43:04 -0400
committerTom Rini <trini@konsulko.com>2022-10-31 14:43:04 -0400
commita90afc6730e6c67ad37f4c98a02891a93b4ff971 (patch)
tree724c085433631e142a56c052d667139cba29b4a6 /arch/sandbox/cpu/start.c
parent6f38d91158e7e4199753b79e0a25c1a65175aba4 (diff)
parent77bec9e3d8bd2dc307447b92a3d5cefd693a62ad (diff)
Merge branch '2022-10-31-vbe-implement-the-full-firmware-flow'
To quote Simon: This series provides an implementation of VBE from TPL through to U-Boot proper, using VBE to load the relevant firmware stages. It buils a single image.bin file containing all the phases: TPL - initial phase, loads VPL using binman symbols VPL - main firmware phase, loads SPL using VBE parameters SPL - loads U-Boot proper using VBE parameters U-Boot - final firmware phase, where OS booting is processed This series does not include the OS-booting phase. That will be the subject of a future series. The implementation is entirely handled by sandbox. It should be possible to enable this on a real board without much effort, but that is also the subject of a future series.
Diffstat (limited to 'arch/sandbox/cpu/start.c')
-rw-r--r--arch/sandbox/cpu/start.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index 642be164a3..622df41f54 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -244,6 +244,36 @@ static int sandbox_cmdline_cb_jump(struct sandbox_state *state,
}
SANDBOX_CMDLINE_OPT_SHORT(jump, 'j', 1, "Jumped from previous U-Boot");
+static int sandbox_cmdline_cb_program(struct sandbox_state *state,
+ const char *arg)
+{
+ /*
+ * Record the program name to use when jumping to future phases. This
+ * is the original executable which holds all the phases. We need to
+ * use this instead of argv[0] since each phase is started by
+ * extracting a particular binary from the full program, then running
+ * it. Therefore in that binary, argv[0] contains only the
+ * current-phase executable.
+ *
+ * For example, sandbox TPL may be started using image file:
+ *
+ * ./image.bin
+ *
+ * but then TPL needs to run VPL, which it does by extracting the VPL
+ * image from the image.bin file.
+ *
+ * ./temp-vpl
+ *
+ * When VPL runs it needs access to the original image.bin so it can
+ * extract the next phase (SPL). This works if we use '-f image.bin'
+ * when starting the original image.bin file.
+ */
+ state->prog_fname = arg;
+
+ return 0;
+}
+SANDBOX_CMDLINE_OPT_SHORT(program, 'p', 1, "U-Boot program name");
+
static int sandbox_cmdline_cb_memory(struct sandbox_state *state,
const char *arg)
{