]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
spl, nand: add option to boot raw u-boot.bin image only
authorHeiko Schocher <hs@denx.de>
Fri, 31 Oct 2014 07:31:00 +0000 (08:31 +0100)
committerTom Rini <trini@ti.com>
Mon, 17 Nov 2014 13:47:17 +0000 (08:47 -0500)
enable to boot only a raw u-boot.bin image from nand with the
CONFIG_SPL_NAND_RAW_ONLY define. This option saves space on
boards where spl space is low.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Bo Shen <voice.shen@atmel.com>
Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
README
common/spl/spl.c
common/spl/spl_nand.c
include/spl.h

diff --git a/README b/README
index c3a9dfc4f0b3851580818217703882dc30e7f0c1..837dca0c931852d5592047fe19012ffeb3e3e6a3 100644 (file)
--- a/README
+++ b/README
@@ -3605,6 +3605,10 @@ FIT uImage format:
                Support for the MTD subsystem within SPL.  Useful for
                environment on NAND support within SPL.
 
+               CONFIG_SPL_NAND_RAW_ONLY
+               Support to boot only raw u-boot.bin images. Use this only
+               if you need to save space.
+
                CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT
                Set for the SPL on PPC mpc8xxx targets, support for
                drivers/ddr/fsl/libddr.o in SPL binary.
index d85bab3928cc33693c80e090769fd02eb321403d..f01a21c83a51d9f0133393b0300c273edc410b2a 100644 (file)
@@ -62,6 +62,15 @@ __weak void spl_board_prepare_for_linux(void)
        /* Nothing to do! */
 }
 
+void spl_set_header_raw_uboot(void)
+{
+       spl_image.size = CONFIG_SYS_MONITOR_LEN;
+       spl_image.entry_point = CONFIG_SYS_UBOOT_START;
+       spl_image.load_addr = CONFIG_SYS_TEXT_BASE;
+       spl_image.os = IH_OS_U_BOOT;
+       spl_image.name = "U-Boot";
+}
+
 void spl_parse_image_header(const struct image_header *header)
 {
        u32 header_size = sizeof(struct image_header);
@@ -93,11 +102,7 @@ void spl_parse_image_header(const struct image_header *header)
                /* Signature not found - assume u-boot.bin */
                debug("mkimage signature not found - ih_magic = %x\n",
                        header->ih_magic);
-               spl_image.size = CONFIG_SYS_MONITOR_LEN;
-               spl_image.entry_point = CONFIG_SYS_UBOOT_START;
-               spl_image.load_addr = CONFIG_SYS_TEXT_BASE;
-               spl_image.os = IH_OS_U_BOOT;
-               spl_image.name = "U-Boot";
+               spl_set_header_raw_uboot();
        }
 }
 
index 9b200bc4d56dafaf0d7b8ddd131c3598e4d15429..b7801cb4605f16c54c99f65e3e8ed93db5d3e564 100644 (file)
 #include <asm/io.h>
 #include <nand.h>
 
+#if defined(CONFIG_SPL_NAND_RAW_ONLY)
+void spl_nand_load_image(void)
+{
+       nand_init();
+
+       nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
+                           CONFIG_SYS_NAND_U_BOOT_SIZE,
+                           (void *)CONFIG_SYS_NAND_U_BOOT_DST);
+       spl_set_header_raw_uboot();
+       nand_deselect();
+}
+#else
 void spl_nand_load_image(void)
 {
        struct image_header *header;
@@ -82,3 +94,4 @@ void spl_nand_load_image(void)
                spl_image.size, (void *)spl_image.load_addr);
        nand_deselect();
 }
+#endif
index 16b3566a947398493fe102afa7e210048e1b2429..b2e5bf726f2b60d7d81d8bafb5a9ec8357749ff4 100644 (file)
@@ -35,6 +35,7 @@ extern struct spl_image_info spl_image;
 void preloader_console_init(void);
 u32 spl_boot_device(void);
 u32 spl_boot_mode(void);
+void spl_set_header_raw_uboot(void);
 void spl_parse_image_header(const struct image_header *header);
 void spl_board_prepare_for_linux(void);
 void __noreturn jump_to_image_linux(void *arg);