From 2a7714ce64cfd954535f0c96f2809e2fd80d84f0 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Tue, 13 Sep 2011 23:06:11 +0000 Subject: 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 Signed-off-by: Holger Brunck cc: Wolfgang Denk --- board/keymile/common/common.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'board/keymile/common') diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index fce9d582f2..a585f17fe3 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; } -- cgit v1.2.1