summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-07-05 16:32:45 -0600
committerSimon Glass <sjg@chromium.org>2021-07-21 10:27:34 -0600
commitf178bebf551a43445ba8f1e1a4c1638eff8eb612 (patch)
treec36bf045cdad0eb02691bb999ba6f734e330c220 /include
parent719d286475d2df1f1d8f4413659893934f38de7d (diff)
downloadu-boot-f178bebf551a43445ba8f1e1a4c1638eff8eb612.tar.gz
u-boot-f178bebf551a43445ba8f1e1a4c1638eff8eb612.tar.bz2
u-boot-f178bebf551a43445ba8f1e1a4c1638eff8eb612.zip
sandbox: Support executables for more phases
The SPL header has a function for obtaining the phase in capital letters, e.g. 'SPL'. Add one for lower-case also, as used by sandbox. Use this to generalise the sandbox logic for determining the filename of the next sandbox executable. This can provide support for VPL. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/os.h5
-rw-r--r--include/spl.h21
2 files changed, 25 insertions, 1 deletions
diff --git a/include/os.h b/include/os.h
index bd1096eb8b..7b20d606dd 100644
--- a/include/os.h
+++ b/include/os.h
@@ -327,9 +327,12 @@ int os_jump_to_image(const void *dest, int size);
* @fname: place to put full path to U-Boot
* @maxlen: maximum size of @fname
* @use_img: select the 'u-boot.img' file instead of the 'u-boot' ELF file
+ * @cur_prefix: prefix of current executable, e.g. "spl" or "tpl"
+ * @next_prefix: prefix of executable to find, e.g. "spl" or ""
* Return: 0 if OK, -NOSPC if the filename is too large, -ENOENT if not found
*/
-int os_find_u_boot(char *fname, int maxlen, bool use_img);
+int os_find_u_boot(char *fname, int maxlen, bool use_img,
+ const char *cur_prefix, const char *next_prefix);
/**
* os_spl_to_uboot() - Run U-Boot proper
diff --git a/include/spl.h b/include/spl.h
index c643943482..d88fb79a67 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -176,6 +176,27 @@ static inline const char *spl_phase_name(enum u_boot_phase phase)
}
}
+/**
+ * spl_phase_prefix() - Get the prefix of the current phase
+ *
+ * @phase: Phase to look up
+ * @return phase prefix ("spl", "tpl", etc.)
+ */
+static inline const char *spl_phase_prefix(enum u_boot_phase phase)
+{
+ switch (phase) {
+ case PHASE_TPL:
+ return "tpl";
+ case PHASE_SPL:
+ return "spl";
+ case PHASE_BOARD_F:
+ case PHASE_BOARD_R:
+ return "";
+ default:
+ return "phase?";
+ }
+}
+
/* A string name for SPL or TPL */
#ifdef CONFIG_SPL_BUILD
# ifdef CONFIG_TPL_BUILD