Skip to contentSkip to conversation

am335x_evm: Consolidate eMMC partitions with DFU info

PATCH In review Sam Protsenko 3 participants 5 messages Feb 7, 2018 – Feb 15, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 am335x_evm: Consolidate eMMC partitions with DFU info

From DFU_ALT_INFO_EMMC (include/environment/ti/dfu.h) we can see that rootfs will be flashed to second partition on eMMC. But at the moment we have only one partition in $partitions environment variable. Let's add "bootloader" partition prior to "rootfs", so that DFU works correctly. This also fixes eMMC boot, which looks for rootfs on second partition.

"bootloader" partition start corresponds to "u-boot.img.raw" in DFU eMMC info, which is 0x300 sector (384 KiB offset from eMMC start).

rootfs start address can be also found from DFU eMMC info. bootloader-related area is finished at 0x1500 sector (2688 KiB offset from eMMC start). This should be the start address for rootfs in $partitions environment variable.

While at it, fix U-Boot environment address to be the same as for AM57x EVM, so that it doesn't clash with other partitions.

So now eMMC layout looks like this:

    ===============================================================

    0       +------------------------+
            | MBR/GPT header         |   128           -
    128     +------------------------+
            | MLO                    |   256           -
    384     +------------------------+
            | u-boot.img             |   1792          bootloader
    2176    +------------------------+
            | //////// hole //////// |   256           -
    2432    +------------------------+
            | U-Boot environment     |   128           -
    2560    +------------------------+
            | U-Boot environment     |   128           -
            | (redundant)            |
    2688    +------------------------+
            | rootfs                 |   remaining     rootfs
    end     +------------------------+

    ===============================================================

"hole" area can be used further for storing U-Boot environment (like it's done in AM57x EVM config file) or for increasing u-boot.img area (in case u-boot.img size increased, e.g. if new dtbs were added).

This commit conforms with Linux partition table from f6d245b8c56c ("arm: am57xx: Fix Linux boot from eMMC") commit, making things in uniform way.

---
 include/configs/am335x_evm.h | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
include/configs/am335x_evm.h +8 -5
index 31ab503dca..8c2dd2aac8 100644
@@ -17,12 +17,13 @@
 #define __CONFIG_AM335X_EVM_H
 
 #include <configs/ti_am335x_common.h>
+#include <linux/sizes.h>
 
 #ifndef CONFIG_SPL_BUILD
 # define CONFIG_TIMESTAMP
 #endif
 
-#define CONFIG_SYS_BOOTM_LEN		(16 << 20)
+#define CONFIG_SYS_BOOTM_LEN		SZ_16M
 
 #define CONFIG_MACH_TYPE		MACH_TYPE_AM335XEVM
 
@@ -34,7 +35,7 @@
 #define CONFIG_SYS_LDSCRIPT		"board/ti/am335x/u-boot.lds"
 
 /* Always 128 KiB env size */
-#define CONFIG_ENV_SIZE			(128 << 10)
+#define CONFIG_ENV_SIZE			SZ_128K
 
 #ifdef CONFIG_NAND
 #define NANDARGS \
@@ -99,7 +100,9 @@
 	"console=ttyO0,115200n8\0" \
 	"partitions=" \
 		"uuid_disk=${uuid_gpt_disk};" \
-		"name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}\0" \
+		"name=bootloader,start=384K,size=1792K," \
+			"uuid=${uuid_gpt_bootloader};" \
+		"name=rootfs,start=2688K,size=-,uuid=${uuid_gpt_rootfs}\0" \
 	"optargs=\0" \
 	"ramroot=/dev/ram0 rw\0" \
 	"ramrootfstype=ext2\0" \
@@ -280,8 +283,8 @@
 #define CONFIG_ENV_OFFSET_REDUND	(896 << 10) /* 896 KiB in */
 #elif defined(CONFIG_EMMC_BOOT)
 #define CONFIG_SYS_MMC_ENV_DEV		1
-#define CONFIG_SYS_MMC_ENV_PART		2
-#define CONFIG_ENV_OFFSET		0x0
+#define CONFIG_SYS_MMC_ENV_PART		0
+#define CONFIG_ENV_OFFSET		0x260000
 #define CONFIG_ENV_OFFSET_REDUND	(CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
 #define CONFIG_SYS_MMC_MAX_DEVICE	2
Signature · 1 line
2.15.1
#1 lore raw

PATCH 1/1 am335x_evm: Consolidate eMMC partitions with DFU info

Quoted 44 lines · Sam Protsenko

From DFU_ALT_INFO_EMMC (include/environment/ti/dfu.h) we can see that rootfs will be flashed to second partition on eMMC. But at the moment we have only one partition in $partitions environment variable. Let's add "bootloader" partition prior to "rootfs", so that DFU works correctly. This also fixes eMMC boot, which looks for rootfs on second partition.

"bootloader" partition start corresponds to "u-boot.img.raw" in DFU eMMC info, which is 0x300 sector (384 KiB offset from eMMC start).

rootfs start address can be also found from DFU eMMC info. bootloader-related area is finished at 0x1500 sector (2688 KiB offset from eMMC start). This should be the start address for rootfs in $partitions environment variable.

While at it, fix U-Boot environment address to be the same as for AM57x EVM, so that it doesn't clash with other partitions.

So now eMMC layout looks like this:

    ===============================================================

    0       +------------------------+
            | MBR/GPT header         |   128           -
    128     +------------------------+
            | MLO                    |   256           -
    384     +------------------------+
            | u-boot.img             |   1792          bootloader
    2176    +------------------------+
            | //////// hole //////// |   256           -
    2432    +------------------------+
            | U-Boot environment     |   128           -
    2560    +------------------------+
            | U-Boot environment     |   128           -
            | (redundant)            |
    2688    +------------------------+
            | rootfs                 |   remaining     rootfs
    end     +------------------------+

    ===============================================================

"hole" area can be used further for storing U-Boot environment (like it's done in AM57x EVM config file) or for increasing u-boot.img area (in case u-boot.img size increased, e.g. if new dtbs were added).

Quoted 5 lines

This commit conforms with Linux partition table from f6d245b8c56c ("arm: am57xx: Fix Linux boot from eMMC") commit, making things in uniform way.

Thanks and regards,
Lokesh

Quoted 55 lines
---
 include/configs/am335x_evm.h | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
include/configs/am335x_evm.h +8 -5
index 31ab503dca..8c2dd2aac8 100644
@@ -17,12 +17,13 @@
 #define __CONFIG_AM335X_EVM_H
 
 #include <configs/ti_am335x_common.h>
+#include <linux/sizes.h>
 
 #ifndef CONFIG_SPL_BUILD
 # define CONFIG_TIMESTAMP
 #endif
 
-#define CONFIG_SYS_BOOTM_LEN		(16 << 20)
+#define CONFIG_SYS_BOOTM_LEN		SZ_16M
 
 #define CONFIG_MACH_TYPE		MACH_TYPE_AM335XEVM
 
@@ -34,7 +35,7 @@
 #define CONFIG_SYS_LDSCRIPT		"board/ti/am335x/u-boot.lds"
 
 /* Always 128 KiB env size */
-#define CONFIG_ENV_SIZE			(128 << 10)
+#define CONFIG_ENV_SIZE			SZ_128K
 
 #ifdef CONFIG_NAND
 #define NANDARGS \
@@ -99,7 +100,9 @@
 	"console=ttyO0,115200n8\0" \
 	"partitions=" \
 		"uuid_disk=${uuid_gpt_disk};" \
-		"name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}\0" \
+		"name=bootloader,start=384K,size=1792K," \
+			"uuid=${uuid_gpt_bootloader};" \
+		"name=rootfs,start=2688K,size=-,uuid=${uuid_gpt_rootfs}\0" \
 	"optargs=\0" \
 	"ramroot=/dev/ram0 rw\0" \
 	"ramrootfstype=ext2\0" \
@@ -280,8 +283,8 @@
 #define CONFIG_ENV_OFFSET_REDUND	(896 << 10) /* 896 KiB in */
 #elif defined(CONFIG_EMMC_BOOT)
 #define CONFIG_SYS_MMC_ENV_DEV		1
-#define CONFIG_SYS_MMC_ENV_PART		2
-#define CONFIG_ENV_OFFSET		0x0
+#define CONFIG_SYS_MMC_ENV_PART		0
+#define CONFIG_ENV_OFFSET		0x260000
 #define CONFIG_ENV_OFFSET_REDUND	(CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
 #define CONFIG_SYS_MMC_MAX_DEVICE	2
#2 lore raw

PATCH 1/1 am335x_evm: Consolidate eMMC partitions with DFU info

In reply to Sam Protsenko
Quoted 44 lines · Sam Protsenko

From DFU_ALT_INFO_EMMC (include/environment/ti/dfu.h) we can see that rootfs will be flashed to second partition on eMMC. But at the moment we have only one partition in $partitions environment variable. Let's add "bootloader" partition prior to "rootfs", so that DFU works correctly. This also fixes eMMC boot, which looks for rootfs on second partition.

"bootloader" partition start corresponds to "u-boot.img.raw" in DFU eMMC info, which is 0x300 sector (384 KiB offset from eMMC start).

rootfs start address can be also found from DFU eMMC info. bootloader-related area is finished at 0x1500 sector (2688 KiB offset from eMMC start). This should be the start address for rootfs in $partitions environment variable.

While at it, fix U-Boot environment address to be the same as for AM57x EVM, so that it doesn't clash with other partitions.

So now eMMC layout looks like this:

    ===============================================================

    0       +------------------------+
            | MBR/GPT header         |   128           -
    128     +------------------------+
            | MLO                    |   256           -
    384     +------------------------+
            | u-boot.img             |   1792          bootloader
    2176    +------------------------+
            | //////// hole //////// |   256           -
    2432    +------------------------+
            | U-Boot environment     |   128           -
    2560    +------------------------+
            | U-Boot environment     |   128           -
            | (redundant)            |
    2688    +------------------------+
            | rootfs                 |   remaining     rootfs
    end     +------------------------+

    ===============================================================

"hole" area can be used further for storing U-Boot environment (like it's done in AM57x EVM config file) or for increasing u-boot.img area (in case u-boot.img size increased, e.g. if new dtbs were added).

Quoted 5 lines

This commit conforms with Linux partition table from f6d245b8c56c ("arm: am57xx: Fix Linux boot from eMMC") commit, making things in uniform way.

Signature · 1 line
Tom
#3 lore raw

PATCH 1/1 am335x_evm: Consolidate eMMC partitions with DFU info

Quoted 46 lines · Tom Rini
Quoted 44 lines · Sam Protsenko

From DFU_ALT_INFO_EMMC (include/environment/ti/dfu.h) we can see that rootfs will be flashed to second partition on eMMC. But at the moment we have only one partition in $partitions environment variable. Let's add "bootloader" partition prior to "rootfs", so that DFU works correctly. This also fixes eMMC boot, which looks for rootfs on second partition.

"bootloader" partition start corresponds to "u-boot.img.raw" in DFU eMMC info, which is 0x300 sector (384 KiB offset from eMMC start).

rootfs start address can be also found from DFU eMMC info. bootloader-related area is finished at 0x1500 sector (2688 KiB offset from eMMC start). This should be the start address for rootfs in $partitions environment variable.

While at it, fix U-Boot environment address to be the same as for AM57x EVM, so that it doesn't clash with other partitions.

So now eMMC layout looks like this:

    ===============================================================

    0       +------------------------+
            | MBR/GPT header         |   128           -
    128     +------------------------+
            | MLO                    |   256           -
    384     +------------------------+
            | u-boot.img             |   1792          bootloader
    2176    +------------------------+
            | //////// hole //////// |   256           -
    2432    +------------------------+
            | U-Boot environment     |   128           -
    2560    +------------------------+
            | U-Boot environment     |   128           -
            | (redundant)            |
    2688    +------------------------+
            | rootfs                 |   remaining     rootfs
    end     +------------------------+

    ===============================================================

"hole" area can be used further for storing U-Boot environment (like it's done in AM57x EVM config file) or for increasing u-boot.img area (in case u-boot.img size increased, e.g. if new dtbs were added).

Quoted 8 lines
Quoted 5 lines

This commit conforms with Linux partition table from f6d245b8c56c ("arm: am57xx: Fix Linux boot from eMMC") commit, making things in uniform way.

Hi Tom,

If there are no objections against this patch, can you please merge it? We are working on BBB-based course, and I would love to see it in v2018.03, so that students can checkout to that stable tag and have all needed BBB support in upstream.

Thanks!

Quoted 2 lines

--
Tom

#4 lore raw
In reply to Sam Protsenko
Quoted 44 lines · Sam Protsenko
Quoted 1 line

From DFU_ALT_INFO_EMMC (include/environment/ti/dfu.h) we can see that

rootfs will be flashed to second partition on eMMC. But at the moment we have only one partition in $partitions environment variable. Let's add "bootloader" partition prior to "rootfs", so that DFU works correctly. This also fixes eMMC boot, which looks for rootfs on second partition.

"bootloader" partition start corresponds to "u-boot.img.raw" in DFU eMMC info, which is 0x300 sector (384 KiB offset from eMMC start).

rootfs start address can be also found from DFU eMMC info. bootloader-related area is finished at 0x1500 sector (2688 KiB offset from eMMC start). This should be the start address for rootfs in $partitions environment variable.

While at it, fix U-Boot environment address to be the same as for AM57x EVM, so that it doesn't clash with other partitions.

So now eMMC layout looks like this:

    ===============================================================

    0       +------------------------+
            | MBR/GPT header         |   128           -
    128     +------------------------+
            | MLO                    |   256           -
    384     +------------------------+
            | u-boot.img             |   1792          bootloader
    2176    +------------------------+
            | //////// hole //////// |   256           -
    2432    +------------------------+
            | U-Boot environment     |   128           -
    2560    +------------------------+
            | U-Boot environment     |   128           -
            | (redundant)            |
    2688    +------------------------+
            | rootfs                 |   remaining     rootfs
    end     +------------------------+

    ===============================================================

"hole" area can be used further for storing U-Boot environment (like it's done in AM57x EVM config file) or for increasing u-boot.img area (in case u-boot.img size increased, e.g. if new dtbs were added).

Quoted 7 lines

This commit conforms with Linux partition table from f6d245b8c56c ("arm: am57xx: Fix Linux boot from eMMC") commit, making things in uniform way.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180215/0c8edf64/attachment.sig>