[U-Boot] [PATCH 0/4] 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(-)

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.
Signed-off-by: Sam Protsenko semen.protsenko@linaro.org --- include/configs/am57xx_evm.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h index 0c70c53050..bf555ccdc2 100644 --- a/include/configs/am57xx_evm.h +++ b/include/configs/am57xx_evm.h @@ -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};" \

On Thu, Sep 21, 2017 at 10:37:56PM +0300, Sam Protsenko wrote:
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:
- Change bootpart to be 1:1
- 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.
Signed-off-by: Sam Protsenko semen.protsenko@linaro.org
Reviewed-by: Tom Rini trini@konsulko.com

On Thu, Sep 21, 2017 at 10:37:56PM +0300, Sam Protsenko wrote:
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:
- Change bootpart to be 1:1
- 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) Reviewed-by: Tom Rini trini@konsulko.com
=======================================================================
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.
Signed-off-by: Sam Protsenko semen.protsenko@linaro.org
Applied to u-boot/master, thanks!

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.
Signed-off-by: Sam Protsenko semen.protsenko@linaro.org --- include/configs/dra7xx_evm.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/configs/dra7xx_evm.h b/include/configs/dra7xx_evm.h index 6c0fc35d3a..1555fc1b50 100644 --- a/include/configs/dra7xx_evm.h +++ b/include/configs/dra7xx_evm.h @@ -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};" \

On Thu, Sep 21, 2017 at 10:37:57PM +0300, Sam Protsenko wrote:
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:
- Change bootpart to be 1:1
- 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.
Signed-off-by: Sam Protsenko semen.protsenko@linaro.org
Reviewed-by: Tom Rini trini@konsulko.com

On Thu, Sep 21, 2017 at 10:37:57PM +0300, Sam Protsenko wrote:
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:
- Change bootpart to be 1:1
- 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) Reviewed-by: Tom Rini trini@konsulko.com
=======================================================================
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.
Signed-off-by: Sam Protsenko semen.protsenko@linaro.org
Applied to u-boot/master, thanks!

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.
Signed-off-by: Sam Protsenko semen.protsenko@linaro.org --- include/environment/ti/boot.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/include/environment/ti/boot.h b/include/environment/ti/boot.h index 5b1b97bafe..2306d3cdf0 100644 --- a/include/environment/ti/boot.h +++ b/include/environment/ti/boot.h @@ -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; " \ ""

On Thu, Sep 21, 2017 at 10:37:58PM +0300, Sam Protsenko wrote:
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.
Signed-off-by: Sam Protsenko semen.protsenko@linaro.org
Reviewed-by: Tom Rini trini@konsulko.com

On Thu, Sep 21, 2017 at 10:37:58PM +0300, Sam Protsenko wrote:
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.
Signed-off-by: Sam Protsenko semen.protsenko@linaro.org Reviewed-by: Tom Rini trini@konsulko.com
Applied to u-boot/master, thanks!

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).
Signed-off-by: Sam Protsenko semen.protsenko@linaro.org --- include/environment/ti/boot.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/environment/ti/boot.h b/include/environment/ti/boot.h index 2306d3cdf0..799d9840aa 100644 --- a/include/environment/ti/boot.h +++ b/include/environment/ti/boot.h @@ -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

On Thu, Sep 21, 2017 at 10:37:59PM +0300, Sam Protsenko wrote:
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).
Signed-off-by: Sam Protsenko semen.protsenko@linaro.org
Reviewed-by: Tom Rini trini@konsulko.com

On Thu, Sep 21, 2017 at 10:37:59PM +0300, Sam Protsenko wrote:
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).
Signed-off-by: Sam Protsenko semen.protsenko@linaro.org Reviewed-by: Tom Rini trini@konsulko.com
Applied to u-boot/master, thanks!

On 21 September 2017 at 22:37, Sam Protsenko semen.protsenko@linaro.org wrote:
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(-)
-- 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.

On 21 September 2017 at 23:41, Sam Protsenko semen.protsenko@linaro.org wrote:
On 21 September 2017 at 22:37, Sam Protsenko semen.protsenko@linaro.org wrote:
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(-)
-- 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.
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.
participants (2)
-
Sam Protsenko
-
Tom Rini