* fix i.MX flash header copy sizes
@ 2012-03-23 8:02 Sascha Hauer
2012-03-23 8:02 ` [PATCH 1/2] ARM linker script: Fix barebox_image_size Sascha Hauer
2012-03-23 8:02 ` [PATCH 2/2] ARM i.MX flash header: Fix barebox image sizes Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Sascha Hauer @ 2012-03-23 8:02 UTC (permalink / raw)
To: barebox
barebox is getting bigger and the assumption that 256k of binary
size is enough for everybody is no longer true. Calculate the
binary size to copy during compile time instead of hardcoding
a value.
----------------------------------------------------------------
Sascha Hauer (2):
ARM linker script: Fix barebox_image_size
ARM i.MX flash header: Fix barebox image sizes
arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c | 5 +----
arch/arm/boards/eukrea_cpuimx35/flash_header.c | 2 +-
arch/arm/boards/eukrea_cpuimx51/flash_header.c | 4 +---
arch/arm/boards/freescale-mx25-3-stack/3stack.c | 5 +----
.../boards/freescale-mx35-3-stack/flash_header.c | 2 +-
arch/arm/boards/freescale-mx51-pdk/flash_header.c | 4 +---
arch/arm/boards/freescale-mx53-loco/flash_header.c | 2 +-
arch/arm/boards/freescale-mx53-smd/flash_header.c | 2 +-
arch/arm/boards/tqma53/flash_header.c | 2 +-
arch/arm/lib/barebox.lds.S | 2 +-
arch/arm/mach-imx/include/mach/imx-flash-header.h | 10 ++++++++++
11 files changed, 20 insertions(+), 20 deletions(-)
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] ARM linker script: Fix barebox_image_size
2012-03-23 8:02 fix i.MX flash header copy sizes Sascha Hauer
@ 2012-03-23 8:02 ` Sascha Hauer
2012-03-23 8:02 ` [PATCH 2/2] ARM i.MX flash header: Fix barebox image sizes Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2012-03-23 8:02 UTC (permalink / raw)
To: barebox
barebox_image_size was calculated wrong when PRE_IMAGE is defined.
In this case _text does not refer to the binary image start. We
have to use TEXT_BASE here.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/lib/barebox.lds.S | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/arm/lib/barebox.lds.S b/arch/arm/lib/barebox.lds.S
index bc20694..3fd271b 100644
--- a/arch/arm/lib/barebox.lds.S
+++ b/arch/arm/lib/barebox.lds.S
@@ -105,5 +105,5 @@ SECTIONS
.bss : { *(.bss*) }
__bss_stop = .;
_end = .;
- _barebox_image_size = __bss_start - _text;
+ _barebox_image_size = __bss_start - TEXT_BASE;
}
--
1.7.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] ARM i.MX flash header: Fix barebox image sizes
2012-03-23 8:02 fix i.MX flash header copy sizes Sascha Hauer
2012-03-23 8:02 ` [PATCH 1/2] ARM linker script: Fix barebox_image_size Sascha Hauer
@ 2012-03-23 8:02 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2012-03-23 8:02 UTC (permalink / raw)
To: barebox
The image sizes have been hardcoded to 256K. This is inefficient
for smaller images and nonfunctional for bigger images. Calculate
the image size during compile time and use it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c | 5 +----
| 2 +-
| 4 +---
arch/arm/boards/freescale-mx25-3-stack/3stack.c | 5 +----
| 2 +-
| 4 +---
| 2 +-
| 2 +-
| 2 +-
| 10 ++++++++++
10 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
index 1e45779..1e48650 100644
--- a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
+++ b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
@@ -49,7 +49,6 @@
#include <mach/devices-imx25.h>
#include <asm/barebox-arm-head.h>
-extern unsigned long _stext;
extern void exception_vectors(void);
void __naked __flash_header_start go(void)
@@ -84,9 +83,7 @@ struct imx_flash_header __flash_header_section flash_header = {
.dcd_block_len = sizeof(dcd_entry),
};
-extern unsigned long __bss_start;
-
-unsigned long __image_len_section barebox_len = 0x40000;
+unsigned long __image_len_section barebox_len = DCD_BAREBOX_SIZE;
static struct fec_platform_data fec_info = {
.xcv_type = RMII,
--git a/arch/arm/boards/eukrea_cpuimx35/flash_header.c b/arch/arm/boards/eukrea_cpuimx35/flash_header.c
index f8ed5d4..a745442 100644
--- a/arch/arm/boards/eukrea_cpuimx35/flash_header.c
+++ b/arch/arm/boards/eukrea_cpuimx35/flash_header.c
@@ -42,4 +42,4 @@ struct imx_flash_header __flash_header_section flash_header = {
.dcd_block_len = sizeof(dcd_entry),
};
-unsigned long __image_len_section barebox_len = 0x40000;
+unsigned long __image_len_section barebox_len = DCD_BAREBOX_SIZE;
--git a/arch/arm/boards/eukrea_cpuimx51/flash_header.c b/arch/arm/boards/eukrea_cpuimx51/flash_header.c
index ac6bbdc..81bd442 100644
--- a/arch/arm/boards/eukrea_cpuimx51/flash_header.c
+++ b/arch/arm/boards/eukrea_cpuimx51/flash_header.c
@@ -2,8 +2,6 @@
#include <mach/imx-flash-header.h>
#include <asm/barebox-arm-head.h>
-extern unsigned long _stext;
-
void __naked __flash_header_start go(void)
{
barebox_arm_head();
@@ -82,4 +80,4 @@ struct imx_flash_header __flash_header_section flash_header = {
.dcd_block_len = sizeof (dcd_entry),
};
-unsigned long __image_len_section barebox_len = 0x40000;
+unsigned long __image_len_section barebox_len = DCD_BAREBOX_SIZE;
diff --git a/arch/arm/boards/freescale-mx25-3-stack/3stack.c b/arch/arm/boards/freescale-mx25-3-stack/3stack.c
index f684864..c63467a 100644
--- a/arch/arm/boards/freescale-mx25-3-stack/3stack.c
+++ b/arch/arm/boards/freescale-mx25-3-stack/3stack.c
@@ -45,7 +45,6 @@
#include <mach/devices-imx25.h>
#include <asm/barebox-arm-head.h>
-extern unsigned long _stext;
extern void exception_vectors(void);
void __naked __flash_header_start go(void)
@@ -107,9 +106,7 @@ struct imx_flash_header __flash_header_section flash_header = {
.dcd_block_len = sizeof(dcd_entry),
};
-extern unsigned long __bss_start;
-
-unsigned long __image_len_section barebox_len = 0x40000;
+unsigned long __image_len_section barebox_len = DCD_BAREBOX_SIZE;
static struct fec_platform_data fec_info = {
.xcv_type = RMII,
--git a/arch/arm/boards/freescale-mx35-3-stack/flash_header.c b/arch/arm/boards/freescale-mx35-3-stack/flash_header.c
index 85b52a2..0786836 100644
--- a/arch/arm/boards/freescale-mx35-3-stack/flash_header.c
+++ b/arch/arm/boards/freescale-mx35-3-stack/flash_header.c
@@ -70,5 +70,5 @@ struct imx_flash_header __flash_header_section flash_header = {
.dcd_block_len = sizeof(dcd_entry),
};
-unsigned long __image_len_section barebox_len = 0x40000;
+unsigned long __image_len_section barebox_len = DCD_BAREBOX_SIZE;
--git a/arch/arm/boards/freescale-mx51-pdk/flash_header.c b/arch/arm/boards/freescale-mx51-pdk/flash_header.c
index 297dca1..c148eea 100644
--- a/arch/arm/boards/freescale-mx51-pdk/flash_header.c
+++ b/arch/arm/boards/freescale-mx51-pdk/flash_header.c
@@ -2,8 +2,6 @@
#include <mach/imx-flash-header.h>
#include <asm/barebox-arm-head.h>
-extern unsigned long _stext;
-
void __naked __flash_header_start go(void)
{
barebox_arm_head();
@@ -82,5 +80,5 @@ struct imx_flash_header __flash_header_section flash_header = {
.dcd_block_len = sizeof (dcd_entry),
};
-unsigned long __image_len_section barebox_len = 0x40000;
+unsigned long __image_len_section barebox_len = DCD_BAREBOX_SIZE;
--git a/arch/arm/boards/freescale-mx53-loco/flash_header.c b/arch/arm/boards/freescale-mx53-loco/flash_header.c
index b459640..52e6eee 100644
--- a/arch/arm/boards/freescale-mx53-loco/flash_header.c
+++ b/arch/arm/boards/freescale-mx53-loco/flash_header.c
@@ -90,7 +90,7 @@ struct imx_flash_header_v2 __flash_header_section flash_header = {
.self = APP_DEST + 0x400,
.boot_data.start = APP_DEST,
- .boot_data.size = 0x40000,
+ .boot_data.size = DCD_BAREBOX_SIZE,
.dcd.header.tag = DCD_HEADER_TAG,
.dcd.header.length = cpu_to_be16(sizeof(struct imx_dcd) + sizeof(dcd_entry)),
--git a/arch/arm/boards/freescale-mx53-smd/flash_header.c b/arch/arm/boards/freescale-mx53-smd/flash_header.c
index b459640..52e6eee 100644
--- a/arch/arm/boards/freescale-mx53-smd/flash_header.c
+++ b/arch/arm/boards/freescale-mx53-smd/flash_header.c
@@ -90,7 +90,7 @@ struct imx_flash_header_v2 __flash_header_section flash_header = {
.self = APP_DEST + 0x400,
.boot_data.start = APP_DEST,
- .boot_data.size = 0x40000,
+ .boot_data.size = DCD_BAREBOX_SIZE,
.dcd.header.tag = DCD_HEADER_TAG,
.dcd.header.length = cpu_to_be16(sizeof(struct imx_dcd) + sizeof(dcd_entry)),
--git a/arch/arm/boards/tqma53/flash_header.c b/arch/arm/boards/tqma53/flash_header.c
index 73ea0c3..f5e817c 100644
--- a/arch/arm/boards/tqma53/flash_header.c
+++ b/arch/arm/boards/tqma53/flash_header.c
@@ -97,7 +97,7 @@ struct imx_flash_header_v2 __flash_header_section flash_header = {
.self = APP_DEST + 0x400,
.boot_data.start = APP_DEST,
- .boot_data.size = 0x40000,
+ .boot_data.size = DCD_BAREBOX_SIZE,
.dcd.header.tag = DCD_HEADER_TAG,
.dcd.header.length = cpu_to_be16(sizeof(struct imx_dcd) + sizeof(dcd_entry)),
--git a/arch/arm/mach-imx/include/mach/imx-flash-header.h b/arch/arm/mach-imx/include/mach/imx-flash-header.h
index 8744262..ca2fe9f 100644
--- a/arch/arm/mach-imx/include/mach/imx-flash-header.h
+++ b/arch/arm/mach-imx/include/mach/imx-flash-header.h
@@ -1,6 +1,8 @@
#ifndef __MACH_FLASH_HEADER_H
#define __MACH_FLASH_HEADER_H
+#include <asm-generic/sections.h>
+
#define __flash_header_start __section(.flash_header_start)
#if defined(CONFIG_ARCH_IMX_INTERNAL_BOOT_NOR)
@@ -87,6 +89,14 @@ struct imx_flash_header {
#define DCD_COMMAND_WRITE_TAG 0xcc
#define DCD_COMMAND_WRITE_PARAM 0x04
+/*
+ * At least on i.MX5 the ROM copies only full blocks. Unfortunately
+ * it does not round up to the next full block, we have to do it
+ * ourselves. Use 4095 which should be enough for the largest NAND
+ * pages.
+ */
+#define DCD_BAREBOX_SIZE (barebox_image_size + 4095)
+
struct imx_ivt_header {
uint8_t tag;
__be16 length;
--
1.7.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-23 8:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-23 8:02 fix i.MX flash header copy sizes Sascha Hauer
2012-03-23 8:02 ` [PATCH 1/2] ARM linker script: Fix barebox_image_size Sascha Hauer
2012-03-23 8:02 ` [PATCH 2/2] ARM i.MX flash header: Fix barebox image sizes Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox