summaryrefslogtreecommitdiffstats
path: root/patches/Bootstrap-v1.16/0001-crt0_gnu.S-fix-image-size.patch
blob: 08b4da3eb1a2513f4e70a5ecfc1285d1a1e95fa1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Thu, 17 Feb 2011 15:21:09 +0100
Subject: [PATCH] crt0_gnu.S: fix image size

This patch fixes the calculation of the image size which is located
at offset 0x14. Without the patch the end address of the linked image
is written.

On the at91sam9m10ekes the bootstrap is linked to 0x300000, so the image
size is ~3 MiB. When written to NAND the boot rom code doesn't recognize
the NAND as a valid boot medium, because the size is bigger than 60KiB.
This is the maximum Image size on that processor. See chapter 11.4.2 of
the SAM9M10 Preliminary.

This patch applies to Bootstrap-v1.16.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 crt0_gnu.S          | 2 +-
 elf32-littlearm.lds | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/crt0_gnu.S b/crt0_gnu.S
index 042b617fae6f..638b32bdf3b3 100644
--- a/crt0_gnu.S
+++ b/crt0_gnu.S
@@ -56,7 +56,7 @@ _exception_vectors:
 	b 	swi_vector   	/* Software Interrupt */
 	b 	pabt_vector  	/* Prefetch Abort */
 	b 	dabt_vector  	/* Data Abort */
-.word		_edata		/* Size of the image for SAM-BA */
+.word		_image_len	/* Size of the image for SAM-BA */
 	b 	irq_vector	/* IRQ : read the AIC */
 	b 	fiq_vector      /* FIQ */
 
diff --git a/elf32-littlearm.lds b/elf32-littlearm.lds
index a33952f68e4f..bf02b931f488 100644
--- a/elf32-littlearm.lds
+++ b/elf32-littlearm.lds
@@ -19,6 +19,7 @@ SECTIONS
 		*(.vectors)
 		*(.data)
 		_edata = .;
+		_image_len = _edata - _stext;
 	}
 
 	/* collect all uninitialized .bss sections */