]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
dm: spl: Support device tree when BSS is in a different section
authorSimon Glass <sjg@chromium.org>
Sun, 18 Oct 2015 01:41:19 +0000 (19:41 -0600)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 4 Nov 2015 13:49:52 +0000 (14:49 +0100)
At present in SPL we place the device tree immediately after BSS. This
avoids needing to copy it out of the way before BSS can be used. However on
some boards BSS is not placed with the image - e.g. it can be in RAM if
available.

Add an option to tell U-Boot that the device tree should be placed at the
end of the image binary (_image_binary_end) instead of at the end of BSS.

Note: A common reason to place BSS in RAM is to support the FAT filesystem.
We should update the code so that it does not use so much BSS.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Kconfig
include/asm-generic/sections.h
lib/fdtdec.c

diff --git a/Kconfig b/Kconfig
index 44b144f1c2a0aa609deaec7526da2a8c224b7799..821b464db207b60813e326fcb3b014c98a2e98a3 100644 (file)
--- a/Kconfig
+++ b/Kconfig
@@ -152,6 +152,16 @@ config SPL_STACK_R_MALLOC_SIMPLE_LEN
          to give board_init_r() a larger heap then the initial heap in
          SRAM which is limited to SYS_MALLOC_F_LEN bytes.
 
+config SPL_SEPARATE_BSS
+       depends on SPL
+       bool "BSS section is in a different memory region from text"
+       help
+         Some platforms need a large BSS region in SPL and can provide this
+         because RAM is already set up. In this case BSS can be moved to RAM.
+         This option should then be enabled so that the correct device tree
+         location is used. Normally we put the device tree at the end of BSS
+         but with this option enabled, it goes at _image_binary_end.
+
 config TPL
        bool
        depends on SPL && SUPPORT_TPL
index 458952fb58c6cc67c26e5e0c9cb17c21108ee4b8..328bc6294825ced4a93c1370ab5301ca5c226de7 100644 (file)
@@ -71,6 +71,7 @@ extern char __bss_start[];
 extern char __bss_end[];
 extern char __image_copy_start[];
 extern char __image_copy_end[];
+extern char _image_binary_end[];
 extern char __rel_dyn_start[];
 extern char __rel_dyn_end[];
 
index e1df144db0537c08c6009d01ebe8984607043539..c1b517706d105b94b72e944edceff08e46454ff9 100644 (file)
@@ -1222,8 +1222,11 @@ int fdtdec_setup(void)
        gd->fdt_blob = __dtb_dt_begin;
 # elif defined CONFIG_OF_SEPARATE
 #  ifdef CONFIG_SPL_BUILD
-       /* FDT is at end of BSS */
-       gd->fdt_blob = (ulong *)&__bss_end;
+       /* FDT is at end of BSS unless it is in a different memory region */
+       if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS))
+               gd->fdt_blob = (ulong *)&_image_binary_end;
+       else
+               gd->fdt_blob = (ulong *)&__bss_end;
 #  else
        /* FDT is at end of image */
        gd->fdt_blob = (ulong *)&_end;