[PATCH 2/4] ARM i.MX: Add support for internal serial boot mode

Sascha Hauer s.hauer at pengutronix.de
Tue Jul 31 14:01:48 EDT 2012


This mode is needed for bootstrapping a board via USB serial.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/mach-imx/Kconfig                         |   10 ++++++++++
 arch/arm/mach-imx/include/mach/barebox.lds.h      |   12 +++++++++++-
 arch/arm/mach-imx/include/mach/imx-flash-header.h |    9 +++++++++
 3 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 5b77245..e54d498 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -101,6 +101,16 @@ config ARCH_IMX_INTERNAL_BOOT_NOR
 config ARCH_IMX_INTERNAL_BOOT_ONENAND
 	bool "OneNAND"
 
+config ARCH_IMX_INTERNAL_BOOT_SERIAL
+	bool "Serial (read help)"
+	help
+	  Normally the first instruction of the barebox image contains a jump
+	  to the real start of the image which means that you can start it by
+	  jumping to the load address. With serial boot images this is not
+	  possible because the first instruction is occupied by a magic for the
+	  ROM boot code. You can still start this image as a second stage loader,
+	  but you have to add 0x400 to the entry point.
+
 endchoice
 
 config NAND_IMX_BOOT
diff --git a/arch/arm/mach-imx/include/mach/barebox.lds.h b/arch/arm/mach-imx/include/mach/barebox.lds.h
index a2932bd..2e60282 100644
--- a/arch/arm/mach-imx/include/mach/barebox.lds.h
+++ b/arch/arm/mach-imx/include/mach/barebox.lds.h
@@ -1,6 +1,16 @@
 
 #ifdef CONFIG_ARCH_IMX_INTERNAL_BOOT
 
+#ifdef CONFIG_ARCH_IMX_INTERNAL_BOOT_SERIAL
+#define PRE_IMAGE \
+	.pre_image : {					\
+		KEEP(*(.flash_header_0x0*))		\
+		KEEP(*(.dcd_entry_0x0*))		\
+		KEEP(*(.image_len_0x0*))		\
+		. = 0x400;				\
+	}
+#else
+
 #define PRE_IMAGE \
 	.pre_image : {					\
 		KEEP(*(.flash_header_start*))		\
@@ -19,4 +29,4 @@
 		. = 0x2000;				\
 	}
 #endif
-
+#endif
diff --git a/arch/arm/mach-imx/include/mach/imx-flash-header.h b/arch/arm/mach-imx/include/mach/imx-flash-header.h
index ca2fe9f..a51d473 100644
--- a/arch/arm/mach-imx/include/mach/imx-flash-header.h
+++ b/arch/arm/mach-imx/include/mach/imx-flash-header.h
@@ -15,6 +15,11 @@
 	#define __dcd_entry_section		__section(.dcd_entry_0x0100)
 	#define __image_len_section		__section(.image_len_0x0100)
 	#define FLASH_HEADER_OFFSET 0x0100
+#elif defined(CONFIG_ARCH_IMX_INTERNAL_BOOT_SERIAL)
+	#define __flash_header_section		__section(.flash_header_0x0)
+	#define __dcd_entry_section		__section(.dcd_entry_0x0)
+	#define __image_len_section		__section(.image_len_0x0)
+	#define FLASH_HEADER_OFFSET 0x0
 #else
 	#define __flash_header_section		__section(.flash_header_0x0400)
 	#define __dcd_entry_section		__section(.dcd_entry_0x0400)
@@ -34,6 +39,10 @@
 #define __dcd_entry_0x0400	__section(.dcd_entry_0x0400)
 #define __image_len_0x0400	__section(.image_len_0x0400)
 
+#define __flash_header_0x0	__section(.flash_header_0x0)
+#define __dcd_entry_0x0		__section(.dcd_entry_0x0)
+#define __image_len_0x0		__section(.image_len_0x0)
+
 /*
  * NOR is not automatically copied anywhere by the boot ROM
  */
-- 
1.7.10.4




More information about the barebox mailing list