Skip to contentSkip to conversation

Change kernel address in dataflash to match u-boot's size

PATCH New Alexandre Belloni 2 participants 3 messages Jan 2, 2012 Arm/Microchip (AT91) SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Change kernel address in dataflash to match u-boot's size

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. Loading the kernel from 0x44000 will make the process easier for users using the default configuration but they'll have to remember to flash the kernel at 0x44000.

---
 include/configs/at91sam9260ek.h |    4 ++--
 include/configs/at91sam9261ek.h |    4 ++--
 include/configs/at91sam9263ek.h |    2 +-
 include/configs/at91sam9rlek.h  |    2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
include/configs/at91sam9260ek.h +2 -2
index db52ee6..7f99975 100644
@@ -188,7 +188,7 @@
 #define CONFIG_ENV_OFFSET		0x4200
 #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_BOOTCOMMAND	"cp.b 0xC0044000 0x22000000 0x210000; bootm"
 #define CONFIG_BOOTARGS		"console=ttyS0,115200 "			\
 				"root=/dev/mtdblock0 "			\
 				"mtdparts=atmel_nand:-(root) "		\
@@ -202,7 +202,7 @@
 #define CONFIG_ENV_OFFSET		0x4200
 #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_BOOTCOMMAND	"cp.b 0xD0044000 0x22000000 0x210000; bootm"
 #define CONFIG_BOOTARGS		"console=ttyS0,115200 "			\
 				"root=/dev/mtdblock0 "			\
 				"mtdparts=atmel_nand:-(root) "		\
include/configs/at91sam9261ek.h +2 -2
index 5140b26..1aa6373 100644
@@ -190,7 +190,7 @@
 #define CONFIG_ENV_OFFSET	0x4200
 #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_BOOTCOMMAND	"cp.b 0xC0044000 0x22000000 0x210000; bootm"
 #define CONFIG_BOOTARGS		"console=ttyS0,115200 "			\
 				"root=/dev/mtdblock0 "			\
 				"mtdparts=atmel_nand:-(root) "		\
@@ -204,7 +204,7 @@
 #define CONFIG_ENV_OFFSET	0x4200
 #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_BOOTCOMMAND	"cp.b 0xD0044000 0x22000000 0x210000; bootm"
 #define CONFIG_BOOTARGS		"console=ttyS0,115200 "			\
 				"root=/dev/mtdblock0 "			\
 				"mtdparts=atmel_nand:-(root) "		\
include/configs/at91sam9263ek.h +1 -1
index 8399246..658ae73 100644
@@ -317,7 +317,7 @@
 #define CONFIG_ENV_OFFSET		0x4200
 #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_BOOTCOMMAND	"cp.b 0xC0044000 0x22000000 0x210000; bootm"
 #define CONFIG_BOOTARGS		"console=ttyS0,115200 " \
 				"root=/dev/mtdblock0 " \
 				"mtdparts=atmel_nand:-(root) "\
include/configs/at91sam9rlek.h +1 -1
index 79ea1f2..dc6e007 100644
@@ -156,7 +156,7 @@
 #define CONFIG_ENV_OFFSET		0x4200
 #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_BOOTCOMMAND	"cp.b 0xC0044000 0x22000000 0x210000; bootm"
 #define CONFIG_BOOTARGS		"console=ttyS0,115200 " \
 				"root=/dev/mtdblock0 " \
 				"mtdparts=atmel_nand:-(root) "\
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/1 Change kernel address in dataflash to match u-boot's size

Quoted 11 lines

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. Loading the kernel from 0x44000 will make the process easier for users using the default configuration but they'll have to remember to flash the kernel at 0x44000.

You're just pushing it slowly further. That's bogus:
1) ubootenv is at weird offset ... why such a weird number? Also, what about redund. env?
2) u-boot itself is at weird offset ... just set it to some normal location and let it be eg. up to 512kb big, to make sure you don't need to change it in the future.
3) Why is env at offset 0x4200 ... is the bootstrap exactly so big ? what about erasing nor, you can't make sure you won't overwrite those 0x200 bytes safely too, right ?

=> I'd do the layout like this:
0x00000 - bootstrap
0x05000 - u-boot (align to block size) 0x85000 - env (~16kb)
0x89000 - env redund
< note, here's some space, so align as necessary > 0x90000 - kernel

It wastes a bit, but it's ready for future growth

M

Quoted 17 lines
---
 include/configs/at91sam9260ek.h |    4 ++--
 include/configs/at91sam9261ek.h |    4 ++--
 include/configs/at91sam9263ek.h |    2 +-
 include/configs/at91sam9rlek.h  |    2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
(quoted diff) +0 -0

b/include/configs/at91sam9260ek.h index db52ee6..7f99975 100644

include/configs/at91sam9260ek.h +0 -0
@@ -188,7 +188,7 @@
 #define CONFIG_ENV_OFFSET		0x4200
 #define CONFIG_ENV_ADDR		(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 +

CONFIG_ENV_OFFSET) #define CONFIG_ENV_SIZE 0x4200

include/configs/at91sam9260ek.h

Quoted 3 lines
include/configs/at91sam9260ek.h +1 -1
-#define CONFIG_BOOTCOMMAND	"cp.b 0xC0042000 0x22000000 0x210000; bootm"
+#define CONFIG_BOOTCOMMAND	"cp.b 0xC0044000 0x22000000 0x210000; bootm"
 #define CONFIG_BOOTARGS		"console=ttyS0,115200 "			

\

include/configs/at91sam9260ek.h

Quoted 9 lines
include/configs/at91sam9260ek.h +0 -0
 				"root=/dev/mtdblock0 "			\
 				"mtdparts=atmel_nand:-(root) "		\
@@ -202,7 +202,7 @@
 #define CONFIG_ENV_OFFSET		0x4200
 #define CONFIG_ENV_ADDR		(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS1 +

CONFIG_ENV_OFFSET) #define CONFIG_ENV_SIZE 0x4200

include/configs/at91sam9260ek.h +1 -1
-#define CONFIG_BOOTCOMMAND	"cp.b 0xD0042000 0x22000000 0x210000; bootm"
+#define CONFIG_BOOTCOMMAND	"cp.b 0xD0044000 0x22000000 0x210000; bootm"
 #define CONFIG_BOOTARGS		"console=ttyS0,115200 "			

\

include/configs/at91sam9261ek.h

Quoted 13 lines
include/configs/at91sam9260ek.h +0 -0
 				"root=/dev/mtdblock0 "			\
 				"mtdparts=atmel_nand:-(root) "		\
(quoted diff) +0 -0

b/include/configs/at91sam9261ek.h index 5140b26..1aa6373 100644

include/configs/at91sam9261ek.h +0 -0
@@ -190,7 +190,7 @@
 #define CONFIG_ENV_OFFSET	0x4200
 #define CONFIG_ENV_ADDR		(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 +

CONFIG_ENV_OFFSET) #define CONFIG_ENV_SIZE 0x4200

include/configs/at91sam9261ek.h +1 -1
-#define CONFIG_BOOTCOMMAND	"cp.b 0xC0042000 0x22000000 0x210000; bootm"
+#define CONFIG_BOOTCOMMAND	"cp.b 0xC0044000 0x22000000 0x210000; bootm"
 #define CONFIG_BOOTARGS		"console=ttyS0,115200 "			

\

include/configs/at91sam9261ek.h

Quoted 9 lines
include/configs/at91sam9261ek.h +0 -0
 				"root=/dev/mtdblock0 "			\
 				"mtdparts=atmel_nand:-(root) "		\
@@ -204,7 +204,7 @@
 #define CONFIG_ENV_OFFSET	0x4200
 #define CONFIG_ENV_ADDR		(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS3 +

CONFIG_ENV_OFFSET) #define CONFIG_ENV_SIZE 0x4200

include/configs/at91sam9261ek.h +1 -1
-#define CONFIG_BOOTCOMMAND	"cp.b 0xD0042000 0x22000000 0x210000; bootm"
+#define CONFIG_BOOTCOMMAND	"cp.b 0xD0044000 0x22000000 0x210000; bootm"
 #define CONFIG_BOOTARGS		"console=ttyS0,115200 "			

\

Quoted 28 lines
include/configs/at91sam9261ek.h +0 -0
 				"root=/dev/mtdblock0 "			\
 				"mtdparts=atmel_nand:-(root) "		\
(quoted diff) +0 -0

b/include/configs/at91sam9263ek.h index 8399246..658ae73 100644

include/configs/at91sam9263ek.h +0 -0
@@ -317,7 +317,7 @@
 #define CONFIG_ENV_OFFSET		0x4200
 #define CONFIG_ENV_ADDR		(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 +

CONFIG_ENV_OFFSET) #define CONFIG_ENV_SIZE 0x4200

include/configs/at91sam9263ek.h +1 -1
-#define CONFIG_BOOTCOMMAND	"cp.b 0xC0042000 0x22000000 0x210000; bootm"
+#define CONFIG_BOOTCOMMAND	"cp.b 0xC0044000 0x22000000 0x210000; bootm"
 #define CONFIG_BOOTARGS		"console=ttyS0,115200 " \
 				"root=/dev/mtdblock0 " \
 				"mtdparts=atmel_nand:-(root) "\
(quoted diff) +0 -0

b/include/configs/at91sam9rlek.h index 79ea1f2..dc6e007 100644

include/configs/at91sam9rlek.h +0 -0
@@ -156,7 +156,7 @@
 #define CONFIG_ENV_OFFSET		0x4200
 #define CONFIG_ENV_ADDR		(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 +

CONFIG_ENV_OFFSET) #define CONFIG_ENV_SIZE 0x4200

include/configs/at91sam9rlek.h +1 -1
-#define CONFIG_BOOTCOMMAND	"cp.b 0xC0042000 0x22000000 0x210000; bootm"
+#define CONFIG_BOOTCOMMAND	"cp.b 0xC0044000 0x22000000 0x210000; bootm"
 #define CONFIG_BOOTARGS		"console=ttyS0,115200 " \
 				"root=/dev/mtdblock0 " \
 				"mtdparts=atmel_nand:-(root) "\
#2 lore raw

PATCH 1/1 Change kernel address in dataflash to match u-boot's size

Quoted 7 lines · Marek Vasut
Quoted 7 lines

On at91sam platforms, u-boot grew larger than the allocated size in dataflash, the layout was:

bootstrap  0x00000000
ubootenv   0x00004200
uboot      0x00008400
kernel     0x00042000
Quoted 8 lines
Quoted 4 lines

u-boot with the defconfig doesn't seem to fit in 0x42000 - 0x8400 = 0x39C00 bytes anymore. Loading the kernel from 0x44000 will make the process easier for users using the default configuration but they'll have to remember to flash the kernel at 0x44000.

You're just pushing it slowly further. That's bogus:
1) ubootenv is at weird offset ... why such a weird number? Also, what about redund. env?

It is atmel's defaults they seem to do some magic with the environment when flashing. I don't think this is necessary and don't have any issue changing that.

Quoted 3 lines

2) u-boot itself is at weird offset ... just set it to some normal location and let it be eg. up to 512kb big, to make sure you don't need to change it in the future.

That makes sense, I though about it but I'm not so sure about the available space in dataflash on all the at91sam evaluation kits.

Quoted 12 lines

3) Why is env at offset 0x4200 ... is the bootstrap exactly so big ? what about erasing nor, you can't make sure you won't overwrite those 0x200 bytes safely too, right ?

=> I'd do the layout like this:
0x00000 - bootstrap
0x05000 - u-boot (align to block size) 0x85000 - env (~16kb)
0x89000 - env redund
< note, here's some space, so align as necessary > 0x90000 - kernel

Quoted 2 lines

It wastes a bit, but it's ready for future growth

As said, I let the defaults from ATMEL as they were. I don't know if they had any specific reason to have the layout like that. Maybe they had issue with the available space on the dataflash.

The bootstrap is around 4k. I'll try a new layout and come back with a proposal. I'll also check that it fits in most dataflash sizes.

Signature · 1 line
Alexandre Belloni