summaryrefslogtreecommitdiff
path: root/board/keymile/common/common.c
diff options
context:
space:
mode:
authorAndreas Huber <andreas.huber@keymile.com>2011-09-13 23:06:11 +0000
committerWolfgang Denk <wd@denx.de>2011-10-22 00:29:09 +0200
commit2a7714ce64cfd954535f0c96f2809e2fd80d84f0 (patch)
treeb84c02276f7145a3b1f5bf720e1128db7d60b2c1 /board/keymile/common/common.c
parent0eb0e59ed3955cd73548c8769bf594c665025dd5 (diff)
downloadu-boot-imx-2a7714ce64cfd954535f0c96f2809e2fd80d84f0.zip
u-boot-imx-2a7714ce64cfd954535f0c96f2809e2fd80d84f0.tar.gz
u-boot-imx-2a7714ce64cfd954535f0c96f2809e2fd80d84f0.tar.bz2
km/common: fix ramfs development target
Calucations of PRAM needs to take into account the 'rootfssize'. Memory available to the linux kernel 'mem=' is in all cases set to the total memory size minus the pram size. Signed-off-by: Andreas Huber <andreas.huber@keymile.com> Signed-off-by: Holger Brunck <holger.brunck@keymile.com> cc: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'board/keymile/common/common.c')
-rw-r--r--board/keymile/common/common.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index fce9d58..a585f17 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -64,20 +64,32 @@ int set_km_env(void)
unsigned int pnvramaddr;
unsigned int pram;
unsigned int varaddr;
+ unsigned int kernelmem;
+ char *p;
+ unsigned long rootfssize = 0;
pnvramaddr = gd->ram_size - CONFIG_KM_RESERVED_PRAM - CONFIG_KM_PHRAM
- CONFIG_KM_PNVRAM;
sprintf((char *)buf, "0x%x", pnvramaddr);
setenv("pnvramaddr", (char *)buf);
- pram = (CONFIG_KM_RESERVED_PRAM + CONFIG_KM_PHRAM + CONFIG_KM_PNVRAM) /
- 0x400;
+ /* try to read rootfssize (ram image) from envrionment */
+ p = getenv("rootfssize");
+ if (p != NULL)
+ strict_strtoul(p, 16, &rootfssize);
+ pram = (rootfssize + CONFIG_KM_RESERVED_PRAM + CONFIG_KM_PHRAM +
+ CONFIG_KM_PNVRAM) / 0x400;
sprintf((char *)buf, "0x%x", pram);
setenv("pram", (char *)buf);
varaddr = gd->ram_size - CONFIG_KM_RESERVED_PRAM - CONFIG_KM_PHRAM;
sprintf((char *)buf, "0x%x", varaddr);
setenv("varaddr", (char *)buf);
+
+ kernelmem = gd->ram_size - 0x400 * pram;
+ sprintf((char *)buf, "0x%x", kernelmem);
+ setenv("kernelmem", (char *)buf);
+
return 0;
}