diff mbox

[U-Boot,v3] AT91SAM9*: Change kernel address in dataflash to match u-boot's size

Message ID 1329756057-2868-1-git-send-email-alexandre.belloni@piout.net
State Changes Requested
Headers show

Commit Message

Alexandre Belloni Feb. 20, 2012, 4:40 p.m. UTC
On at91sam platforms, u-boot grew larger than the allocated size in
dataflash, the layout was:
bootstrap  0x00000000
ubootenv   0x00004200
uboot      0x00008400
kernel     0x00042000

u-boot with the defconfig doesn't seem to fit in 0x42000 - 0x8400 =
0x39C00 bytes anymore.

Now, the layout is:
bootstrap  0x00000000
uboot      0x00004000
ubootenv   0x00084000
ubootenv2  0x00088000
kernel     0x0008C000

Signed-off-by: Alexandre Belloni <alexandre.belloni@piout.net>
---
Changes for v2:
	- changed the layout as per Marek's recommendation
Changes for v3:
	- prefixed the patch title with AT91SAM9*:

 include/configs/at91sam9260ek.h |   18 ++++++++++++------
 include/configs/at91sam9261ek.h |   18 ++++++++++++------
 include/configs/at91sam9263ek.h |   10 +++++++---
 include/configs/at91sam9rlek.h  |   10 +++++++---
 4 files changed, 38 insertions(+), 18 deletions(-)

Comments

Ulf Samuelsson Feb. 27, 2012, 3:25 p.m. UTC | #1
On 2012-02-20 17:40, Alexandre Belloni wrote:
> On at91sam platforms, u-boot grew larger than the allocated size in
> dataflash, the layout was:
> bootstrap  0x00000000
> ubootenv   0x00004200
> uboot      0x00008400
> kernel     0x00042000
>
> u-boot with the defconfig doesn't seem to fit in 0x42000 - 0x8400 =
> 0x39C00 bytes anymore.
>
> Now, the layout is:
> bootstrap  0x00000000
> uboot      0x00004000
> ubootenv   0x00084000
> ubootenv2  0x00088000
> kernel     0x0008C000
>


NAK!

1. You need to be aware of the page size of dataflashes.
     Each page is 1056 bytes, not 1024 bytes.
     Your patch will make the U-Boot image start in the middle of a page.
2. Std AT91bootstrap loads U-Boot from 0x8400
     so your patch breaks 99% of all SAM9  boards.

If you want to grow U-Boot, then

bootstrap  0x00000000		; 16 kB
ubootenv   0x00004200		; 16 kB	- Should be plenty
uboot      0x00008400		;
kernel     0x00063000		; Why waste space...




> Signed-off-by: Alexandre Belloni<alexandre.belloni@piout.net>
> ---
> Changes for v2:
> 	- changed the layout as per Marek's recommendation
> Changes for v3:
> 	- prefixed the patch title with AT91SAM9*:
>
>   include/configs/at91sam9260ek.h |   18 ++++++++++++------
>   include/configs/at91sam9261ek.h |   18 ++++++++++++------
>   include/configs/at91sam9263ek.h |   10 +++++++---
>   include/configs/at91sam9rlek.h  |   10 +++++++---
>   4 files changed, 38 insertions(+), 18 deletions(-)
>
> diff --git a/include/configs/at91sam9260ek.h b/include/configs/at91sam9260ek.h
> index db52ee6..b537760 100644
> --- a/include/configs/at91sam9260ek.h
> +++ b/include/configs/at91sam9260ek.h
> @@ -185,10 +185,12 @@
>   /* bootstrap + u-boot + env + linux in dataflash on CS0 */
>   #define CONFIG_ENV_IS_IN_DATAFLASH	1
>   #define CONFIG_SYS_MONITOR_BASE	(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + 0x8400)
> -#define CONFIG_ENV_OFFSET		0x4200
> +#define CONFIG_ENV_OFFSET		0x84000
>   #define CONFIG_ENV_ADDR		(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + CONFIG_ENV_OFFSET)
> -#define CONFIG_ENV_SIZE		0x4200
> -#define CONFIG_BOOTCOMMAND	"cp.b 0xC0042000 0x22000000 0x210000; bootm"
> +#define CONFIG_ENV_SIZE		0x4000
> +#define CONFIG_ENV_ADDR_REDUND (CONFIG_ENV_ADDR+CONFIG_ENV_SIZE)
> +#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
> +#define CONFIG_BOOTCOMMAND	"cp.b 0xC008C000 0x22000000 0x210000; bootm"
>   #define CONFIG_BOOTARGS		"console=ttyS0,115200 "			\
>   				"root=/dev/mtdblock0 "			\
>   				"mtdparts=atmel_nand:-(root) "		\
> @@ -199,10 +201,12 @@
>   /* bootstrap + u-boot + env + linux in dataflash on CS1 */
>   #define CONFIG_ENV_IS_IN_DATAFLASH	1
>   #define CONFIG_SYS_MONITOR_BASE	(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS1 + 0x8400)
> -#define CONFIG_ENV_OFFSET		0x4200
> +#define CONFIG_ENV_OFFSET		0x84000
>   #define CONFIG_ENV_ADDR		(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS1 + CONFIG_ENV_OFFSET)
> -#define CONFIG_ENV_SIZE		0x4200
> -#define CONFIG_BOOTCOMMAND	"cp.b 0xD0042000 0x22000000 0x210000; bootm"
> +#define CONFIG_ENV_SIZE		0x4000
> +#define CONFIG_ENV_ADDR_REDUND (CONFIG_ENV_ADDR+CONFIG_ENV_SIZE)
> +#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
> +#define CONFIG_BOOTCOMMAND	"cp.b 0xD008C000 0x22000000 0x210000; bootm"
>   #define CONFIG_BOOTARGS		"console=ttyS0,115200 "			\
>   				"root=/dev/mtdblock0 "			\
>   				"mtdparts=atmel_nand:-(root) "		\
> @@ -231,6 +235,8 @@
>   #define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
>   #define CONFIG_SYS_LONGHELP		1
>   #define CONFIG_CMDLINE_EDITING	1
> +#define CONFIG_AUTO_COMPLETE
> +#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
>
>   /*
>    * Size of malloc() pool
> diff --git a/include/configs/at91sam9261ek.h b/include/configs/at91sam9261ek.h
> index 5140b26..fa461da 100644
> --- a/include/configs/at91sam9261ek.h
> +++ b/include/configs/at91sam9261ek.h
> @@ -187,10 +187,12 @@
>   /* bootstrap + u-boot + env + linux in dataflash on CS0 */
>   #define CONFIG_ENV_IS_IN_DATAFLASH
>   #define CONFIG_SYS_MONITOR_BASE	(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + 0x8400)
> -#define CONFIG_ENV_OFFSET	0x4200
> +#define CONFIG_ENV_OFFSET	0x84000
>   #define CONFIG_ENV_ADDR		(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + CONFIG_ENV_OFFSET)
> -#define CONFIG_ENV_SIZE		0x4200
> -#define CONFIG_BOOTCOMMAND	"cp.b 0xC0042000 0x22000000 0x210000; bootm"
> +#define CONFIG_ENV_SIZE		0x4000
> +#define CONFIG_ENV_ADDR_REDUND (CONFIG_ENV_ADDR+CONFIG_ENV_SIZE)
> +#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
> +#define CONFIG_BOOTCOMMAND	"cp.b 0xC008C000 0x22000000 0x210000; bootm"
>   #define CONFIG_BOOTARGS		"console=ttyS0,115200 "			\
>   				"root=/dev/mtdblock0 "			\
>   				"mtdparts=atmel_nand:-(root) "		\
> @@ -201,10 +203,12 @@
>   /* bootstrap + u-boot + env + linux in dataflash on CS3 */
>   #define CONFIG_ENV_IS_IN_DATAFLASH
>   #define CONFIG_SYS_MONITOR_BASE	(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS3 + 0x8400)
> -#define CONFIG_ENV_OFFSET	0x4200
> +#define CONFIG_ENV_OFFSET	0x84000
>   #define CONFIG_ENV_ADDR		(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS3 + CONFIG_ENV_OFFSET)
> -#define CONFIG_ENV_SIZE		0x4200
> -#define CONFIG_BOOTCOMMAND	"cp.b 0xD0042000 0x22000000 0x210000; bootm"
> +#define CONFIG_ENV_SIZE		0x4000
> +#define CONFIG_ENV_ADDR_REDUND (CONFIG_ENV_ADDR+CONFIG_ENV_SIZE)
> +#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
> +#define CONFIG_BOOTCOMMAND	"cp.b 0xD008C000 0x22000000 0x210000; bootm"
>   #define CONFIG_BOOTARGS		"console=ttyS0,115200 "			\
>   				"root=/dev/mtdblock0 "			\
>   				"mtdparts=atmel_nand:-(root) "		\
> @@ -233,6 +237,8 @@
>   #define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
>   #define CONFIG_SYS_LONGHELP
>   #define CONFIG_CMDLINE_EDITING
> +#define CONFIG_AUTO_COMPLETE
> +#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
>
>   /*
>    * Size of malloc() pool
> diff --git a/include/configs/at91sam9263ek.h b/include/configs/at91sam9263ek.h
> index 8399246..253bee4 100644
> --- a/include/configs/at91sam9263ek.h
> +++ b/include/configs/at91sam9263ek.h
> @@ -314,10 +314,12 @@
>   /* bootstrap + u-boot + env + linux in dataflash on CS0 */
>   #define CONFIG_ENV_IS_IN_DATAFLASH	1
>   #define CONFIG_SYS_MONITOR_BASE	(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + 0x8400)
> -#define CONFIG_ENV_OFFSET		0x4200
> +#define CONFIG_ENV_OFFSET		0x84000
>   #define CONFIG_ENV_ADDR		(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + CONFIG_ENV_OFFSET)
> -#define CONFIG_ENV_SIZE		0x4200
> -#define CONFIG_BOOTCOMMAND	"cp.b 0xC0042000 0x22000000 0x210000; bootm"
> +#define CONFIG_ENV_SIZE		0x4000
> +#define CONFIG_ENV_ADDR_REDUND (CONFIG_ENV_ADDR+CONFIG_ENV_SIZE)
> +#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
> +#define CONFIG_BOOTCOMMAND	"cp.b 0xC008C000 0x22000000 0x210000; bootm"
>   #define CONFIG_BOOTARGS		"console=ttyS0,115200 " \
>   				"root=/dev/mtdblock0 " \
>   				"mtdparts=atmel_nand:-(root) "\
> @@ -347,6 +349,8 @@
>   #define CONFIG_AUTO_COMPLETE
>   #define CONFIG_SYS_HUSH_PARSER
>   #define CONFIG_SYS_PROMPT_HUSH_PS2	">  "
> +#define CONFIG_AUTO_COMPLETE
> +#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
>
>   /*
>    * Size of malloc() pool
> diff --git a/include/configs/at91sam9rlek.h b/include/configs/at91sam9rlek.h
> index 79ea1f2..423f523 100644
> --- a/include/configs/at91sam9rlek.h
> +++ b/include/configs/at91sam9rlek.h
> @@ -153,10 +153,12 @@
>   /* bootstrap + u-boot + env + linux in dataflash on CS0 */
>   #define CONFIG_ENV_IS_IN_DATAFLASH	1
>   #define CONFIG_SYS_MONITOR_BASE	(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + 0x8400)
> -#define CONFIG_ENV_OFFSET		0x4200
> +#define CONFIG_ENV_OFFSET		0x84000
>   #define CONFIG_ENV_ADDR		(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + CONFIG_ENV_OFFSET)
> -#define CONFIG_ENV_SIZE		0x4200
> -#define CONFIG_BOOTCOMMAND	"cp.b 0xC0042000 0x22000000 0x210000; bootm"
> +#define CONFIG_ENV_SIZE		0x4000
> +#define CONFIG_ENV_ADDR_REDUND (CONFIG_ENV_ADDR+CONFIG_ENV_SIZE)
> +#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
> +#define CONFIG_BOOTCOMMAND	"cp.b 0xC008C000 0x22000000 0x210000; bootm"
>   #define CONFIG_BOOTARGS		"console=ttyS0,115200 " \
>   				"root=/dev/mtdblock0 " \
>   				"mtdparts=atmel_nand:-(root) "\
> @@ -183,6 +185,8 @@
>   #define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
>   #define CONFIG_SYS_LONGHELP		1
>   #define CONFIG_CMDLINE_EDITING		1
> +#define CONFIG_AUTO_COMPLETE
> +#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
>
>   /*
>    * Size of malloc() pool
Alexandre Belloni Feb. 28, 2012, 10:57 p.m. UTC | #2
On Mon, Feb 27, 2012 at 04:25:02PM +0100, Ulf Samuelsson wrote :
> On 2012-02-20 17:40, Alexandre Belloni wrote:
> >On at91sam platforms, u-boot grew larger than the allocated size in
> >dataflash, the layout was:
> >bootstrap  0x00000000
> >ubootenv   0x00004200
> >uboot      0x00008400
> >kernel     0x00042000
> >
> >u-boot with the defconfig doesn't seem to fit in 0x42000 - 0x8400 =
> >0x39C00 bytes anymore.
> >
> >Now, the layout is:
> >bootstrap  0x00000000
> >uboot      0x00004000
> >ubootenv   0x00084000
> >ubootenv2  0x00088000
> >kernel     0x0008C000
> >
> 
> 
> NAK!
> 
> 1. You need to be aware of the page size of dataflashes.
>     Each page is 1056 bytes, not 1024 bytes.
>     Your patch will make the U-Boot image start in the middle of a page.

Ok, I couldn't find a clear spec on that dataflash...

> 2. Std AT91bootstrap loads U-Boot from 0x8400
>     so your patch breaks 99% of all SAM9  boards.
> 

Those boards are broken anyway ! As u-boot is bigger than the load size
of at91bootstrap (0x33900 by default). So, not changing means that you
are screwed after flashing a new u-boot.

> If you want to grow U-Boot, then
> 
> bootstrap  0x00000000		; 16 kB
> ubootenv   0x00004200		; 16 kB	- Should be plenty
> uboot      0x00008400		;
> kernel     0x00063000		; Why waste space...
> 

What about the redundant env ? Why shouldn't we reorder u-boot and its
env ?

Regards,
Ulf Samuelsson Feb. 29, 2012, 12:50 a.m. UTC | #3
28 feb 2012 kl. 23:57 skrev Alexandre Belloni <alexandre.belloni@piout.net>:

> On Mon, Feb 27, 2012 at 04:25:02PM +0100, Ulf Samuelsson wrote :
>> On 2012-02-20 17:40, Alexandre Belloni wrote:
>>> On at91sam platforms, u-boot grew larger than the allocated size in
>>> dataflash, the layout was:
>>> bootstrap  0x00000000
>>> ubootenv   0x00004200
>>> uboot      0x00008400
>>> kernel     0x00042000
>>> 
>>> u-boot with the defconfig doesn't seem to fit in 0x42000 - 0x8400 =
>>> 0x39C00 bytes anymore.
>>> 
>>> Now, the layout is:
>>> bootstrap  0x00000000
>>> uboot      0x00004000
>>> ubootenv   0x00084000
>>> ubootenv2  0x00088000
>>> kernel     0x0008C000
>>> 
>> 
>> 
>> NAK!
>> 
>> 1. You need to be aware of the page size of dataflashes.
>>    Each page is 1056 bytes, not 1024 bytes.
>>    Your patch will make the U-Boot image start in the middle of a page.
> 
> Ok, I couldn't find a clear spec on that dataflash...

maybe you should have tried to look at the Atmel homepage...

> 
>> 2. Std AT91bootstrap loads U-Boot from 0x8400
>>    so your patch breaks 99% of all SAM9  boards.
>> 
> 
> Those boards are broken anyway !

No they are not.
The partitioning gives you some hint on where to store the kernel,
but you can store the kernel at any suitable address.
you lose some conveniance, but thats all.

Storing U-boot at any other address than 0x8400, means that AT91bootstrap
must be modified, and there is significant disadvantages in having two possible u-boot locations.
if you have an at91bootstrap binary, will this use the old or new location?
I fail to see any benefit in moving, so that 



> As u-boot is bigger than the load size
> of at91bootstrap (0x33900 by default). So, not changing means that you
> are screwed after flashing a new u-boot

IIRC, The latest bootstrap with Kconfig has configurable size.
Changing size is OK, changing location is not.




>> If you want to grow U-Boot, then
>> 
>> bootstrap  0x00000000        ; 16 kB
>> ubootenv   0x00004200        ; 16 kB    - Should be plenty
>> uboot      0x00008400        ;
>> kernel     0x00063000        ; Why waste space...
>> 
> 
> What about the redundant env ? Why shouldn't we reorder u-boot and its
> env ?

Because it adds problems without any benefits.
When I looked the last time, the environment is only 8 pages,
So you can fit a redundant environment anyway in 16 kB+}


> 
> Regards,
> 
> -- 
> Alexandre Belloni


Best Regards
Ulf Samuelsson
ulf@emagii.com
Alexandre Belloni Feb. 29, 2012, 8:58 a.m. UTC | #4
On Wed, Feb 29, 2012 at 01:50:18AM +0100, Ulf Samuelsson wrote :
> > 
> >> 2. Std AT91bootstrap loads U-Boot from 0x8400
> >>    so your patch breaks 99% of all SAM9  boards.
> >> 
> > 
> > Those boards are broken anyway !
> 
> No they are not.
> The partitioning gives you some hint on where to store the kernel,
> but you can store the kernel at any suitable address.
> you lose some conveniance, but thats all.
> 
> Storing U-boot at any other address than 0x8400, means that AT91bootstrap
> must be modified, and there is significant disadvantages in having two possible u-boot locations.
> if you have an at91bootstrap binary, will this use the old or new location?
> I fail to see any benefit in moving, so that 
> 
> 
> 
> > As u-boot is bigger than the load size
> > of at91bootstrap (0x33900 by default). So, not changing means that you
> > are screwed after flashing a new u-boot
> 
> IIRC, The latest bootstrap with Kconfig has configurable size.
> Changing size is OK, changing location is not.
> 
> 

Doesn't that mean that you then have to recompile/reflash at91bootstrap
and so that the boards are broken using the latest ut-boot ? I couldn't
get my board working with the stock at91bootstrap because it cannot load
u-boot.

It has to be fixed or I don't see the point in keeping those configs.
If we don't want to change the location, and I can understand the
reasons why, then was my first patch ok ?

http://lists.denx.de/pipermail/u-boot/2012-January/114485.html

I'd like to see that fixed so that I could integrate it properly in
buildroot...

> 
> 
> >> If you want to grow U-Boot, then
> >> 
> >> bootstrap  0x00000000        ; 16 kB
> >> ubootenv   0x00004200        ; 16 kB    - Should be plenty
> >> uboot      0x00008400        ;
> >> kernel     0x00063000        ; Why waste space...
> >> 
> > 
> > What about the redundant env ? Why shouldn't we reorder u-boot and its
> > env ?
> 
> Because it adds problems without any benefits.
> When I looked the last time, the environment is only 8 pages,
> So you can fit a redundant environment anyway in 16 kB+}
>
Ulf Samuelsson Feb. 29, 2012, 9:49 a.m. UTC | #5
On 2012-02-29 09:58, Alexandre Belloni wrote:
> On Wed, Feb 29, 2012 at 01:50:18AM +0100, Ulf Samuelsson wrote :
>>> SIZE
>>>> 2. Std AT91bootstrap loads U-Boot from 0x8400
>>>>     so your patch breaks 99% of all SAM9  boards.
>>>>
>>> Those boards are broken anyway !
>> No they are not.
>> The partitioning gives you some hint on where to store the kernel,
>> but you can store the kernel at any suitable address.
>> you lose some conveniance, but thats all.
>>
>> Storing U-boot at any other address than 0x8400, means that AT91bootstrap
>> must be modified, and there is significant disadvantages in having two possible u-boot locations.
>> if you have an at91bootstrap binary, will this use the old or new location?
>> I fail to see any benefit in moving, so that
>>
>>
>>
>>> As u-boot is bigger than the load size
>>> of at91bootstrap (0x33900 by default). So, not changing means that you
>>> are screwed after flashing a new u-boot
>> IIRC, The latest bootstrap with Kconfig has configurable size.
>> Changing size is OK, changing location is not.
>>
>>
> Doesn't that mean that you then have to recompile/reflash at91bootstrap
> and so that the boards are broken using the latest ut-boot ? I couldn't
> get my board working with the stock at91bootstrap because it cannot load
> u-boot.
>
The size of the image loaded by at91bootstrap
can be configured by the user using KConfig.

The load address cannot be changed in KConfig
For this, you have to modify the source code - bad idea.

I think it would be good, if the u-boot image contained its own size 
somewhere.
(Maybe it does already) marked with some magic key, so that the size can be
determined during run time.

I don't like the idea to move the environment as the default.
There are people that try to fit the complete kernel + file system
into a single 8 MB dataflash and you are using way too much space
for U-Boot.  If you want to have environment in the high memory,
then this should be an option, and not enabled by default.

Also, you are putting the environment into the same block as the kernel.

 From the datasheet:
"Each page within a sector must be updated/rewritten at least once 
within every
10,000 cumulative page erase/program operations in that sector."

So updating the environment, may corrupt the kernel.

With a large environment = 32 kB this will happen 4 times faster
than with an 8 kB environement.
I.E: instead of within every 1250 "saveenv", it must happen
within every 312 "saveenv" which is "danger close".

The environment should thus be as small as acceptable.-

To avoid the problem fully, you have to allocate a 256 KB sector for 
each environment,
which means that U-Boot will use 1 MB. Maybe a single 256 kB sector will do.
This will cause a significant addition to programming time and is real 
wasteful
in terms of memory-

Better to localize the problem and put the 2 x 8 kB environment and 
U-Boot in the first sector
with U-Boot overlapping into the second sector.
This will allow people to choose exactly where the kernel starts.

The kernel should start at sector 3 (page 512) = 0x84000 to avoid
problems, if you keep reprogramming u-boot.
Sector 0 = 8 kB, 1 = 248 kB, 2 = 256 kB (with 1 kB = 1056 bytes in this 
case)

People which wants to optimize memory can then still put the kernel at a 
lower location.

Did not study the size issue, fully, but I would not be surprised if you
could, by removing features, still fit u-boot within sector 1, so moving 
"kernel" to
0x84000 should be an option, enabled in those configs, which do result in
growing beyond 0x42000.


> If we don't want to change the location, and I can understand the
> reasons why, then was my first patch ok ?
>
> http://lists.denx.de/pipermail/u-boot/2012-January/114485.html
>
> I'd like to see that fixed so that I could integrate it properly in
> buildroot...
>

>>
>>>> If you want to grow U-Boot, then
>>>>
>>>> bootstrap  0x00000000        ; 16 kB
>>>> ubootenv   0x00004200        ; 16 kB    - Should be plenty
>>>> uboot      0x00008400        ;
>>>> kernel     0x00063000        ; Why waste space...
>>>>
>>> What about the redundant env ? Why shouldn't we reorder u-boot and its
>>> env ?
>> Because it adds problems without any benefits.
>> When I looked the last time, the environment is only 8 pages,
>> So you can fit a redundant environment anyway in 16 kB+}
>>
>
>
diff mbox

Patch

diff --git a/include/configs/at91sam9260ek.h b/include/configs/at91sam9260ek.h
index db52ee6..b537760 100644
--- a/include/configs/at91sam9260ek.h
+++ b/include/configs/at91sam9260ek.h
@@ -185,10 +185,12 @@ 
 /* bootstrap + u-boot + env + linux in dataflash on CS0 */
 #define CONFIG_ENV_IS_IN_DATAFLASH	1
 #define CONFIG_SYS_MONITOR_BASE	(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + 0x8400)
-#define CONFIG_ENV_OFFSET		0x4200
+#define CONFIG_ENV_OFFSET		0x84000
 #define CONFIG_ENV_ADDR		(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + CONFIG_ENV_OFFSET)
-#define CONFIG_ENV_SIZE		0x4200
-#define CONFIG_BOOTCOMMAND	"cp.b 0xC0042000 0x22000000 0x210000; bootm"
+#define CONFIG_ENV_SIZE		0x4000
+#define CONFIG_ENV_ADDR_REDUND (CONFIG_ENV_ADDR+CONFIG_ENV_SIZE)
+#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
+#define CONFIG_BOOTCOMMAND	"cp.b 0xC008C000 0x22000000 0x210000; bootm"
 #define CONFIG_BOOTARGS		"console=ttyS0,115200 "			\
 				"root=/dev/mtdblock0 "			\
 				"mtdparts=atmel_nand:-(root) "		\
@@ -199,10 +201,12 @@ 
 /* bootstrap + u-boot + env + linux in dataflash on CS1 */
 #define CONFIG_ENV_IS_IN_DATAFLASH	1
 #define CONFIG_SYS_MONITOR_BASE	(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS1 + 0x8400)
-#define CONFIG_ENV_OFFSET		0x4200
+#define CONFIG_ENV_OFFSET		0x84000
 #define CONFIG_ENV_ADDR		(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS1 + CONFIG_ENV_OFFSET)
-#define CONFIG_ENV_SIZE		0x4200
-#define CONFIG_BOOTCOMMAND	"cp.b 0xD0042000 0x22000000 0x210000; bootm"
+#define CONFIG_ENV_SIZE		0x4000
+#define CONFIG_ENV_ADDR_REDUND (CONFIG_ENV_ADDR+CONFIG_ENV_SIZE)
+#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
+#define CONFIG_BOOTCOMMAND	"cp.b 0xD008C000 0x22000000 0x210000; bootm"
 #define CONFIG_BOOTARGS		"console=ttyS0,115200 "			\
 				"root=/dev/mtdblock0 "			\
 				"mtdparts=atmel_nand:-(root) "		\
@@ -231,6 +235,8 @@ 
 #define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
 #define CONFIG_SYS_LONGHELP		1
 #define CONFIG_CMDLINE_EDITING	1
+#define CONFIG_AUTO_COMPLETE
+#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
 
 /*
  * Size of malloc() pool
diff --git a/include/configs/at91sam9261ek.h b/include/configs/at91sam9261ek.h
index 5140b26..fa461da 100644
--- a/include/configs/at91sam9261ek.h
+++ b/include/configs/at91sam9261ek.h
@@ -187,10 +187,12 @@ 
 /* bootstrap + u-boot + env + linux in dataflash on CS0 */
 #define CONFIG_ENV_IS_IN_DATAFLASH
 #define CONFIG_SYS_MONITOR_BASE	(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + 0x8400)
-#define CONFIG_ENV_OFFSET	0x4200
+#define CONFIG_ENV_OFFSET	0x84000
 #define CONFIG_ENV_ADDR		(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + CONFIG_ENV_OFFSET)
-#define CONFIG_ENV_SIZE		0x4200
-#define CONFIG_BOOTCOMMAND	"cp.b 0xC0042000 0x22000000 0x210000; bootm"
+#define CONFIG_ENV_SIZE		0x4000
+#define CONFIG_ENV_ADDR_REDUND (CONFIG_ENV_ADDR+CONFIG_ENV_SIZE)
+#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
+#define CONFIG_BOOTCOMMAND	"cp.b 0xC008C000 0x22000000 0x210000; bootm"
 #define CONFIG_BOOTARGS		"console=ttyS0,115200 "			\
 				"root=/dev/mtdblock0 "			\
 				"mtdparts=atmel_nand:-(root) "		\
@@ -201,10 +203,12 @@ 
 /* bootstrap + u-boot + env + linux in dataflash on CS3 */
 #define CONFIG_ENV_IS_IN_DATAFLASH
 #define CONFIG_SYS_MONITOR_BASE	(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS3 + 0x8400)
-#define CONFIG_ENV_OFFSET	0x4200
+#define CONFIG_ENV_OFFSET	0x84000
 #define CONFIG_ENV_ADDR		(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS3 + CONFIG_ENV_OFFSET)
-#define CONFIG_ENV_SIZE		0x4200
-#define CONFIG_BOOTCOMMAND	"cp.b 0xD0042000 0x22000000 0x210000; bootm"
+#define CONFIG_ENV_SIZE		0x4000
+#define CONFIG_ENV_ADDR_REDUND (CONFIG_ENV_ADDR+CONFIG_ENV_SIZE)
+#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
+#define CONFIG_BOOTCOMMAND	"cp.b 0xD008C000 0x22000000 0x210000; bootm"
 #define CONFIG_BOOTARGS		"console=ttyS0,115200 "			\
 				"root=/dev/mtdblock0 "			\
 				"mtdparts=atmel_nand:-(root) "		\
@@ -233,6 +237,8 @@ 
 #define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
 #define CONFIG_SYS_LONGHELP
 #define CONFIG_CMDLINE_EDITING
+#define CONFIG_AUTO_COMPLETE
+#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
 
 /*
  * Size of malloc() pool
diff --git a/include/configs/at91sam9263ek.h b/include/configs/at91sam9263ek.h
index 8399246..253bee4 100644
--- a/include/configs/at91sam9263ek.h
+++ b/include/configs/at91sam9263ek.h
@@ -314,10 +314,12 @@ 
 /* bootstrap + u-boot + env + linux in dataflash on CS0 */
 #define CONFIG_ENV_IS_IN_DATAFLASH	1
 #define CONFIG_SYS_MONITOR_BASE	(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + 0x8400)
-#define CONFIG_ENV_OFFSET		0x4200
+#define CONFIG_ENV_OFFSET		0x84000
 #define CONFIG_ENV_ADDR		(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + CONFIG_ENV_OFFSET)
-#define CONFIG_ENV_SIZE		0x4200
-#define CONFIG_BOOTCOMMAND	"cp.b 0xC0042000 0x22000000 0x210000; bootm"
+#define CONFIG_ENV_SIZE		0x4000
+#define CONFIG_ENV_ADDR_REDUND (CONFIG_ENV_ADDR+CONFIG_ENV_SIZE)
+#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
+#define CONFIG_BOOTCOMMAND	"cp.b 0xC008C000 0x22000000 0x210000; bootm"
 #define CONFIG_BOOTARGS		"console=ttyS0,115200 " \
 				"root=/dev/mtdblock0 " \
 				"mtdparts=atmel_nand:-(root) "\
@@ -347,6 +349,8 @@ 
 #define CONFIG_AUTO_COMPLETE
 #define CONFIG_SYS_HUSH_PARSER
 #define CONFIG_SYS_PROMPT_HUSH_PS2	"> "
+#define CONFIG_AUTO_COMPLETE
+#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
 
 /*
  * Size of malloc() pool
diff --git a/include/configs/at91sam9rlek.h b/include/configs/at91sam9rlek.h
index 79ea1f2..423f523 100644
--- a/include/configs/at91sam9rlek.h
+++ b/include/configs/at91sam9rlek.h
@@ -153,10 +153,12 @@ 
 /* bootstrap + u-boot + env + linux in dataflash on CS0 */
 #define CONFIG_ENV_IS_IN_DATAFLASH	1
 #define CONFIG_SYS_MONITOR_BASE	(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + 0x8400)
-#define CONFIG_ENV_OFFSET		0x4200
+#define CONFIG_ENV_OFFSET		0x84000
 #define CONFIG_ENV_ADDR		(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + CONFIG_ENV_OFFSET)
-#define CONFIG_ENV_SIZE		0x4200
-#define CONFIG_BOOTCOMMAND	"cp.b 0xC0042000 0x22000000 0x210000; bootm"
+#define CONFIG_ENV_SIZE		0x4000
+#define CONFIG_ENV_ADDR_REDUND (CONFIG_ENV_ADDR+CONFIG_ENV_SIZE)
+#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
+#define CONFIG_BOOTCOMMAND	"cp.b 0xC008C000 0x22000000 0x210000; bootm"
 #define CONFIG_BOOTARGS		"console=ttyS0,115200 " \
 				"root=/dev/mtdblock0 " \
 				"mtdparts=atmel_nand:-(root) "\
@@ -183,6 +185,8 @@ 
 #define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
 #define CONFIG_SYS_LONGHELP		1
 #define CONFIG_CMDLINE_EDITING		1
+#define CONFIG_AUTO_COMPLETE
+#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
 
 /*
  * Size of malloc() pool