Skip to contentSkip to conversation

cubieboard2: Accommodate U-Boot environment on SD-card

PATCH New Alexey Brodkin 2 participants 2 messages Jul 1, 2016 – Jul 2, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cubieboard2: Accommodate U-Boot environment on SD-card

According to current "include/configs/sunxi-common.h" U-Boot environment is stored on SD-card with offset 544 kB and its size is limited as 128 kB.

Given memory layout of sunxi boards:
1. SPL
2. U-Boot
3. U-Boot environment
4. Partitions
we need to make sure the first real partition starts at least with 544+128 kB offset. Adding a small safety gap let's put the first partition with offset 1Mb from the beginning of SD-card.

Otherwise current setup gets broken as soon as one saves U-Boot environment with "saveenv" which basically overwrites FAT partition with zImage and board no longer boots into Linux kernel.

Cc Erico Nunes <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc Peter Korsgaard <[email protected]>
Cc Carlos Quijano <[email protected]>
Cc Andi Shyti <[email protected]>
---
 board/cubietech/cubieboard2/genimage.cfg | 1 +
 1 file changed, 1 insertion(+)
board/cubietech/cubieboard2/genimage.cfg +1 -0
index 8929a72..cde78e1 100644
@@ -26,6 +26,7 @@ image sdcard.img {
 		partition-type = 0xC
 		bootable = "true"
 		image = "boot.vfat"
+		offset = 1048576
 	}
 
 	partition rootfs {
Signature · 1 line
2.5.5
#1 lore raw

PATCH 1/1 cubieboard2: Accommodate U-Boot environment on SD-card

Quoted 34 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Alexey" == Alexey Brodkin <[email protected]> writes:

According to current "include/configs/sunxi-common.h" U-Boot environment is stored on SD-card with offset 544 kB and its size is limited as 128 kB.

Given memory layout of sunxi boards:
1. SPL
2. U-Boot
3. U-Boot environment
4. Partitions
we need to make sure the first real partition starts at least with 544+128 kB offset. Adding a small safety gap let's put the first partition with offset 1Mb from the beginning of SD-card.

Otherwise current setup gets broken as soon as one saves U-Boot environment with "saveenv" which basically overwrites FAT partition with zImage and board no longer boots into Linux kernel.

Cc Erico Nunes <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc Peter Korsgaard <[email protected]>
Cc Carlos Quijano <[email protected]>
Cc Andi Shyti <[email protected]>
---
 board/cubietech/cubieboard2/genimage.cfg | 1 +
 1 file changed, 1 insertion(+)
board/cubietech/cubieboard2/genimage.cfg +0 -0
index 8929a72..cde78e1 100644

board/cubietech/cubieboard2/genimage.cfg image sdcard.img { · line 29

Quoted 4 lines
board/cubietech/cubieboard2/genimage.cfg +1 -0
@@ -26,6 +26,7 @@ image sdcard.img {
 		partition-type = 0xC
 		bootable = "true"
 		image = "boot.vfat"
+		offset = 1048576

Thanks. I prefer to add the padding to the u-boot "partition", as that is logically where it belongs, so I've instead set the size of that one to 1MB - 8K, and committed - Thanks.

We need to do the same for the other sunxi boards as well. I'll do so now.

Signature · 2 lines
Venlig hilsen,
Peter Korsgaard