diff options
author | Simon Glass <sjg@chromium.org> | 2013-04-20 08:42:49 +0000 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2013-05-01 11:17:21 -0400 |
commit | 4ca30d60248b42ac6f949b3e797fbec939387cb0 (patch) | |
tree | de45f6b48f959b653e5258ea63fa7448a5649ab3 | |
parent | 39042d821ed882d448f1bcd6505df7fb6700b8f0 (diff) | |
download | u-boot-4ca30d60248b42ac6f949b3e797fbec939387cb0.tar.gz u-boot-4ca30d60248b42ac6f949b3e797fbec939387cb0.tar.xz u-boot-4ca30d60248b42ac6f949b3e797fbec939387cb0.zip |
sandbox: Support 'source' command
Enhance the source command to work with sandbox, by using map_sysmem() to
convert a ulong address into a pointer.
Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | common/cmd_source.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/common/cmd_source.c b/common/cmd_source.c index 02a862cc5a..f0d7f52bce 100644 --- a/common/cmd_source.c +++ b/common/cmd_source.c @@ -36,6 +36,7 @@ #include <image.h> #include <malloc.h> #include <asm/byteorder.h> +#include <asm/io.h> #if defined(CONFIG_8xx) #include <mpc8xx.h> #endif @@ -44,9 +45,10 @@ int source (ulong addr, const char *fit_uname) { ulong len; - image_header_t *hdr; + const image_header_t *hdr; ulong *data; int verify; + void *buf; #if defined(CONFIG_FIT) const void* fit_hdr; int noffset; @@ -56,9 +58,10 @@ source (ulong addr, const char *fit_uname) verify = getenv_yesno ("verify"); - switch (genimg_get_format ((void *)addr)) { + buf = map_sysmem(addr, 0); + switch (genimg_get_format(buf)) { case IMAGE_FORMAT_LEGACY: - hdr = (image_header_t *)addr; + hdr = buf; if (!image_check_magic (hdr)) { puts ("Bad magic number\n"); @@ -104,7 +107,7 @@ source (ulong addr, const char *fit_uname) return 1; } - fit_hdr = (const void *)addr; + fit_hdr = buf; if (!fit_check_format (fit_hdr)) { puts ("Bad FIT image format\n"); return 1; |