aboutsummaryrefslogtreecommitdiff
path: root/arch/sandbox/cpu/os.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-03-07 17:35:13 -0700
committerTom Rini <trini@konsulko.com>2021-03-12 09:57:31 -0500
commit01ad9f75c5ccbf2dbb30f8c630fad7e648026449 (patch)
tree7b7d512102983a4ba0e16673e76724ae0ad51caa /arch/sandbox/cpu/os.c
parent8482356f48c96eb49f1bd9efd53c887d09a1cf64 (diff)
downloadu-boot-01ad9f75c5ccbf2dbb30f8c630fad7e648026449.zip
u-boot-01ad9f75c5ccbf2dbb30f8c630fad7e648026449.tar.gz
u-boot-01ad9f75c5ccbf2dbb30f8c630fad7e648026449.tar.bz2
sandbox: Update os_find_u_boot() to find the .img file
At present this function can only locate the u-boot ELF file. For SPL it is handy to be able to locate u-boot.img since this is what would normally be loaded by SPL. Add another argument to allow this to be selected. While we are here, update the function to load SPL when running in TPL, since that is the next stage. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/sandbox/cpu/os.c')
-rw-r--r--arch/sandbox/cpu/os.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index f5000e6..2d9583c 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -777,7 +777,7 @@ int os_jump_to_image(const void *dest, int size)
return os_jump_to_file(fname);
}
-int os_find_u_boot(char *fname, int maxlen)
+int os_find_u_boot(char *fname, int maxlen, bool use_img)
{
struct sandbox_state *state = state_get_current();
const char *progname = state->argv[0];
@@ -801,8 +801,8 @@ int os_find_u_boot(char *fname, int maxlen)
return 0;
}
- /* Look for 'u-boot-tpl' in the tpl/ directory */
- p = strstr(fname, "/tpl/");
+ /* Look for 'u-boot-spl' in the spl/ directory */
+ p = strstr(fname, "/spl/");
if (p) {
p[1] = 's';
fd = os_open(fname, O_RDONLY);
@@ -829,6 +829,8 @@ int os_find_u_boot(char *fname, int maxlen)
if (p) {
/* Remove the "spl" characters */
memmove(p, p + 4, strlen(p + 4) + 1);
+ if (use_img)
+ strcat(p, ".img");
fd = os_open(fname, O_RDONLY);
if (fd >= 0) {
close(fd);