All of lore.kernel.org
 help / color / mirror / Atom feed
From: Neil Armstrong <narmstrong@baylibre.com>
To: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Cc: u-boot-amlogic@groups.io, u-boot@lists.denx.de,
	Guillaume La Roque <glaroque@baylibre.com>
Subject: Re: [PATCH 6/9] configs: meson64_android: boot android via abootimg
Date: Thu, 5 Aug 2021 18:21:07 +0200	[thread overview]
Message-ID: <448f032d-787f-0926-92e5-b096cc4f1274@baylibre.com> (raw)
In-Reply-To: <20210805151728.422329-7-mkorpershoek@baylibre.com>

On 05/08/2021 17:17, Mattijs Korpershoek wrote:
> From: Guillaume La Roque <glaroque@baylibre.com>
> 
> Since Android 10, we are required to use a "dtbo" partition which
> includes the various device-tree overlays [1].
> It's also possible to provide a "dtb" partition.
> 
> This is supported via the "abootimg" command.
> 
> On Yukawa, the assumption is that we have only a "dtbo" partition, which
> includes all board dtbs and their dtbos [2]
> 
> [1] https://source.android.com/devices/architecture/dto/partitions
> [2] https://android.googlesource.com/device/amlogic/yukawa/+/refs/heads/master/build/tasks/dtimages.mk#16
> Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
>  include/configs/meson64_android.h | 57 ++++++++++++++++++++++++++++++-
>  1 file changed, 56 insertions(+), 1 deletion(-)
> 
> diff --git a/include/configs/meson64_android.h b/include/configs/meson64_android.h
> index 0ce616c17e..358e0a5c71 100644
> --- a/include/configs/meson64_android.h
> +++ b/include/configs/meson64_android.h
> @@ -81,7 +81,59 @@
>  #define RECOVERY_PARTITION "recovery"
>  #endif
>  
> +#if defined(CONFIG_CMD_ABOOTIMG)
> +/*
> + * Prepares complete device tree blob for current board (for Android boot).
> + *
> + * Boot image or recovery image should be loaded into $loadaddr prior to running
> + * these commands. The logic of these commnads is next:
> + *
> + *   1. Read correct DTB for current SoC/board from boot image in $loadaddr
> + *      to $fdtaddr
> + *   2. Merge all needed DTBO for current board from 'dtbo' partition into read
> + *      DTB
> + *   3. User should provide $fdtaddr as 3rd argument to 'bootm'
> + */
> +#define PREPARE_FDT \
> +	"echo Preparing FDT...; " \
> +	"if test $board_name = sei510; then " \
> +		"echo \"  Reading DTB for sei510...\"; " \
> +		"setenv dtb_index 0;" \
> +	"elif test $board_name = sei610; then " \
> +		"echo \"  Reading DTB for sei610...\"; " \
> +		"setenv dtb_index 1;" \
> +	"else " \
> +		"echo Error: Android boot is not supported for $board_name; " \
> +		"exit; " \
> +	"fi; " \
> +	"abootimg get dtb --index=$dtb_index dtb_start dtb_size; " \
> +	"cp.b $dtb_start $fdt_addr_r $dtb_size; " \
> +	"fdt addr $fdt_addr_r  0x80000; " \
> +	"if test $board_name = sei510; then " \
> +		"echo \"  Reading DTBO for sei510...\"; " \
> +		"setenv dtbo_index 0;" \
> +	"elif test $board_name = sei610; then " \
> +		"echo \"  Reading DTBO for sei610...\"; " \
> +		"setenv dtbo_index 1;" \
> +	"else " \
> +		"echo Error: Android boot is not supported for $board_name; " \
> +		"exit; " \
> +	"fi; " \
> +	"part start mmc ${mmcdev} dtbo${slot_suffix} p_dtbo_start; " \
> +	"part size mmc ${mmcdev} dtbo${slot_suffix} p_dtbo_size; " \
> +	"mmc read ${dtboaddr} ${p_dtbo_start} ${p_dtbo_size}; " \
> +	"echo \"  Applying DTBOs...\"; " \
> +	"adtimg addr $dtboaddr; " \
> +	"adtimg get dt --index=$dtbo_index dtbo0_addr; " \
> +	"fdt apply $dtbo0_addr;" \
> +	"setenv bootargs \"$bootargs androidboot.dtbo_idx=$dtbo_index \";"\
> +
> +#define BOOT_CMD "bootm ${loadaddr} ${loadaddr} ${fdt_addr_r};"
> +
> +#else
> +#define PREPARE_FDT " "
>  #define BOOT_CMD "bootm ${loadaddr};"
> +#endif
>  
>  #define BOOTENV_DEV_FASTBOOT(devtypeu, devtypel, instance) \
>  	"bootcmd_fastboot=" \
> @@ -153,6 +205,7 @@
>  			"part start mmc ${mmcdev} " RECOVERY_PARTITION "${slot_suffix} boot_start;" \
>  			"part size mmc ${mmcdev} " RECOVERY_PARTITION "${slot_suffix} boot_size;" \
>  			"if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
> +				PREPARE_FDT \
>  				"echo Running Android Recovery...;" \
>  				BOOT_CMD \
>  			"fi;" \
> @@ -174,6 +227,7 @@
>  		"part start mmc ${mmcdev} " BOOT_PARTITION "${slot_suffix} boot_start;" \
>  		"part size mmc ${mmcdev} " BOOT_PARTITION "${slot_suffix} boot_size;" \
>  		"if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
> +			PREPARE_FDT \
>  			"setenv bootargs \"${bootargs} " AB_BOOTARGS "\"  ; " \
>  			"echo Running Android...;" \
>  			BOOT_CMD \
> @@ -212,7 +266,8 @@
>  	"stdin=" STDIN_CFG "\0"                                       \
>  	"stdout=" STDOUT_CFG "\0"                                     \
>  	"stderr=" STDOUT_CFG "\0"                                     \
> -	"loadaddr=0x01000000\0"                                       \
> +	"dtboaddr=0x08200000\0"                                       \
> +	"loadaddr=0x01080000\0"                                       \
>  	"fdt_addr_r=0x01000000\0"                                     \
>  	"scriptaddr=0x08000000\0"                                     \
>  	"kernel_addr_r=0x01080000\0"                                  \
> 

Acked-by: Neil Armstrong <narmstrong@baylibre.com>

  reply	other threads:[~2021-08-05 16:22 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-05 15:17 [PATCH 0/9] meson64_android: Android boot flow using abootimg Mattijs Korpershoek
2021-08-05 15:17 ` [PATCH 1/9] configs: meson64: permit redefining SYS_MALLOC_LEN Mattijs Korpershoek
2021-08-05 16:20   ` Neil Armstrong
2021-08-05 17:16     ` Tom Rini
2021-08-06  7:54       ` Neil Armstrong
2021-08-06  9:24         ` Mattijs Korpershoek
2021-08-06 12:47           ` Tom Rini
2021-08-06 12:46         ` Tom Rini
2021-08-05 15:17 ` [PATCH 2/9] configs: meson64_android: increase SYS_MALLOC_LEN to 128M for AVB Mattijs Korpershoek
2021-08-05 16:20   ` Neil Armstrong
2021-08-05 15:17 ` [PATCH 3/9] configs: meson64_android: implement AVB support Mattijs Korpershoek
2021-08-05 16:20   ` Neil Armstrong
2021-08-05 15:17 ` [PATCH 4/9] configs: meson64_android: implement A/B slot support Mattijs Korpershoek
2021-08-05 16:21   ` Neil Armstrong
2021-08-05 15:17 ` [PATCH 5/9] configs: meson64_android: define BOOT_CMD macro Mattijs Korpershoek
2021-08-05 16:21   ` Neil Armstrong
2021-08-05 15:17 ` [PATCH 6/9] configs: meson64_android: boot android via abootimg Mattijs Korpershoek
2021-08-05 16:21   ` Neil Armstrong [this message]
2021-08-05 15:17 ` [PATCH 7/9] configs: sei510/sei610: reformat PARTS_default Mattijs Korpershoek
2021-08-05 16:21   ` Neil Armstrong
2021-08-05 15:17 ` [PATCH 8/9] configs: sei510/sei610: don't use hard-coded gpt uuids Mattijs Korpershoek
2021-08-05 16:21   ` Neil Armstrong
2021-08-05 15:17 ` [PATCH 9/9] configs: sei510/610: android bootflow via abootimg Mattijs Korpershoek
2021-08-05 16:21   ` Neil Armstrong
2021-08-05 17:23 ` [PATCH 0/9] meson64_android: Android boot flow using abootimg Tom Rini
2021-08-06  7:57   ` Neil Armstrong
2021-08-06 15:36     ` Mattijs Korpershoek
2021-08-06 15:56       ` Tom Rini
2021-08-10  8:41         ` Neil Armstrong
2021-08-10  8:47 ` Neil Armstrong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=448f032d-787f-0926-92e5-b096cc4f1274@baylibre.com \
    --to=narmstrong@baylibre.com \
    --cc=glaroque@baylibre.com \
    --cc=mkorpershoek@baylibre.com \
    --cc=u-boot-amlogic@groups.io \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.