All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] env: ti: boot: Fix Android boot on AM57x EVM
@ 2020-02-19 18:27 Sam Protsenko
  2020-02-20 14:33 ` Eugeniu Rosca
  0 siblings, 1 reply; 3+ messages in thread
From: Sam Protsenko @ 2020-02-19 18:27 UTC (permalink / raw)
  To: u-boot

When applying DTBO on top of DTB (with "fdt apply" command) on AM57x EVM
board, there is not enough memory reserved in RAM for DTB blob. Hence,
DTBO can't be merged in DTB. It leads to inability to boot Android with
next error message:

    failed on fdt_overlay_apply(): FDT_ERR_NOSPACE

To overcome that issue let's provide 1 MiB of space to keep DTB and all
merged DTBO blobs. To do so, "length" parameter should be specified for
"fdt addr" command:

    => fdt addr $fdtaddr 0x100000

Also add size variables to 'adtimg' command invocations, to avoid
cluttering the console with DTBO blob sizes.

Signed-off-by: Sam Protsenko <joe.skb7@gmail.com>
---
 include/environment/ti/boot.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/environment/ti/boot.h b/include/environment/ti/boot.h
index 523c8fc4fe..298c972cd0 100644
--- a/include/environment/ti/boot.h
+++ b/include/environment/ti/boot.h
@@ -103,18 +103,18 @@
 		"echo \"  Reading DTB for AM57x EVM RevA3...\"; " \
 		"abootimg get dtb --index=0 dtb_start dtb_size; " \
 		"cp.b $dtb_start $fdtaddr $dtb_size; " \
-		"fdt addr $fdtaddr; " \
+		"fdt addr $fdtaddr 0x100000; " \
 		"echo \"  Applying DTBOs for AM57x EVM RevA3...\"; " \
 		"adtimg addr $dtboaddr; " \
-		"adtimg get dt --index=0 dtbo0_addr; " \
+		"adtimg get dt --index=0 dtbo0_addr dtbo0_size; " \
 		"fdt apply $dtbo0_addr; " \
-		"adtimg get dt --index=1 dtbo1_addr; " \
+		"adtimg get dt --index=1 dtbo1_addr dtbo1_size; " \
 		"fdt apply $dtbo1_addr; " \
 	"elif test $board_name = beagle_x15_revc; then " \
 		"echo \"  Reading DTB for Beagle X15 RevC...\"; " \
 		"abootimg get dtb --index=0 dtb_start dtb_size; " \
 		"cp.b $dtb_start $fdtaddr $dtb_size; " \
-		"fdt addr $fdtaddr; " \
+		"fdt addr $fdtaddr 0x100000; " \
 	"else " \
 		"echo Error: Android boot is not supported for $board_name; " \
 		"exit; " \
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] env: ti: boot: Fix Android boot on AM57x EVM
  2020-02-19 18:27 [PATCH] env: ti: boot: Fix Android boot on AM57x EVM Sam Protsenko
@ 2020-02-20 14:33 ` Eugeniu Rosca
  2020-02-20 20:31   ` Sam Protsenko
  0 siblings, 1 reply; 3+ messages in thread
From: Eugeniu Rosca @ 2020-02-20 14:33 UTC (permalink / raw)
  To: u-boot

Hi Sam,

On Wed, Feb 19, 2020 at 08:27:52PM +0200, Sam Protsenko wrote:
> When applying DTBO on top of DTB (with "fdt apply" command) on AM57x EVM
> board, there is not enough memory reserved in RAM for DTB blob. Hence,
> DTBO can't be merged in DTB. It leads to inability to boot Android with
> next error message:
> 
>     failed on fdt_overlay_apply(): FDT_ERR_NOSPACE
> 
> To overcome that issue let's provide 1 MiB of space to keep DTB and all
> merged DTBO blobs. To do so, "length" parameter should be specified for
> "fdt addr" command:
> 
>     => fdt addr $fdtaddr 0x100000

I am not an everyday user of this platform, hence curious what are the
usual sizes of DTB and DTBO files employed in Android booting?

For comparison, below are the sizes of R-Car3 DTB (Linux v5.6-rc2):

$ du -sh arch/arm64/boot/dts/renesas/r8a779*dtb | sort -n
32K	arch/arm64/boot/dts/renesas/r8a77961-salvator-xs.dtb
32K	arch/arm64/boot/dts/renesas/r8a77980-v3hsk.dtb
44K	arch/arm64/boot/dts/renesas/r8a77990-ebisu.dtb
52K	arch/arm64/boot/dts/renesas/r8a77965-ulcb.dtb
60K	arch/arm64/boot/dts/renesas/r8a77960-ulcb.dtb
60K	arch/arm64/boot/dts/renesas/r8a77965-salvator-x.dtb
60K	arch/arm64/boot/dts/renesas/r8a77965-salvator-xs.dtb
60K	arch/arm64/boot/dts/renesas/r8a77965-ulcb-kf.dtb
64K	arch/arm64/boot/dts/renesas/r8a77960-salvator-x.dtb
64K	arch/arm64/boot/dts/renesas/r8a77960-salvator-xs.dtb
64K	arch/arm64/boot/dts/renesas/r8a77960-ulcb-kf.dtb
68K	arch/arm64/boot/dts/renesas/r8a77950-ulcb.dtb
68K	arch/arm64/boot/dts/renesas/r8a77951-ulcb.dtb
72K	arch/arm64/boot/dts/renesas/r8a77950-salvator-x.dtb
72K	arch/arm64/boot/dts/renesas/r8a77950-ulcb-kf.dtb
72K	arch/arm64/boot/dts/renesas/r8a77951-salvator-x.dtb
72K	arch/arm64/boot/dts/renesas/r8a77951-salvator-xs.dtb
72K	arch/arm64/boot/dts/renesas/r8a77951-ulcb-kf.dtb

FWIW based on the above values, Renesas scripts reserve 512K for DTB.

> 
> Also add size variables to 'adtimg' command invocations, to avoid
> cluttering the console with DTBO blob sizes.

Looks good to me.

> 
> Signed-off-by: Sam Protsenko <joe.skb7@gmail.com>

Reviewed-by: Eugeniu Rosca <rosca.eugeniu@gmail.com>

-- 
Best Regards
Eugeniu Rosca

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] env: ti: boot: Fix Android boot on AM57x EVM
  2020-02-20 14:33 ` Eugeniu Rosca
@ 2020-02-20 20:31   ` Sam Protsenko
  0 siblings, 0 replies; 3+ messages in thread
From: Sam Protsenko @ 2020-02-20 20:31 UTC (permalink / raw)
  To: u-boot

Hi Eugeniu,

On Thu, Feb 20, 2020 at 4:33 PM Eugeniu Rosca <erosca@de.adit-jv.com> wrote:
>
> Hi Sam,
>
> On Wed, Feb 19, 2020 at 08:27:52PM +0200, Sam Protsenko wrote:
> > When applying DTBO on top of DTB (with "fdt apply" command) on AM57x EVM
> > board, there is not enough memory reserved in RAM for DTB blob. Hence,
> > DTBO can't be merged in DTB. It leads to inability to boot Android with
> > next error message:
> >
> >     failed on fdt_overlay_apply(): FDT_ERR_NOSPACE
> >
> > To overcome that issue let's provide 1 MiB of space to keep DTB and all
> > merged DTBO blobs. To do so, "length" parameter should be specified for
> > "fdt addr" command:
> >
> >     => fdt addr $fdtaddr 0x100000
>
> I am not an everyday user of this platform, hence curious what are the
> usual sizes of DTB and DTBO files employed in Android booting?
>

DTB/DTBO files are not big for AM57x EVM, the same order of magnitude
as yours. Actually it makes sense to reduce 1 MiB I used to 512 KiB,
because:

    fdtaddr=0x88000000

and next used address after this:

    rdaddr=0x88080000

so if I make the fdt size = 512 KiB, it gives us exactly the gap
between $fdtaddr and $rdaddr, which is 0x80000.

Thanks for the review! I will send v2 soon.

> For comparison, below are the sizes of R-Car3 DTB (Linux v5.6-rc2):
>
> $ du -sh arch/arm64/boot/dts/renesas/r8a779*dtb | sort -n
> 32K     arch/arm64/boot/dts/renesas/r8a77961-salvator-xs.dtb
> 32K     arch/arm64/boot/dts/renesas/r8a77980-v3hsk.dtb
> 44K     arch/arm64/boot/dts/renesas/r8a77990-ebisu.dtb
> 52K     arch/arm64/boot/dts/renesas/r8a77965-ulcb.dtb
> 60K     arch/arm64/boot/dts/renesas/r8a77960-ulcb.dtb
> 60K     arch/arm64/boot/dts/renesas/r8a77965-salvator-x.dtb
> 60K     arch/arm64/boot/dts/renesas/r8a77965-salvator-xs.dtb
> 60K     arch/arm64/boot/dts/renesas/r8a77965-ulcb-kf.dtb
> 64K     arch/arm64/boot/dts/renesas/r8a77960-salvator-x.dtb
> 64K     arch/arm64/boot/dts/renesas/r8a77960-salvator-xs.dtb
> 64K     arch/arm64/boot/dts/renesas/r8a77960-ulcb-kf.dtb
> 68K     arch/arm64/boot/dts/renesas/r8a77950-ulcb.dtb
> 68K     arch/arm64/boot/dts/renesas/r8a77951-ulcb.dtb
> 72K     arch/arm64/boot/dts/renesas/r8a77950-salvator-x.dtb
> 72K     arch/arm64/boot/dts/renesas/r8a77950-ulcb-kf.dtb
> 72K     arch/arm64/boot/dts/renesas/r8a77951-salvator-x.dtb
> 72K     arch/arm64/boot/dts/renesas/r8a77951-salvator-xs.dtb
> 72K     arch/arm64/boot/dts/renesas/r8a77951-ulcb-kf.dtb
>
> FWIW based on the above values, Renesas scripts reserve 512K for DTB.
>
> >
> > Also add size variables to 'adtimg' command invocations, to avoid
> > cluttering the console with DTBO blob sizes.
>
> Looks good to me.
>
> >
> > Signed-off-by: Sam Protsenko <joe.skb7@gmail.com>
>
> Reviewed-by: Eugeniu Rosca <rosca.eugeniu@gmail.com>
>
> --
> Best Regards
> Eugeniu Rosca

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-20 20:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-19 18:27 [PATCH] env: ti: boot: Fix Android boot on AM57x EVM Sam Protsenko
2020-02-20 14:33 ` Eugeniu Rosca
2020-02-20 20:31   ` Sam Protsenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.