summaryrefslogtreecommitdiff
path: root/common/image.c
diff options
context:
space:
mode:
authorJoe Hershberger <joe.hershberger@ni.com>2012-12-11 22:16:28 -0600
committerTom Rini <trini@ti.com>2012-12-13 11:46:56 -0700
commit1cf0a8b2fbe38ed07b1babaaacfc22bd427f66f0 (patch)
tree05392b808a9eb3ad930beabc44e4c99057a898e2 /common/image.c
parent32057717e06a4e703fdf3774671cea14554de76b (diff)
downloadu-boot-imx-1cf0a8b2fbe38ed07b1babaaacfc22bd427f66f0.zip
u-boot-imx-1cf0a8b2fbe38ed07b1babaaacfc22bd427f66f0.tar.gz
u-boot-imx-1cf0a8b2fbe38ed07b1babaaacfc22bd427f66f0.tar.bz2
env: Add a loadaddr env handler
Remove the hard-coded loadaddr handler and use a callback instead Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'common/image.c')
-rw-r--r--common/image.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/common/image.c b/common/image.c
index 69e888c..95498e6 100644
--- a/common/image.c
+++ b/common/image.c
@@ -43,6 +43,7 @@
#include <rtc.h>
#endif
+#include <environment.h>
#include <image.h>
#if defined(CONFIG_FIT) || defined(CONFIG_OF_LIBFDT)
@@ -416,6 +417,26 @@ static const image_header_t *image_get_ramdisk(ulong rd_addr, uint8_t arch,
/* Shared dual-format routines */
/*****************************************************************************/
#ifndef USE_HOSTCC
+ulong load_addr = CONFIG_SYS_LOAD_ADDR; /* Default Load Address */
+ulong save_addr; /* Default Save Address */
+ulong save_size; /* Default Save Size (in bytes) */
+
+static int on_loadaddr(const char *name, const char *value, enum env_op op,
+ int flags)
+{
+ switch (op) {
+ case env_op_create:
+ case env_op_overwrite:
+ load_addr = simple_strtoul(value, NULL, 16);
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+U_BOOT_ENV_CALLBACK(loadaddr, on_loadaddr);
+
ulong getenv_bootm_low(void)
{
char *s = getenv("bootm_low");