[PATCH 3/3] ARM: i.MX: external NAND boot: use image size from image header

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When compiling with multiimage support ld_var(_barebox_image_size) only
contains the length of the PBL image, but not including the appended
compressed data. With this patch the image size is read from the barebox
header instead which contains the correct size, either from the linker
or from the fix_size tool.
This makes the external_nand_boot compatible with multiimage support.

Tested on Phytec phyCARD-i.MX27 with and without PBL.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 arch/arm/mach-imx/external-nand-boot.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-imx/external-nand-boot.c b/arch/arm/mach-imx/external-nand-boot.c
index fab37bf..c08806c 100644
--- a/arch/arm/mach-imx/external-nand-boot.c
+++ b/arch/arm/mach-imx/external-nand-boot.c
@@ -322,10 +322,13 @@ void __noreturn BARE_INIT_FUNCTION(imx##soc##_boot_nand_external_cont)  \
 			(uint32_t boarddata)				\
 {									\
 	unsigned long nfc_base = MX##soc##_NFC_BASE_ADDR;		\
-	unsigned long sdram = MX##soc##_CSD0_BASE_ADDR;			\
+	void *sdram = (void *)MX##soc##_CSD0_BASE_ADDR;			\
+	uint32_t image_size;						\
+									\
+	image_size = *(uint32_t *)(sdram + 0x2c);			\
 									\
-	imx##soc##_nand_load_image((void *)sdram,			\
-			ld_var(_barebox_image_size),			\
+	imx##soc##_nand_load_image(sdram,				\
+			image_size,					\
 			(void *)nfc_base,				\
 			imx##soc##_pagesize_2k());			\
 									\
-- 
1.8.5.3


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux