[U-Boot] [PATCH 6/7] omap-common: Add NAND SPL linux booting

Simon Schwarz simonschwarzcor at googlemail.com
Thu Aug 11 16:44:55 CEST 2011


This implements booting of Linux from NAND in SPL

Signed-off-by: Simon Schwarz <simonschwarzcor at gmail.com>
---
 arch/arm/cpu/armv7/omap-common/spl_nand.c |   48 +++++++++++++++++++---------
 1 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap-common/spl_nand.c b/arch/arm/cpu/armv7/omap-common/spl_nand.c
index af02a59..06254b2 100644
--- a/arch/arm/cpu/armv7/omap-common/spl_nand.c
+++ b/arch/arm/cpu/armv7/omap-common/spl_nand.c
@@ -46,26 +46,42 @@ void spl_nand_load_image(void)
 
 	/*use CONFIG_SYS_TEXT_BASE as temporary storage area */
 	header = (struct image_header *)(CONFIG_SYS_TEXT_BASE);
+#ifdef CONFIG_SPL_OS_BOOT
+	if (!spl_uboot_key()) {
+		/* load parameter image */
+		nand_spl_load_image(CONFIG_CMD_SAVEBP_NAND_OFS ,
+			CONFIG_CMD_SAVEBP_WRITE_SIZE,
+			(void *)CONFIG_SYS_SPL_ARGS_ADDR);
 
+		/* load linux */
+		nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS,
+			CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
+		spl_parse_image_header(header);
+		nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS,
+			spl_image.size, (void *)spl_image.load_addr);
+	} else
+#endif
+	{
 #ifdef CONFIG_NAND_ENV_DST
-	nand_spl_load_image(CONFIG_ENV_OFFSET,
-		CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
-	spl_parse_image_header(header);
-	nand_spl_load_image(CONFIG_ENV_OFFSET, spl_image.size,
-		(void *)image_load_addr);
+		nand_spl_load_image(CONFIG_ENV_OFFSET,
+			CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
+		spl_parse_image_header(header);
+		nand_spl_load_image(CONFIG_ENV_OFFSET, spl_image.size,
+			(void *)spl_image.load_addr);
 #ifdef CONFIG_ENV_OFFSET_REDUND
-	nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND,
-		CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
-	spl_parse_image_header(header);
-	nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, spl_image.size,
-		(void *)image_load_addr);
+		nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND,
+			CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
+		spl_parse_image_header(header);
+		nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, spl_image.size,
+			(void *)spl_image.load_addr);
 #endif
 #endif
-	/* Load u-boot */
-	nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
-		CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
-	spl_parse_image_header(header);
-	nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
-		spl_image.size, (void *)spl_image.load_addr);
+		/* Load u-boot */
+		nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
+			CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
+		spl_parse_image_header(header);
+		nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
+			spl_image.size, (void *)spl_image.load_addr);
+	}
 	nand_deselect();
 }
-- 
1.7.4.1



More information about the U-Boot mailing list