summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2008-02-27 21:51:50 -0600
committerMarian Balakowicz <m8@semihalf.com>2008-02-29 13:15:56 +0100
commitd3f2fa0d278467b2232e4eb2372f905c3febfbeb (patch)
tree354a389881ddaacfc29a0b02c6fb12b9cb7c1f81 /common
parente822d7fc4dd4755d4d0a22f05e33f33d1a0481da (diff)
downloadu-boot-imx-d3f2fa0d278467b2232e4eb2372f905c3febfbeb.zip
u-boot-imx-d3f2fa0d278467b2232e4eb2372f905c3febfbeb.tar.gz
u-boot-imx-d3f2fa0d278467b2232e4eb2372f905c3febfbeb.tar.bz2
[new uImage] Provide ability to restrict region used for boot images
Allow the user to set 'bootm_low' and 'bootm_size' env vars as a way to restrict what memory range is used for bootm. Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Acked-by: Marian Balakowicz <m8@semihalf.com>
Diffstat (limited to 'common')
-rw-r--r--common/cmd_bootm.c10
-rw-r--r--common/image.c26
2 files changed, 31 insertions, 5 deletions
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index a32a5a2..8595ef6 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -124,6 +124,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
ulong os_data, os_len;
ulong image_start, image_end;
ulong load_start, load_end;
+ ulong mem_start, mem_size;
struct lmb lmb;
@@ -134,11 +135,10 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
lmb_init(&lmb);
-#ifdef CFG_SDRAM_BASE
- lmb_add(&lmb, CFG_SDRAM_BASE, gd->bd->bi_memsize);
-#else
- lmb_add(&lmb, 0, gd->bd->bi_memsize);
-#endif
+ mem_start = getenv_bootm_low();
+ mem_size = getenv_bootm_size();
+
+ lmb_add(&lmb, mem_start, mem_size);
board_lmb_reserve(&lmb);
diff --git a/common/image.c b/common/image.c
index 0b71811..9e446fa 100644
--- a/common/image.c
+++ b/common/image.c
@@ -132,6 +132,32 @@ int getenv_autostart (void)
return (s && (*s == 'n')) ? 0 : 1;
}
+ulong getenv_bootm_low(void)
+{
+ char *s = getenv ("bootm_low");
+ if (s) {
+ ulong tmp = simple_strtoul (s, NULL, 16);
+ return tmp;
+ }
+
+#ifdef CFG_SDRAM_BASE
+ return CFG_SDRAM_BASE;
+#else
+ return 0;
+#endif
+}
+
+ulong getenv_bootm_size(void)
+{
+ char *s = getenv ("bootm_size");
+ if (s) {
+ ulong tmp = simple_strtoul (s, NULL, 16);
+ return tmp;
+ }
+
+ return gd->bd->bi_memsize;
+}
+
void memmove_wd (void *to, void *from, size_t len, ulong chunksz)
{
#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)