summaryrefslogtreecommitdiff
path: root/arch/sandbox/cpu
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sandbox/cpu')
-rw-r--r--arch/sandbox/cpu/Makefile5
-rw-r--r--arch/sandbox/cpu/spl.c41
2 files changed, 41 insertions, 5 deletions
diff --git a/arch/sandbox/cpu/Makefile b/arch/sandbox/cpu/Makefile
index ee3c04c49e1..eb6bf6302e2 100644
--- a/arch/sandbox/cpu/Makefile
+++ b/arch/sandbox/cpu/Makefile
@@ -5,9 +5,8 @@
# (C) Copyright 2000-2003
# Wolfgang Denk, DENX Software Engineering, [email protected].
-obj-y := cache.o cpu.o state.o initjmp.o os.o
-extra-y := start.o
-extra-$(CONFIG_SANDBOX_SDL) += sdl.o
+obj-y := start.o cache.o cpu.o state.o initjmp.o os.o
+obj-$(CONFIG_SANDBOX_SDL) += sdl.o
obj-$(CONFIG_XPL_BUILD) += spl.o
obj-$(CONFIG_ETH_SANDBOX_RAW) += eth-raw-os.o
diff --git a/arch/sandbox/cpu/spl.c b/arch/sandbox/cpu/spl.c
index 7ee4975523e..460013f933b 100644
--- a/arch/sandbox/cpu/spl.c
+++ b/arch/sandbox/cpu/spl.c
@@ -131,8 +131,8 @@ SPL_LOAD_IMAGE_METHOD("sandbox_image", 7, BOOT_DEVICE_BOARD, load_from_image);
int dram_init_banksize(void)
{
/* These are necessary so TFTP can use LMBs to check its load address */
- gd->bd->bi_dram[0].start = gd->ram_base;
- gd->bd->bi_dram[0].size = get_effective_memsize();
+ gd->dram[0].start = gd->ram_base;
+ gd->dram[0].size = get_effective_memsize();
return 0;
}
@@ -265,6 +265,43 @@ int sandbox_spl_load_fit(char *fname, int maxlen, struct spl_image_info *image)
return 0;
}
+int sandbox_spl_load_fit_full(char *fname, int maxlen,
+ struct spl_image_info *image)
+{
+ struct legacy_img_hdr *header;
+ long long size;
+ int ret;
+ int fd;
+
+ ret = sandbox_find_next_phase(fname, maxlen, true);
+ if (ret) {
+ printf("%s not found, error %d\n", fname, ret);
+ return log_msg_ret("nph", ret);
+ }
+
+ log_debug("reading from %s\n", fname);
+ fd = os_open(fname, OS_O_RDONLY);
+ if (fd < 0) {
+ printf("Failed to open '%s'\n", fname);
+ return log_msg_ret("ope", -errno);
+ }
+
+ if (os_get_filesize(fname, &size))
+ return log_msg_ret("fis", -ENOENT);
+
+ header = spl_get_load_buffer(0, size);
+
+ if (os_read(fd, header, size) != size)
+ return log_msg_ret("rea", -EIO);
+ os_close(fd);
+
+ ret = spl_load_fit_image(image, header);
+ if (ret)
+ return log_msg_ret("slf", ret);
+
+ return 0;
+}
+
static int upl_load_from_image(struct spl_image_info *spl_image,
struct spl_boot_device *bootdev)
{