Skip to contentSkip to conversation

arm: am57xx/dra7xx: Improve eMMC Linux boot

PATCH New Sam Protsenko 2 participants 15 messages Sep 21, 2017 – Sep 29, 2017

lore
Share & tools
lore
#0 lore raw

cover arm: am57xx/dra7xx: Improve eMMC Linux boot

This patch series makes it possible to actually run Linux from eMMC. While at it, some small style improvements were done as well.

Sam Protsenko (4):
arm: am57xx: Fix Linux boot from eMMC
arm: dra7xx: Fix Linux boot from eMMC
env: ti: boot: Extract command for eMMC Linux boot
env: ti: boot: Show boot status information

 include/configs/am57xx_evm.h  |  3 ++-
 include/configs/dra7xx_evm.h  |  3 ++-
 include/environment/ti/boot.h | 13 ++++++++-----
 3 files changed, 12 insertions(+), 7 deletions(-)
Signature · 1 line
2.14.1
#1 lore raw

PATCH 1/4 arm: am57xx: Fix Linux boot from eMMC

Right now on OMAP5-based boards we have only one partition defined for Linux boot, which is rootfs. That doesn't work with bootpart=1:2 (that is defined in include/environment/ti/boot.h). To fix Linux boot we may either:

1. Change bootpart to be 1:1
2. Or add preceding partition, so that rootfs is actually 1:2

Second choice seems more reasonable, as DFU is already using similar partition table and can rely on bootpart to be 1:2.

This patch adds "bootloader" partition. So now eMMC layout for Linux boot looks like this:

offset content size partition
(KiB) (KiB)
=======================================================================

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 (redundant) |   128           -
2688    +--------------------------------+
        | rootfs                         |   remaining     rootfs
end     +--------------------------------+

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

Guard hole appears because U-Boot environment offset was calculated for Android partition table, which has two additional partitions in place of that hole ("environment" and "misc" partitions).

This patch also changes rootfs offset from 2 MiB further to 2688 KiB, so that there won't be any collisions with U-Boot environment when we flash rootfs.

---
 include/configs/am57xx_evm.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/configs/am57xx_evm.h +2 -1
index 0c70c53050..bf555ccdc2 100644
@@ -44,7 +44,8 @@
 #define PARTS_DEFAULT \
 	/* Linux 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" \
 	/* Android partitions */ \
 	"partitions_android=" \
 	"uuid_disk=${uuid_gpt_disk};" \
Signature · 1 line
2.14.1
#2 lore raw

PATCH 1/4 arm: am57xx: Fix Linux boot from eMMC

Quoted 40 lines · Sam Protsenko

Right now on OMAP5-based boards we have only one partition defined for Linux boot, which is rootfs. That doesn't work with bootpart=1:2 (that is defined in include/environment/ti/boot.h). To fix Linux boot we may either:

1. Change bootpart to be 1:1
2. Or add preceding partition, so that rootfs is actually 1:2

Second choice seems more reasonable, as DFU is already using similar partition table and can rely on bootpart to be 1:2.

This patch adds "bootloader" partition. So now eMMC layout for Linux boot looks like this:

offset content size partition
(KiB) (KiB)
=======================================================================

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 (redundant) |   128           -
2688    +--------------------------------+
        | rootfs                         |   remaining     rootfs
end     +--------------------------------+

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

Guard hole appears because U-Boot environment offset was calculated for Android partition table, which has two additional partitions in place of that hole ("environment" and "misc" partitions).

Quoted 5 lines

This patch also changes rootfs offset from 2 MiB further to 2688 KiB, so that there won't be any collisions with U-Boot environment when we flash rootfs.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170924/2e58a185/attachment.sig>
#3 lore raw

PATCH 1/4 arm: am57xx: Fix Linux boot from eMMC

In reply to Sam Protsenko
Quoted 42 lines · Sam Protsenko

Right now on OMAP5-based boards we have only one partition defined for Linux boot, which is rootfs. That doesn't work with bootpart=1:2 (that is defined in include/environment/ti/boot.h). To fix Linux boot we may either:

1. Change bootpart to be 1:1
2. Or add preceding partition, so that rootfs is actually 1:2

Second choice seems more reasonable, as DFU is already using similar partition table and can rely on bootpart to be 1:2.

This patch adds "bootloader" partition. So now eMMC layout for Linux boot looks like this:

offset content size partition
(KiB) (KiB)

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

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 (redundant) |   128           -
2688    +--------------------------------+
        | rootfs                         |   remaining     rootfs
end     +--------------------------------+

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

Guard hole appears because U-Boot environment offset was calculated for Android partition table, which has two additional partitions in place of that hole ("environment" and "misc" partitions).

Quoted 5 lines

This patch also changes rootfs offset from 2 MiB further to 2688 KiB, so that there won't be any collisions with U-Boot environment when we flash rootfs.

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: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170929/85b79c45/attachment.sig>
#4 lore raw

PATCH 2/4 arm: dra7xx: Fix Linux boot from eMMC

In reply to Sam Protsenko

Right now on OMAP5-based boards we have only one partition defined for Linux boot, which is rootfs. That doesn't work with bootpart=1:2 (that is defined in include/environment/ti/boot.h). To fix Linux boot we may either:

1. Change bootpart to be 1:1
2. Or add preceding partition, so that rootfs is actually 1:2

Second choice seems more reasonable, as DFU is already using similar partition table and can rely on bootpart to be 1:2.

This patch adds "bootloader" partition. So now eMMC layout for Linux boot looks like this:

offset content size partition
(KiB) (KiB)
=======================================================================

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 (redundant) |   128           -
2688    +--------------------------------+
        | rootfs                         |   remaining     rootfs
end     +--------------------------------+

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

Guard hole appears because U-Boot environment offset was calculated for Android partition table, which has two additional partitions in place of that hole ("environment" and "misc" partitions).

This patch also changes rootfs offset from 2 MiB further to 2688 KiB, so that there won't be any collisions with U-Boot environment when we flash rootfs.

---
 include/configs/dra7xx_evm.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/configs/dra7xx_evm.h +2 -1
index 6c0fc35d3a..1555fc1b50 100644
@@ -51,7 +51,8 @@
 #define PARTS_DEFAULT \
 	/* Linux 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" \
 	/* Android partitions */ \
 	"partitions_android=" \
 	"uuid_disk=${uuid_gpt_disk};" \
Signature · 1 line
2.14.1
#5 lore raw

PATCH 2/4 arm: dra7xx: Fix Linux boot from eMMC

Quoted 40 lines · Sam Protsenko

Right now on OMAP5-based boards we have only one partition defined for Linux boot, which is rootfs. That doesn't work with bootpart=1:2 (that is defined in include/environment/ti/boot.h). To fix Linux boot we may either:

1. Change bootpart to be 1:1
2. Or add preceding partition, so that rootfs is actually 1:2

Second choice seems more reasonable, as DFU is already using similar partition table and can rely on bootpart to be 1:2.

This patch adds "bootloader" partition. So now eMMC layout for Linux boot looks like this:

offset content size partition
(KiB) (KiB)
=======================================================================

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 (redundant) |   128           -
2688    +--------------------------------+
        | rootfs                         |   remaining     rootfs
end     +--------------------------------+

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

Guard hole appears because U-Boot environment offset was calculated for Android partition table, which has two additional partitions in place of that hole ("environment" and "misc" partitions).

Quoted 5 lines

This patch also changes rootfs offset from 2 MiB further to 2688 KiB, so that there won't be any collisions with U-Boot environment when we flash rootfs.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170924/747a0994/attachment.sig>
#6 lore raw

PATCH 2/4 arm: dra7xx: Fix Linux boot from eMMC

In reply to Sam Protsenko
Quoted 42 lines · Sam Protsenko

Right now on OMAP5-based boards we have only one partition defined for Linux boot, which is rootfs. That doesn't work with bootpart=1:2 (that is defined in include/environment/ti/boot.h). To fix Linux boot we may either:

1. Change bootpart to be 1:1
2. Or add preceding partition, so that rootfs is actually 1:2

Second choice seems more reasonable, as DFU is already using similar partition table and can rely on bootpart to be 1:2.

This patch adds "bootloader" partition. So now eMMC layout for Linux boot looks like this:

offset content size partition
(KiB) (KiB)

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

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 (redundant) |   128           -
2688    +--------------------------------+
        | rootfs                         |   remaining     rootfs
end     +--------------------------------+

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

Guard hole appears because U-Boot environment offset was calculated for Android partition table, which has two additional partitions in place of that hole ("environment" and "misc" partitions).

Quoted 5 lines

This patch also changes rootfs offset from 2 MiB further to 2688 KiB, so that there won't be any collisions with U-Boot environment when we flash rootfs.

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: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170929/7627e1c3/attachment.sig>
#7 lore raw

PATCH 3/4 env: ti: boot: Extract command for eMMC Linux boot

In reply to Sam Protsenko

Extract commands for booting Linux from eMMC to separate command. It seems more logical that way, and allows us to run the whole command set from U-Boot shell with only one command.

---
 include/environment/ti/boot.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
include/environment/ti/boot.h +6 -4
index 5b1b97bafe..2306d3cdf0 100644
@@ -29,6 +29,11 @@
 	"partitions=" PARTS_DEFAULT "\0" \
 	"optargs=\0" \
 	"dofastboot=0\0" \
+	"emmc_linux_boot=" \
+		"setenv mmcdev 1; " \
+		"setenv bootpart 1:2; " \
+		"setenv mmcroot /dev/mmcblk0p2 rw; " \
+		"run mmcboot;\0" \
 	"emmc_android_boot=" \
 		"setenv eval_bootargs setenv bootargs $bootargs; " \
 		"run eval_bootargs; " \
@@ -93,10 +98,7 @@
 	"run findfdt; " \
 	"run envboot; " \
 	"run mmcboot;" \
-	"setenv mmcdev 1; " \
-	"setenv bootpart 1:2; " \
-	"setenv mmcroot /dev/mmcblk0p2 rw; " \
-	"run mmcboot;" \
+	"run emmc_linux_boot; " \
 	"run emmc_android_boot; " \
 	""
 
Signature · 1 line
2.14.1
#8 lore raw

PATCH 3/4 env: ti: boot: Extract command for eMMC Linux boot

Quoted 5 lines · Sam Protsenko

Extract commands for booting Linux from eMMC to separate command. It seems more logical that way, and allows us to run the whole command set from U-Boot shell with only one command.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170924/e04e8ac9/attachment.sig>
#9 lore raw

PATCH 3/4 env: ti: boot: Extract command for eMMC Linux boot

In reply to Sam Protsenko
Quoted 6 lines · Sam Protsenko

Extract commands for booting Linux from eMMC to separate command. It seems more logical that way, and allows us to run the whole command set from U-Boot shell with only one command.

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: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170929/52231c4c/attachment.sig>
#10 lore raw

PATCH 4/4 env: ti: boot: Show boot status information

In reply to Sam Protsenko

Add tracing printings to Linux/Android boot commands, so that we can see what's going on. Helps to trace possible bugs on early stages and improves the output for user (which is especially useful, because we have a bunch of boot commands executing one by one).

---
 include/environment/ti/boot.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/environment/ti/boot.h +2 -1
index 2306d3cdf0..799d9840aa 100644
@@ -30,11 +30,13 @@
 	"optargs=\0" \
 	"dofastboot=0\0" \
 	"emmc_linux_boot=" \
+		"echo Trying to boot Linux from eMMC ...; " \
 		"setenv mmcdev 1; " \
 		"setenv bootpart 1:2; " \
 		"setenv mmcroot /dev/mmcblk0p2 rw; " \
 		"run mmcboot;\0" \
 	"emmc_android_boot=" \
+		"echo Trying to boot Android from eMMC ...; " \
 		"setenv eval_bootargs setenv bootargs $bootargs; " \
 		"run eval_bootargs; " \
 		"setenv mmcdev 1; " \
@@ -49,7 +51,6 @@
 		"part size mmc ${mmcdev} ${boot_part} boot_size; " \
 		"mmc read ${fdtaddr} ${fdt_start} ${fdt_size}; " \
 		"mmc read ${loadaddr} ${boot_start} ${boot_size}; " \
-		"echo Booting from eMMC ...; " \
 		"bootm $loadaddr $loadaddr $fdtaddr;\0"
 
 #ifdef CONFIG_OMAP54XX
Signature · 1 line
2.14.1
#11 lore raw

PATCH 4/4 env: ti: boot: Show boot status information

Quoted 6 lines · Sam Protsenko

Add tracing printings to Linux/Android boot commands, so that we can see what's going on. Helps to trace possible bugs on early stages and improves the output for user (which is especially useful, because we have a bunch of boot commands executing one by one).

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170924/ef762a49/attachment.sig>
#12 lore raw

PATCH 4/4 env: ti: boot: Show boot status information

In reply to Sam Protsenko
Quoted 7 lines · Sam Protsenko

Add tracing printings to Linux/Android boot commands, so that we can see what's going on. Helps to trace possible bugs on early stages and improves the output for user (which is especially useful, because we have a bunch of boot commands executing one by one).

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: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170929/f6e37e3b/attachment.sig>
#13 lore raw

cover arm: am57xx/dra7xx: Improve eMMC Linux boot

In reply to Sam Protsenko
Quoted 9 lines · Sam Protsenko

This patch series makes it possible to actually run Linux from eMMC. While at it, some small style improvements were done as well.

Sam Protsenko (4):
arm: am57xx: Fix Linux boot from eMMC
arm: dra7xx: Fix Linux boot from eMMC
env: ti: boot: Extract command for eMMC Linux boot
env: ti: boot: Show boot status information

Quoted 8 lines
 include/configs/am57xx_evm.h  |  3 ++-
 include/configs/dra7xx_evm.h  |  3 ++-
 include/environment/ti/boot.h | 13 ++++++++-----
 3 files changed, 12 insertions(+), 7 deletions(-)

--
2.14.1

Please do not merge it yet. I just noticed I started to see this message:

** First descriptor is NOT a primary desc on 1:1 **

which is probably related to incorrect format of new partition table. I will provide update shortly here, or just send v2.

#14 lore raw

cover arm: am57xx/dra7xx: Improve eMMC Linux boot

Quoted 19 lines · Sam Protsenko
Quoted 9 lines · Sam Protsenko

This patch series makes it possible to actually run Linux from eMMC. While at it, some small style improvements were done as well.

Sam Protsenko (4):
arm: am57xx: Fix Linux boot from eMMC
arm: dra7xx: Fix Linux boot from eMMC
env: ti: boot: Extract command for eMMC Linux boot
env: ti: boot: Show boot status information

Quoted 8 lines
 include/configs/am57xx_evm.h  |  3 ++-
 include/configs/dra7xx_evm.h  |  3 ++-
 include/environment/ti/boot.h | 13 ++++++++-----
 3 files changed, 12 insertions(+), 7 deletions(-)

--
2.14.1

Quoted 6 lines

Please do not merge it yet. I just noticed I started to see this message:

** First descriptor is NOT a primary desc on 1:1 **

which is probably related to incorrect format of new partition table. I will provide update shortly here, or just send v2.

Everything is ok, mentioned warning is not related to partition table and it's harmless. Please review this series as usual. I will try to fix mentioned warning in another patch.