public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ulf Samuelsson <u-boot@emagii.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3] AT91SAM9*: Change kernel address in dataflash to match u-boot's size
Date: Mon, 27 Feb 2012 16:25:02 +0100	[thread overview]
Message-ID: <4F4BA04E.7050200@emagii.com> (raw)
In-Reply-To: <1329756057-2868-1-git-send-email-alexandre.belloni@piout.net>

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

-- 
Best Regards
Ulf Samuelsson
ulf at emagii.com
+46 722 427437

  reply	other threads:[~2012-02-27 15:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-29 21:37 [U-Boot] [PATCH v2] Change kernel address in dataflash to match u-boot's size Alexandre Belloni
2012-02-18 15:13 ` Albert ARIBAUD
2012-02-18 16:21   ` Albert ARIBAUD
2012-02-20 10:40     ` Alexandre Belloni
2012-02-20 10:46       ` Albert ARIBAUD
2012-02-20 12:48         ` [U-Boot] [PATCH] AT91SAM9*: " Alexandre Belloni
2012-02-20 13:00           ` Albert ARIBAUD
2012-02-20 16:40             ` [U-Boot] [PATCH v3] " Alexandre Belloni
2012-02-27 15:25               ` Ulf Samuelsson [this message]
2012-02-28 22:57                 ` Alexandre Belloni
2012-02-29  0:50                   ` Ulf Samuelsson
2012-02-29  8:58                     ` Alexandre Belloni
2012-02-29  9:49                       ` Ulf Samuelsson
2012-04-08 18:17                         ` [U-Boot] [PATCH v4] " Alexandre Belloni
2012-04-08 20:06                           ` Wolfgang Denk
2012-04-09  6:36                             ` Andreas Bießmann
2012-04-09  8:15                               ` Wolfgang Denk
2012-04-17 23:26                                 ` Ulf Samuelsson
2012-04-21 21:19                                   ` Alexandre Belloni
2012-02-20 12:51         ` [U-Boot] [PATCH v2] " Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F4BA04E.7050200@emagii.com \
    --to=u-boot@emagii.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox