]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/image.c
Fix condition where bootm_size not set and wrong memory size reported
[karo-tx-uboot.git] / common / image.c
index 6d8833e814d841a46d7124514063ce8767faf3d8..ea5973086140930d9f995924aab60dcd3c319447 100644 (file)
@@ -433,17 +433,23 @@ ulong getenv_bootm_low(void)
 
 phys_size_t getenv_bootm_size(void)
 {
+       phys_size_t tmp;
        char *s = getenv ("bootm_size");
        if (s) {
-               phys_size_t tmp;
                tmp = (phys_size_t)simple_strtoull (s, NULL, 16);
                return tmp;
        }
+       s = getenv("bootm_low");
+       if (s)
+               tmp = (phys_size_t)simple_strtoull (s, NULL, 16);
+       else
+               tmp = 0;
+
 
 #if defined(CONFIG_ARM)
-       return gd->bd->bi_dram[0].size;
+       return gd->bd->bi_dram[0].size - tmp;
 #else
-       return gd->bd->bi_memsize;
+       return gd->bd->bi_memsize - tmp;
 #endif
 }