]> git.sur5r.net Git - u-boot/commitdiff
km/common: fix ramfs development target
authorAndreas Huber <andreas.huber@keymile.com>
Tue, 13 Sep 2011 23:06:11 +0000 (23:06 +0000)
committerWolfgang Denk <wd@denx.de>
Fri, 21 Oct 2011 22:29:09 +0000 (00:29 +0200)
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>

board/keymile/common/common.c
board/keymile/scripts/develop-common.txt
board/keymile/scripts/ramfs-common.txt
include/configs/km/keymile-common.h

index fce9d582f23c66ba5542ed2e94b1c95ec94cf42f..a585f17fe3aad0ee361c9c948c7799feaed1a600 100644 (file)
@@ -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;
 }
 
index 3ccd0397b28dadc875ba74c087a33257a5993dfe..93e2967454644314aacfc8de8b101631238c6a8b 100644 (file)
@@ -4,3 +4,4 @@ configure=km_setboardid && saveenv && reset
 subbootcmds=tftpfdt tftpkernel nfsargs add_default boot
 nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:/opt/eldk/${arch}
 tftpkernel=tftpboot ${load_addr_r} ${hostname}/uImage
+rootfssize=0
index 9315500aff3ae3b3e0e9e76ad51377476da4b7a7..c1b45ab029a9e281d1ec867ca35046c2467ebe66 100644 (file)
@@ -1,11 +1,10 @@
-addramfs=setenv bootargs "${bootargs} mem=${rootfsaddr} phram.phram=rootfs${boot_bank},${rootfsaddr},${rootfssize}"
+addramfs=setenv bootargs "${bootargs} phram.phram=rootfs${boot_bank},${rootfsaddr},${rootfssize}"
 actual_bank=-1
 altbootcmd=run ${subbootcmds}
 bootcmd=run ${subbootcmds}
 subbootcmds=tftpfdt tftpkernel setrootfsaddr tftpramfs flashargs add_default addpanic addramfs boot
 nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath}
-configure=km_setboardid && run setramfspram && saveenv && reset
-setramfspram=setexpr value 0 + ${rootfssize} && setexpr value 0x${value} / 0x400 && setexpr value 0x${value} + ${pram} && setenv pram 0x${value}
+configure=km_setboardid && saveenv && reset
 rootfsfile=${hostname}/rootfsImage
 setrootfsaddr=setexpr value ${pnvramaddr} - ${rootfssize} && setenv rootfsaddr 0x${value}
 tftpkernel=tftpboot ${load_addr_r} ${hostname}/uImage
index bc1edafcb6d2ccf182ae280641709196335e44b7..7d93417a259c001ee4e10dceeaf2b630b09b9bea 100644 (file)
                "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}"      \
                ":${hostname}:${netdev}:off3"                           \
                " console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}"        \
-               " mem=${pnvramaddr} init=${init}"                       \
+               " mem=${kernelmem} init=${init}"                        \
                " phram.phram=phvar,${varaddr}," xstr(CONFIG_KM_PHRAM)  \
                " ubi.mtd=" CONFIG_KM_UBI_LINUX_MTD_NAME " "            \
                CONFIG_KM_DEF_BOOT_ARGS_CPU                             \