All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/9] meson64_android: Android boot flow using abootimg
@ 2021-08-05 15:17 Mattijs Korpershoek
  2021-08-05 15:17 ` [PATCH 1/9] configs: meson64: permit redefining SYS_MALLOC_LEN Mattijs Korpershoek
                   ` (10 more replies)
  0 siblings, 11 replies; 30+ messages in thread
From: Mattijs Korpershoek @ 2021-08-05 15:17 UTC (permalink / raw)
  To: Neil Armstrong; +Cc: u-boot-amlogic, u-boot, Mattijs Korpershoek

The SEI-610 and SEI-510 boards are well supported in the
Android Open Source project via the yukawa [1] platform.

Their U-Boot version, despite being public [2] is not in mainline.

Android 10 and higher have significantly reworked the bootloader
requirements:

* bootloader should pass slot information in case of A/B
* bootloader should perform AVB verification in case it's supported
* bootloader should read and apply dtb overlays from a dtbo partition

These series add support for all the above.

[1] https://android.googlesource.com/device/amlogic/yukawa
[2] https://gitlab.com/baylibre/amlogic/atv/u-boot/-/tree/u-boot/v2021.07/integ

Guillaume La Roque (2):
  configs: meson64_android: boot android via abootimg
  configs: sei510/610: android bootflow via abootimg

Mattijs Korpershoek (7):
  configs: meson64: permit redefining SYS_MALLOC_LEN
  configs: meson64_android: increase SYS_MALLOC_LEN to 128M for AVB
  configs: meson64_android: implement AVB support
  configs: meson64_android: implement A/B slot support
  configs: meson64_android: define BOOT_CMD macro
  configs: sei510/sei610: reformat PARTS_default
  configs: sei510/sei610: don't use hard-coded gpt uuids

 configs/sei510_defconfig          |   5 ++
 configs/sei610_defconfig          |   5 ++
 include/configs/meson64.h         |   2 +
 include/configs/meson64_android.h | 139 ++++++++++++++++++++++++++++--
 include/configs/sei510.h          |  23 +++--
 include/configs/sei610.h          |  23 +++--
 6 files changed, 165 insertions(+), 32 deletions(-)

-- 
2.30.2


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

* [PATCH 1/9] configs: meson64: permit redefining SYS_MALLOC_LEN
  2021-08-05 15:17 [PATCH 0/9] meson64_android: Android boot flow using abootimg Mattijs Korpershoek
@ 2021-08-05 15:17 ` Mattijs Korpershoek
  2021-08-05 16:20   ` Neil Armstrong
  2021-08-05 15:17 ` [PATCH 2/9] configs: meson64_android: increase SYS_MALLOC_LEN to 128M for AVB Mattijs Korpershoek
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 30+ messages in thread
From: Mattijs Korpershoek @ 2021-08-05 15:17 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: u-boot-amlogic, u-boot, Mattijs Korpershoek, Guillaume La Roque

Permit redefining SYS_MALLOC_LEN for board specific configs.
This is especially useful for Android with AVB, which requires a malloc
length of 128M.

Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
 include/configs/meson64.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/meson64.h b/include/configs/meson64.h
index fb7f16d148..f9bb0240d2 100644
--- a/include/configs/meson64.h
+++ b/include/configs/meson64.h
@@ -32,7 +32,9 @@
 #define CONFIG_CPU_ARMV8
 #define CONFIG_REMAKE_ELF
 #define CONFIG_SYS_MAXARGS		32
+#ifndef CONFIG_SYS_MALLOC_LEN
 #define CONFIG_SYS_MALLOC_LEN		(32 << 20)
+#endif
 #define CONFIG_SYS_CBSIZE		1024
 
 #define CONFIG_SYS_SDRAM_BASE		0
-- 
2.30.2


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

* [PATCH 2/9] configs: meson64_android: increase SYS_MALLOC_LEN to 128M for AVB
  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 15:17 ` 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
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 30+ messages in thread
From: Mattijs Korpershoek @ 2021-08-05 15:17 UTC (permalink / raw)
  To: Neil Armstrong; +Cc: u-boot-amlogic, u-boot, Mattijs Korpershoek

To prepare for AVB support, increase SYS_MALLOC_LEN to 128M.
This value has been found by testing the following on khadas vim3l:
  => avb init
  => avb verify

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
 include/configs/meson64_android.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/configs/meson64_android.h b/include/configs/meson64_android.h
index f9f2b26416..bc3ffb9ca5 100644
--- a/include/configs/meson64_android.h
+++ b/include/configs/meson64_android.h
@@ -9,6 +9,10 @@
 #ifndef __MESON64_ANDROID_CONFIG_H
 #define __MESON64_ANDROID_CONFIG_H
 
+#include <linux/sizes.h>
+
+#define CONFIG_SYS_MALLOC_LEN	       SZ_128M
+
 #ifndef BOOT_PARTITION
 #define BOOT_PARTITION "boot"
 #endif
-- 
2.30.2


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

* [PATCH 3/9] configs: meson64_android: implement AVB support
  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 15:17 ` [PATCH 2/9] configs: meson64_android: increase SYS_MALLOC_LEN to 128M for AVB Mattijs Korpershoek
@ 2021-08-05 15:17 ` 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
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 30+ messages in thread
From: Mattijs Korpershoek @ 2021-08-05 15:17 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: u-boot-amlogic, u-boot, Mattijs Korpershoek, Guillaume La Roque

AVB (Android Verified Boot) is well supported in U-Boot already.
Add support for it in meson64_android.

This is controlled by the "force_avb" environment variable and the
CONFIG_CMD_AVB option.

Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
 include/configs/meson64_android.h | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/include/configs/meson64_android.h b/include/configs/meson64_android.h
index bc3ffb9ca5..48a23b6e41 100644
--- a/include/configs/meson64_android.h
+++ b/include/configs/meson64_android.h
@@ -27,6 +27,25 @@
 
 #ifndef RECOVERY_PARTITION
 #define RECOVERY_PARTITION "recovery"
+
+#if defined(CONFIG_CMD_AVB)
+#define AVB_VERIFY_CHECK \
+	"if test \"${force_avb}\" -eq 1; then " \
+		"if run avb_verify; then " \
+			"echo AVB verification OK.;" \
+			"setenv bootargs \"$bootargs $avb_bootargs\";" \
+		"else " \
+			"echo AVB verification failed.;" \
+		"exit; fi;" \
+	"else " \
+		"setenv bootargs \"$bootargs androidboot.verifiedbootstate=orange\";" \
+		"echo Running without AVB...; "\
+	"fi;"
+
+#define AVB_VERIFY_CMD "avb_verify=avb init ${mmcdev}; avb verify;\0"
+#else
+#define AVB_VERIFY_CHECK ""
+#define AVB_VERIFY_CMD ""
 #endif
 
 #define BOOTENV_DEV_FASTBOOT(devtypeu, devtypel, instance) \
@@ -93,6 +112,7 @@
 			"echo Running Recovery...;" \
 			"mmc dev ${mmcdev};" \
 			"setenv bootargs \"${bootargs} androidboot.serialno=${serial#}\";" \
+			AVB_VERIFY_CHECK \
 			"part start mmc ${mmcdev} " RECOVERY_PARTITION " boot_start;" \
 			"part size mmc ${mmcdev} " RECOVERY_PARTITION " boot_size;" \
 			"if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
@@ -111,6 +131,7 @@
 		"echo Loading Android " BOOT_PARTITION " partition...;" \
 		"mmc dev ${mmcdev};" \
 		"setenv bootargs ${bootargs} androidboot.serialno=${serial#};" \
+		AVB_VERIFY_CHECK \
 		"part start mmc ${mmcdev} " BOOT_PARTITION " boot_start;" \
 		"part size mmc ${mmcdev} " BOOT_PARTITION " boot_size;" \
 		"if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
@@ -142,6 +163,8 @@
 #define CONFIG_EXTRA_ENV_SETTINGS                                     \
 	"partitions=" PARTS_DEFAULT "\0"                              \
 	"mmcdev=2\0"                                                  \
+	AVB_VERIFY_CMD                                                \
+	"force_avb=0\0"                                               \
 	"gpio_recovery=88\0"                                          \
 	"check_button=gpio input ${gpio_recovery};test $? -eq 0;\0"   \
 	"load_logo=" PREBOOT_LOAD_LOGO "\0"			      \
-- 
2.30.2


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

* [PATCH 4/9] configs: meson64_android: implement A/B slot support
  2021-08-05 15:17 [PATCH 0/9] meson64_android: Android boot flow using abootimg Mattijs Korpershoek
                   ` (2 preceding siblings ...)
  2021-08-05 15:17 ` [PATCH 3/9] configs: meson64_android: implement AVB support Mattijs Korpershoek
@ 2021-08-05 15:17 ` 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
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 30+ messages in thread
From: Mattijs Korpershoek @ 2021-08-05 15:17 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: u-boot-amlogic, u-boot, Mattijs Korpershoek, Guillaume La Roque

Implement A/B slot selection using the U-Boot ab_select command.

Keep support for non A/B.

Not: We need to redefine the recovery partition label, as RecoveryOS
is included in the boot image for A/B systems [1]

[1] https://source.android.com/devices/tech/ota/ab/ab_implement#recovery
Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
 include/configs/meson64_android.h | 55 ++++++++++++++++++++++++++-----
 1 file changed, 47 insertions(+), 8 deletions(-)

diff --git a/include/configs/meson64_android.h b/include/configs/meson64_android.h
index 48a23b6e41..83fa25bfb1 100644
--- a/include/configs/meson64_android.h
+++ b/include/configs/meson64_android.h
@@ -25,9 +25,6 @@
 #define CONTROL_PARTITION "misc"
 #endif
 
-#ifndef RECOVERY_PARTITION
-#define RECOVERY_PARTITION "recovery"
-
 #if defined(CONFIG_CMD_AVB)
 #define AVB_VERIFY_CHECK \
 	"if test \"${force_avb}\" -eq 1; then " \
@@ -42,12 +39,48 @@
 		"echo Running without AVB...; "\
 	"fi;"
 
-#define AVB_VERIFY_CMD "avb_verify=avb init ${mmcdev}; avb verify;\0"
+#define AVB_VERIFY_CMD "avb_verify=avb init ${mmcdev}; avb verify $slot_suffix;\0"
 #else
 #define AVB_VERIFY_CHECK ""
 #define AVB_VERIFY_CMD ""
 #endif
 
+#if defined(CONFIG_CMD_AB_SELECT)
+#define ANDROIDBOOT_GET_CURRENT_SLOT_CMD "get_current_slot=" \
+	"if part number mmc ${mmcdev} " CONTROL_PARTITION " control_part_number; " \
+	"then " \
+		"echo " CONTROL_PARTITION \
+			" partition number:${control_part_number};" \
+		"ab_select current_slot mmc ${mmcdev}:${control_part_number};" \
+	"else " \
+		"echo " CONTROL_PARTITION " partition not found;" \
+	"fi;\0"
+
+#define AB_SELECT_SLOT \
+	"run get_current_slot; " \
+	"if test -e \"${current_slot}\"; " \
+	"then " \
+		"setenv slot_suffix _${current_slot}; " \
+	"else " \
+		"echo current_slot not found;" \
+		"exit;" \
+	"fi;"
+
+#define AB_SELECT_ARGS \
+	"setenv bootargs_ab androidboot.slot_suffix=${slot_suffix}; " \
+	"echo A/B cmdline addition: ${bootargs_ab};" \
+	"setenv bootargs ${bootargs} ${bootargs_ab};"
+
+#define AB_BOOTARGS " androidboot.force_normal_boot=1"
+#define RECOVERY_PARTITION "boot"
+#else
+#define AB_SELECT_SLOT ""
+#define AB_SELECT_ARGS " "
+#define ANDROIDBOOT_GET_CURRENT_SLOT_CMD ""
+#define AB_BOOTARGS " "
+#define RECOVERY_PARTITION "recovery"
+#endif
+
 #define BOOTENV_DEV_FASTBOOT(devtypeu, devtypel, instance) \
 	"bootcmd_fastboot=" \
 		"setenv run_fastboot 0;" \
@@ -112,9 +145,11 @@
 			"echo Running Recovery...;" \
 			"mmc dev ${mmcdev};" \
 			"setenv bootargs \"${bootargs} androidboot.serialno=${serial#}\";" \
+			AB_SELECT_SLOT \
+			AB_SELECT_ARGS \
 			AVB_VERIFY_CHECK \
-			"part start mmc ${mmcdev} " RECOVERY_PARTITION " boot_start;" \
-			"part size mmc ${mmcdev} " RECOVERY_PARTITION " boot_size;" \
+			"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 " \
 				"echo Running Android Recovery...;" \
 				"bootm ${loadaddr};" \
@@ -131,10 +166,13 @@
 		"echo Loading Android " BOOT_PARTITION " partition...;" \
 		"mmc dev ${mmcdev};" \
 		"setenv bootargs ${bootargs} androidboot.serialno=${serial#};" \
+		AB_SELECT_SLOT \
+		AB_SELECT_ARGS \
 		AVB_VERIFY_CHECK \
-		"part start mmc ${mmcdev} " BOOT_PARTITION " boot_start;" \
-		"part size mmc ${mmcdev} " BOOT_PARTITION " boot_size;" \
+		"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 " \
+			"setenv bootargs \"${bootargs} " AB_BOOTARGS "\"  ; " \
 			"echo Running Android...;" \
 			"bootm ${loadaddr};" \
 		"fi;" \
@@ -163,6 +201,7 @@
 #define CONFIG_EXTRA_ENV_SETTINGS                                     \
 	"partitions=" PARTS_DEFAULT "\0"                              \
 	"mmcdev=2\0"                                                  \
+	ANDROIDBOOT_GET_CURRENT_SLOT_CMD                              \
 	AVB_VERIFY_CMD                                                \
 	"force_avb=0\0"                                               \
 	"gpio_recovery=88\0"                                          \
-- 
2.30.2


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

* [PATCH 5/9] configs: meson64_android: define BOOT_CMD macro
  2021-08-05 15:17 [PATCH 0/9] meson64_android: Android boot flow using abootimg Mattijs Korpershoek
                   ` (3 preceding siblings ...)
  2021-08-05 15:17 ` [PATCH 4/9] configs: meson64_android: implement A/B slot support Mattijs Korpershoek
@ 2021-08-05 15:17 ` 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
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 30+ messages in thread
From: Mattijs Korpershoek @ 2021-08-05 15:17 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: u-boot-amlogic, u-boot, Mattijs Korpershoek, Guillaume La Roque

BOOT_CMD might be different based on CONFIG_CMD_ABOOTIMG.

To prepare for abootimg support, extract the boot command
to a dedicated macro.

Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
 include/configs/meson64_android.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/configs/meson64_android.h b/include/configs/meson64_android.h
index 83fa25bfb1..0ce616c17e 100644
--- a/include/configs/meson64_android.h
+++ b/include/configs/meson64_android.h
@@ -81,6 +81,8 @@
 #define RECOVERY_PARTITION "recovery"
 #endif
 
+#define BOOT_CMD "bootm ${loadaddr};"
+
 #define BOOTENV_DEV_FASTBOOT(devtypeu, devtypel, instance) \
 	"bootcmd_fastboot=" \
 		"setenv run_fastboot 0;" \
@@ -152,7 +154,7 @@
 			"part size mmc ${mmcdev} " RECOVERY_PARTITION "${slot_suffix} boot_size;" \
 			"if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
 				"echo Running Android Recovery...;" \
-				"bootm ${loadaddr};" \
+				BOOT_CMD \
 			"fi;" \
 			"echo Failed to boot Android...;" \
 			"reset;" \
@@ -174,7 +176,7 @@
 		"if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
 			"setenv bootargs \"${bootargs} " AB_BOOTARGS "\"  ; " \
 			"echo Running Android...;" \
-			"bootm ${loadaddr};" \
+			BOOT_CMD \
 		"fi;" \
 		"echo Failed to boot Android...;" \
 		"reset\0"
-- 
2.30.2


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

* [PATCH 6/9] configs: meson64_android: boot android via abootimg
  2021-08-05 15:17 [PATCH 0/9] meson64_android: Android boot flow using abootimg Mattijs Korpershoek
                   ` (4 preceding siblings ...)
  2021-08-05 15:17 ` [PATCH 5/9] configs: meson64_android: define BOOT_CMD macro Mattijs Korpershoek
@ 2021-08-05 15:17 ` Mattijs Korpershoek
  2021-08-05 16:21   ` Neil Armstrong
  2021-08-05 15:17 ` [PATCH 7/9] configs: sei510/sei610: reformat PARTS_default Mattijs Korpershoek
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 30+ messages in thread
From: Mattijs Korpershoek @ 2021-08-05 15:17 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: u-boot-amlogic, u-boot, Guillaume La Roque, Mattijs Korpershoek

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"                                  \
-- 
2.30.2


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

* [PATCH 7/9] configs: sei510/sei610: reformat PARTS_default
  2021-08-05 15:17 [PATCH 0/9] meson64_android: Android boot flow using abootimg Mattijs Korpershoek
                   ` (5 preceding siblings ...)
  2021-08-05 15:17 ` [PATCH 6/9] configs: meson64_android: boot android via abootimg Mattijs Korpershoek
@ 2021-08-05 15:17 ` 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
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 30+ messages in thread
From: Mattijs Korpershoek @ 2021-08-05 15:17 UTC (permalink / raw)
  To: Neil Armstrong; +Cc: u-boot-amlogic, u-boot, Mattijs Korpershoek

There is a mix of spaces and tabs at the leading \. This makes updating
theses lines harder.

Add a single space before each \ for some consistency.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
 include/configs/sei510.h | 14 +++++++-------
 include/configs/sei610.h | 14 +++++++-------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/include/configs/sei510.h b/include/configs/sei510.h
index d37b4c6405..16a34c717d 100644
--- a/include/configs/sei510.h
+++ b/include/configs/sei510.h
@@ -16,14 +16,14 @@
 #define USERDATA_UUID "9b976e42-5207-11e9-8f16-ff47ac594b22;"
 #define ROOT_UUID "ddb8c3f6-d94d-4394-b633-3134139cc2e0;"
 
-#define PARTS_DEFAULT                                        \
-	"uuid_disk=${uuid_gpt_disk};"  			\
+#define PARTS_DEFAULT \
+	"uuid_disk=${uuid_gpt_disk};" \
 	"name=boot,size=64M,bootable,uuid=${uuid_gpt_boot};" \
-	"name=logo,size=2M,uuid=" LOGO_UUID             \
-	"name=cache,size=256M,uuid=" CACHE_UUID             \
-	"name=system,size=1536M,uuid=" SYSTEM_UUID           \
-	"name=vendor,size=256M,uuid=" VENDOR_UUID            \
-	"name=userdata,size=5341M,uuid=" USERDATA_UUID	\
+	"name=logo,size=2M,uuid=" LOGO_UUID \
+	"name=cache,size=256M,uuid=" CACHE_UUID \
+	"name=system,size=1536M,uuid=" SYSTEM_UUID \
+	"name=vendor,size=256M,uuid=" VENDOR_UUID \
+	"name=userdata,size=5341M,uuid=" USERDATA_UUID \
 	"name=rootfs,size=-,uuid=" ROOT_UUID
 
 
diff --git a/include/configs/sei610.h b/include/configs/sei610.h
index 9eeffdd72c..6d13fd143b 100644
--- a/include/configs/sei610.h
+++ b/include/configs/sei610.h
@@ -16,14 +16,14 @@
 #define USERDATA_UUID "9b976e42-5207-11e9-8f16-ff47ac594b22;"
 #define ROOT_UUID "ddb8c3f6-d94d-4394-b633-3134139cc2e0;"
 
-#define PARTS_DEFAULT                                        \
-	"uuid_disk=${uuid_gpt_disk};"  			\
+#define PARTS_DEFAULT \
+	"uuid_disk=${uuid_gpt_disk};" \
 	"name=boot,size=64M,bootable,uuid=${uuid_gpt_boot};" \
-	"name=logo,size=2M,uuid=" LOGO_UUID             \
-	"name=cache,size=256M,uuid=" CACHE_UUID             \
-	"name=system,size=1536M,uuid=" SYSTEM_UUID           \
-	"name=vendor,size=256M,uuid=" VENDOR_UUID            \
-	"name=userdata,size=12795M,uuid=" USERDATA_UUID	\
+	"name=logo,size=2M,uuid=" LOGO_UUID \
+	"name=cache,size=256M,uuid=" CACHE_UUID \
+	"name=system,size=1536M,uuid=" SYSTEM_UUID \
+	"name=vendor,size=256M,uuid=" VENDOR_UUID \
+	"name=userdata,size=12795M,uuid=" USERDATA_UUID \
 	"name=rootfs,size=-,uuid=" ROOT_UUID
 
 #include <configs/meson64_android.h>
-- 
2.30.2


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

* [PATCH 8/9] configs: sei510/sei610: don't use hard-coded gpt uuids
  2021-08-05 15:17 [PATCH 0/9] meson64_android: Android boot flow using abootimg Mattijs Korpershoek
                   ` (6 preceding siblings ...)
  2021-08-05 15:17 ` [PATCH 7/9] configs: sei510/sei610: reformat PARTS_default Mattijs Korpershoek
@ 2021-08-05 15:17 ` 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
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 30+ messages in thread
From: Mattijs Korpershoek @ 2021-08-05 15:17 UTC (permalink / raw)
  To: Neil Armstrong; +Cc: u-boot-amlogic, u-boot, Mattijs Korpershoek

doc/README.gpt states:

> The fields 'uuid' and 'uuid_disk' are optional if CONFIG_RANDOM_UUID is
> enabled. A random uuid will be used if omitted or they point to an empty/
> non-existent environment variable. The environment variable will be
> set to the generated UUID.  The 'gpt guid' command reads the current
> value of the uuid_disk from the GPT.

Since we have CONFIG_RANDOM_UUID=y, remove the hard-coded uuids
and use meaningful variable names instead.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
 include/configs/sei510.h | 12 ++++--------
 include/configs/sei610.h | 12 ++++--------
 2 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/include/configs/sei510.h b/include/configs/sei510.h
index 16a34c717d..5bf2668803 100644
--- a/include/configs/sei510.h
+++ b/include/configs/sei510.h
@@ -10,20 +10,16 @@
 #define __CONFIG_H
 
 #define LOGO_UUID "43a3305d-150f-4cc9-bd3b-38fca8693846;"
-#define CACHE_UUID "99207ae6-5207-11e9-999e-6f77a3612069;"
-#define SYSTEM_UUID "99f9b7ac-5207-11e9-8507-c3c037e393f3;"
-#define VENDOR_UUID "9d082802-5207-11e9-954c-cbbce08ba108;"
-#define USERDATA_UUID "9b976e42-5207-11e9-8f16-ff47ac594b22;"
 #define ROOT_UUID "ddb8c3f6-d94d-4394-b633-3134139cc2e0;"
 
 #define PARTS_DEFAULT \
 	"uuid_disk=${uuid_gpt_disk};" \
 	"name=boot,size=64M,bootable,uuid=${uuid_gpt_boot};" \
 	"name=logo,size=2M,uuid=" LOGO_UUID \
-	"name=cache,size=256M,uuid=" CACHE_UUID \
-	"name=system,size=1536M,uuid=" SYSTEM_UUID \
-	"name=vendor,size=256M,uuid=" VENDOR_UUID \
-	"name=userdata,size=5341M,uuid=" USERDATA_UUID \
+	"name=cache,size=256M,uuid=${uuid_gpt_cache};" \
+	"name=system,size=1536M,uuid=${uuid_gpt_system};" \
+	"name=vendor,size=256M,uuid=${uuid_gpt_vendor};" \
+	"name=userdata,size=5341M,uuid={uuid_gpt_userdata};" \
 	"name=rootfs,size=-,uuid=" ROOT_UUID
 
 
diff --git a/include/configs/sei610.h b/include/configs/sei610.h
index 6d13fd143b..baace75a02 100644
--- a/include/configs/sei610.h
+++ b/include/configs/sei610.h
@@ -10,20 +10,16 @@
 #define __CONFIG_H
 
 #define LOGO_UUID "43a3305d-150f-4cc9-bd3b-38fca8693846;"
-#define CACHE_UUID "99207ae6-5207-11e9-999e-6f77a3612069;"
-#define SYSTEM_UUID "99f9b7ac-5207-11e9-8507-c3c037e393f3;"
-#define VENDOR_UUID "9d082802-5207-11e9-954c-cbbce08ba108;"
-#define USERDATA_UUID "9b976e42-5207-11e9-8f16-ff47ac594b22;"
 #define ROOT_UUID "ddb8c3f6-d94d-4394-b633-3134139cc2e0;"
 
 #define PARTS_DEFAULT \
 	"uuid_disk=${uuid_gpt_disk};" \
 	"name=boot,size=64M,bootable,uuid=${uuid_gpt_boot};" \
 	"name=logo,size=2M,uuid=" LOGO_UUID \
-	"name=cache,size=256M,uuid=" CACHE_UUID \
-	"name=system,size=1536M,uuid=" SYSTEM_UUID \
-	"name=vendor,size=256M,uuid=" VENDOR_UUID \
-	"name=userdata,size=12795M,uuid=" USERDATA_UUID \
+	"name=cache,size=256M,uuid=${uuid_gpt_cache};" \
+	"name=system,size=1536M,uuid=${uuid_gpt_system};" \
+	"name=vendor,size=256M,uuid=${uuid_gpt_vendor};" \
+	"name=userdata,size=12795M,uuid=${uuid_gpt_userdata};" \
 	"name=rootfs,size=-,uuid=" ROOT_UUID
 
 #include <configs/meson64_android.h>
-- 
2.30.2


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

* [PATCH 9/9] configs: sei510/610: android bootflow via abootimg
  2021-08-05 15:17 [PATCH 0/9] meson64_android: Android boot flow using abootimg Mattijs Korpershoek
                   ` (7 preceding siblings ...)
  2021-08-05 15:17 ` [PATCH 8/9] configs: sei510/sei610: don't use hard-coded gpt uuids Mattijs Korpershoek
@ 2021-08-05 15:17 ` 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-10  8:47 ` Neil Armstrong
  10 siblings, 1 reply; 30+ messages in thread
From: Mattijs Korpershoek @ 2021-08-05 15:17 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: u-boot-amlogic, u-boot, Guillaume La Roque, Mattijs Korpershoek

From: Guillaume La Roque <glaroque@baylibre.com>

Activate the following Kconfig options:
* AVB       for Android Verified Boot support
* ADTIMG    for merging DTBOs
* ABOOTIMG  for extracting Android boot image

Also rework the partitioning tables:
- add a misc partition to handle BCB messages
- add a dtbo partition to store various DTBOs
- add a vbmeta partition for AVB hashes
- Merge vendor and system into the "super" partition

Note: avb support is disables by default. To activate it:
 => setenv force_avb 1;
 => saveenv;

Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
 configs/sei510_defconfig |  5 +++++
 configs/sei610_defconfig |  5 +++++
 include/configs/sei510.h | 11 +++++++----
 include/configs/sei610.h | 13 ++++++++-----
 4 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/configs/sei510_defconfig b/configs/sei510_defconfig
index 74328f2fd4..8099b40b55 100644
--- a/configs/sei510_defconfig
+++ b/configs/sei510_defconfig
@@ -20,7 +20,10 @@ CONFIG_PREBOOT="run load_logo"
 # CONFIG_CONSOLE_MUX is not set
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_MISC_INIT_R=y
+CONFIG_AVB_VERIFY=y
 # CONFIG_CMD_BDI is not set
+CONFIG_CMD_ADTIMG=y
+CONFIG_CMD_ABOOTIMG=y
 # CONFIG_CMD_IMI is not set
 CONFIG_CMD_BCB=y
 CONFIG_CMD_GPIO=y
@@ -32,6 +35,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_BMP=y
 CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_AVB=y
 CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
@@ -84,4 +88,5 @@ CONFIG_VIDEO_BMP_RLE8=y
 CONFIG_BMP_16BPP=y
 CONFIG_BMP_24BPP=y
 CONFIG_BMP_32BPP=y
+CONFIG_LIBAVB=y
 CONFIG_OF_LIBFDT_OVERLAY=y
diff --git a/configs/sei610_defconfig b/configs/sei610_defconfig
index 2a6d0e5995..e11f36ac79 100644
--- a/configs/sei610_defconfig
+++ b/configs/sei610_defconfig
@@ -20,7 +20,10 @@ CONFIG_PREBOOT="run load_logo"
 # CONFIG_CONSOLE_MUX is not set
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_MISC_INIT_R=y
+CONFIG_AVB_VERIFY=y
 # CONFIG_CMD_BDI is not set
+CONFIG_CMD_ADTIMG=y
+CONFIG_CMD_ABOOTIMG=y
 # CONFIG_CMD_IMI is not set
 CONFIG_CMD_BCB=y
 CONFIG_CMD_GPIO=y
@@ -32,6 +35,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_BMP=y
 CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_AVB=y
 CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
@@ -84,4 +88,5 @@ CONFIG_VIDEO_BMP_RLE8=y
 CONFIG_BMP_16BPP=y
 CONFIG_BMP_24BPP=y
 CONFIG_BMP_32BPP=y
+CONFIG_LIBAVB=y
 CONFIG_OF_LIBFDT_OVERLAY=y
diff --git a/include/configs/sei510.h b/include/configs/sei510.h
index 5bf2668803..ea91a06157 100644
--- a/include/configs/sei510.h
+++ b/include/configs/sei510.h
@@ -14,12 +14,15 @@
 
 #define PARTS_DEFAULT \
 	"uuid_disk=${uuid_gpt_disk};" \
-	"name=boot,size=64M,bootable,uuid=${uuid_gpt_boot};" \
 	"name=logo,size=2M,uuid=" LOGO_UUID \
+	"name=misc,size=128K,uuid=${uuid_gpt_misc};" \
+	"name=dtbo,size=8M,uuid=${uuid_gpt_dtbo};" \
+	"name=vbmeta,size=64K,uuid=${uuid_gpt_vbmeta};" \
+	"name=boot,size=32M,bootable,uuid=${uuid_gpt_boot};" \
+	"name=recovery,size=32M,uuid=${uuid_gpt_recovery};" \
 	"name=cache,size=256M,uuid=${uuid_gpt_cache};" \
-	"name=system,size=1536M,uuid=${uuid_gpt_system};" \
-	"name=vendor,size=256M,uuid=${uuid_gpt_vendor};" \
-	"name=userdata,size=5341M,uuid={uuid_gpt_userdata};" \
+	"name=super,size=2304M,uuid=${uuid_gpt_super};" \
+	"name=userdata,size=4820M,uuid=${uuid_gpt_userdata};" \
 	"name=rootfs,size=-,uuid=" ROOT_UUID
 
 
diff --git a/include/configs/sei610.h b/include/configs/sei610.h
index baace75a02..783eece271 100644
--- a/include/configs/sei610.h
+++ b/include/configs/sei610.h
@@ -14,12 +14,15 @@
 
 #define PARTS_DEFAULT \
 	"uuid_disk=${uuid_gpt_disk};" \
-	"name=boot,size=64M,bootable,uuid=${uuid_gpt_boot};" \
-	"name=logo,size=2M,uuid=" LOGO_UUID \
+	"name=logo,start=512K,size=2M,uuid=" LOGO_UUID \
+	"name=misc,size=512K,uuid=${uuid_gpt_misc};" \
+	"name=dtbo,size=8M,uuid=${uuid_gpt_dtbo};" \
+	"name=vbmeta,size=512K,uuid=${uuid_gpt_vbmeta};" \
+	"name=boot,size=32M,bootable,uuid=${uuid_gpt_boot};" \
+	"name=recovery,size=32M,uuid=${uuid_gpt_recovery};" \
 	"name=cache,size=256M,uuid=${uuid_gpt_cache};" \
-	"name=system,size=1536M,uuid=${uuid_gpt_system};" \
-	"name=vendor,size=256M,uuid=${uuid_gpt_vendor};" \
-	"name=userdata,size=12795M,uuid=${uuid_gpt_userdata};" \
+	"name=super,size=2304M,uuid=${uuid_gpt_super};" \
+	"name=userdata,size=12274M,uuid=${uuid_gpt_userdata};" \
 	"name=rootfs,size=-,uuid=" ROOT_UUID
 
 #include <configs/meson64_android.h>
-- 
2.30.2


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

* Re: [PATCH 1/9] configs: meson64: permit redefining SYS_MALLOC_LEN
  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
  0 siblings, 1 reply; 30+ messages in thread
From: Neil Armstrong @ 2021-08-05 16:20 UTC (permalink / raw)
  To: Mattijs Korpershoek; +Cc: u-boot-amlogic, u-boot, Guillaume La Roque

On 05/08/2021 17:17, Mattijs Korpershoek wrote:
> Permit redefining SYS_MALLOC_LEN for board specific configs.
> This is especially useful for Android with AVB, which requires a malloc
> length of 128M.
> 
> Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
>  include/configs/meson64.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/configs/meson64.h b/include/configs/meson64.h
> index fb7f16d148..f9bb0240d2 100644
> --- a/include/configs/meson64.h
> +++ b/include/configs/meson64.h
> @@ -32,7 +32,9 @@
>  #define CONFIG_CPU_ARMV8
>  #define CONFIG_REMAKE_ELF
>  #define CONFIG_SYS_MAXARGS		32
> +#ifndef CONFIG_SYS_MALLOC_LEN
>  #define CONFIG_SYS_MALLOC_LEN		(32 << 20)
> +#endif
>  #define CONFIG_SYS_CBSIZE		1024
>  
>  #define CONFIG_SYS_SDRAM_BASE		0
> 

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

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

* Re: [PATCH 2/9] configs: meson64_android: increase SYS_MALLOC_LEN to 128M for AVB
  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
  0 siblings, 0 replies; 30+ messages in thread
From: Neil Armstrong @ 2021-08-05 16:20 UTC (permalink / raw)
  To: Mattijs Korpershoek; +Cc: u-boot-amlogic, u-boot

On 05/08/2021 17:17, Mattijs Korpershoek wrote:
> To prepare for AVB support, increase SYS_MALLOC_LEN to 128M.
> This value has been found by testing the following on khadas vim3l:
>   => avb init
>   => avb verify
> 
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
>  include/configs/meson64_android.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/include/configs/meson64_android.h b/include/configs/meson64_android.h
> index f9f2b26416..bc3ffb9ca5 100644
> --- a/include/configs/meson64_android.h
> +++ b/include/configs/meson64_android.h
> @@ -9,6 +9,10 @@
>  #ifndef __MESON64_ANDROID_CONFIG_H
>  #define __MESON64_ANDROID_CONFIG_H
>  
> +#include <linux/sizes.h>
> +
> +#define CONFIG_SYS_MALLOC_LEN	       SZ_128M
> +
>  #ifndef BOOT_PARTITION
>  #define BOOT_PARTITION "boot"
>  #endif
> 

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

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

* Re: [PATCH 3/9] configs: meson64_android: implement AVB support
  2021-08-05 15:17 ` [PATCH 3/9] configs: meson64_android: implement AVB support Mattijs Korpershoek
@ 2021-08-05 16:20   ` Neil Armstrong
  0 siblings, 0 replies; 30+ messages in thread
From: Neil Armstrong @ 2021-08-05 16:20 UTC (permalink / raw)
  To: Mattijs Korpershoek; +Cc: u-boot-amlogic, u-boot, Guillaume La Roque

On 05/08/2021 17:17, Mattijs Korpershoek wrote:
> AVB (Android Verified Boot) is well supported in U-Boot already.
> Add support for it in meson64_android.
> 
> This is controlled by the "force_avb" environment variable and the
> CONFIG_CMD_AVB option.
> 
> Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
>  include/configs/meson64_android.h | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/include/configs/meson64_android.h b/include/configs/meson64_android.h
> index bc3ffb9ca5..48a23b6e41 100644
> --- a/include/configs/meson64_android.h
> +++ b/include/configs/meson64_android.h
> @@ -27,6 +27,25 @@
>  
>  #ifndef RECOVERY_PARTITION
>  #define RECOVERY_PARTITION "recovery"
> +
> +#if defined(CONFIG_CMD_AVB)
> +#define AVB_VERIFY_CHECK \
> +	"if test \"${force_avb}\" -eq 1; then " \
> +		"if run avb_verify; then " \
> +			"echo AVB verification OK.;" \
> +			"setenv bootargs \"$bootargs $avb_bootargs\";" \
> +		"else " \
> +			"echo AVB verification failed.;" \
> +		"exit; fi;" \
> +	"else " \
> +		"setenv bootargs \"$bootargs androidboot.verifiedbootstate=orange\";" \
> +		"echo Running without AVB...; "\
> +	"fi;"
> +
> +#define AVB_VERIFY_CMD "avb_verify=avb init ${mmcdev}; avb verify;\0"
> +#else
> +#define AVB_VERIFY_CHECK ""
> +#define AVB_VERIFY_CMD ""
>  #endif
>  
>  #define BOOTENV_DEV_FASTBOOT(devtypeu, devtypel, instance) \
> @@ -93,6 +112,7 @@
>  			"echo Running Recovery...;" \
>  			"mmc dev ${mmcdev};" \
>  			"setenv bootargs \"${bootargs} androidboot.serialno=${serial#}\";" \
> +			AVB_VERIFY_CHECK \
>  			"part start mmc ${mmcdev} " RECOVERY_PARTITION " boot_start;" \
>  			"part size mmc ${mmcdev} " RECOVERY_PARTITION " boot_size;" \
>  			"if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
> @@ -111,6 +131,7 @@
>  		"echo Loading Android " BOOT_PARTITION " partition...;" \
>  		"mmc dev ${mmcdev};" \
>  		"setenv bootargs ${bootargs} androidboot.serialno=${serial#};" \
> +		AVB_VERIFY_CHECK \
>  		"part start mmc ${mmcdev} " BOOT_PARTITION " boot_start;" \
>  		"part size mmc ${mmcdev} " BOOT_PARTITION " boot_size;" \
>  		"if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
> @@ -142,6 +163,8 @@
>  #define CONFIG_EXTRA_ENV_SETTINGS                                     \
>  	"partitions=" PARTS_DEFAULT "\0"                              \
>  	"mmcdev=2\0"                                                  \
> +	AVB_VERIFY_CMD                                                \
> +	"force_avb=0\0"                                               \
>  	"gpio_recovery=88\0"                                          \
>  	"check_button=gpio input ${gpio_recovery};test $? -eq 0;\0"   \
>  	"load_logo=" PREBOOT_LOAD_LOGO "\0"			      \
> 

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

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

* Re: [PATCH 4/9] configs: meson64_android: implement A/B slot support
  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
  0 siblings, 0 replies; 30+ messages in thread
From: Neil Armstrong @ 2021-08-05 16:21 UTC (permalink / raw)
  To: Mattijs Korpershoek; +Cc: u-boot-amlogic, u-boot, Guillaume La Roque

On 05/08/2021 17:17, Mattijs Korpershoek wrote:
> Implement A/B slot selection using the U-Boot ab_select command.
> 
> Keep support for non A/B.
> 
> Not: We need to redefine the recovery partition label, as RecoveryOS
> is included in the boot image for A/B systems [1]
> 
> [1] https://source.android.com/devices/tech/ota/ab/ab_implement#recovery
> Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
>  include/configs/meson64_android.h | 55 ++++++++++++++++++++++++++-----
>  1 file changed, 47 insertions(+), 8 deletions(-)
> 
> diff --git a/include/configs/meson64_android.h b/include/configs/meson64_android.h
> index 48a23b6e41..83fa25bfb1 100644
> --- a/include/configs/meson64_android.h
> +++ b/include/configs/meson64_android.h
> @@ -25,9 +25,6 @@
>  #define CONTROL_PARTITION "misc"
>  #endif
>  
> -#ifndef RECOVERY_PARTITION
> -#define RECOVERY_PARTITION "recovery"
> -
>  #if defined(CONFIG_CMD_AVB)
>  #define AVB_VERIFY_CHECK \
>  	"if test \"${force_avb}\" -eq 1; then " \
> @@ -42,12 +39,48 @@
>  		"echo Running without AVB...; "\
>  	"fi;"
>  
> -#define AVB_VERIFY_CMD "avb_verify=avb init ${mmcdev}; avb verify;\0"
> +#define AVB_VERIFY_CMD "avb_verify=avb init ${mmcdev}; avb verify $slot_suffix;\0"
>  #else
>  #define AVB_VERIFY_CHECK ""
>  #define AVB_VERIFY_CMD ""
>  #endif
>  
> +#if defined(CONFIG_CMD_AB_SELECT)
> +#define ANDROIDBOOT_GET_CURRENT_SLOT_CMD "get_current_slot=" \
> +	"if part number mmc ${mmcdev} " CONTROL_PARTITION " control_part_number; " \
> +	"then " \
> +		"echo " CONTROL_PARTITION \
> +			" partition number:${control_part_number};" \
> +		"ab_select current_slot mmc ${mmcdev}:${control_part_number};" \
> +	"else " \
> +		"echo " CONTROL_PARTITION " partition not found;" \
> +	"fi;\0"
> +
> +#define AB_SELECT_SLOT \
> +	"run get_current_slot; " \
> +	"if test -e \"${current_slot}\"; " \
> +	"then " \
> +		"setenv slot_suffix _${current_slot}; " \
> +	"else " \
> +		"echo current_slot not found;" \
> +		"exit;" \
> +	"fi;"
> +
> +#define AB_SELECT_ARGS \
> +	"setenv bootargs_ab androidboot.slot_suffix=${slot_suffix}; " \
> +	"echo A/B cmdline addition: ${bootargs_ab};" \
> +	"setenv bootargs ${bootargs} ${bootargs_ab};"
> +
> +#define AB_BOOTARGS " androidboot.force_normal_boot=1"
> +#define RECOVERY_PARTITION "boot"
> +#else
> +#define AB_SELECT_SLOT ""
> +#define AB_SELECT_ARGS " "
> +#define ANDROIDBOOT_GET_CURRENT_SLOT_CMD ""
> +#define AB_BOOTARGS " "
> +#define RECOVERY_PARTITION "recovery"
> +#endif
> +
>  #define BOOTENV_DEV_FASTBOOT(devtypeu, devtypel, instance) \
>  	"bootcmd_fastboot=" \
>  		"setenv run_fastboot 0;" \
> @@ -112,9 +145,11 @@
>  			"echo Running Recovery...;" \
>  			"mmc dev ${mmcdev};" \
>  			"setenv bootargs \"${bootargs} androidboot.serialno=${serial#}\";" \
> +			AB_SELECT_SLOT \
> +			AB_SELECT_ARGS \
>  			AVB_VERIFY_CHECK \
> -			"part start mmc ${mmcdev} " RECOVERY_PARTITION " boot_start;" \
> -			"part size mmc ${mmcdev} " RECOVERY_PARTITION " boot_size;" \
> +			"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 " \
>  				"echo Running Android Recovery...;" \
>  				"bootm ${loadaddr};" \
> @@ -131,10 +166,13 @@
>  		"echo Loading Android " BOOT_PARTITION " partition...;" \
>  		"mmc dev ${mmcdev};" \
>  		"setenv bootargs ${bootargs} androidboot.serialno=${serial#};" \
> +		AB_SELECT_SLOT \
> +		AB_SELECT_ARGS \
>  		AVB_VERIFY_CHECK \
> -		"part start mmc ${mmcdev} " BOOT_PARTITION " boot_start;" \
> -		"part size mmc ${mmcdev} " BOOT_PARTITION " boot_size;" \
> +		"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 " \
> +			"setenv bootargs \"${bootargs} " AB_BOOTARGS "\"  ; " \
>  			"echo Running Android...;" \
>  			"bootm ${loadaddr};" \
>  		"fi;" \
> @@ -163,6 +201,7 @@
>  #define CONFIG_EXTRA_ENV_SETTINGS                                     \
>  	"partitions=" PARTS_DEFAULT "\0"                              \
>  	"mmcdev=2\0"                                                  \
> +	ANDROIDBOOT_GET_CURRENT_SLOT_CMD                              \
>  	AVB_VERIFY_CMD                                                \
>  	"force_avb=0\0"                                               \
>  	"gpio_recovery=88\0"                                          \
> 

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

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

* Re: [PATCH 5/9] configs: meson64_android: define BOOT_CMD macro
  2021-08-05 15:17 ` [PATCH 5/9] configs: meson64_android: define BOOT_CMD macro Mattijs Korpershoek
@ 2021-08-05 16:21   ` Neil Armstrong
  0 siblings, 0 replies; 30+ messages in thread
From: Neil Armstrong @ 2021-08-05 16:21 UTC (permalink / raw)
  To: Mattijs Korpershoek; +Cc: u-boot-amlogic, u-boot, Guillaume La Roque

On 05/08/2021 17:17, Mattijs Korpershoek wrote:
> BOOT_CMD might be different based on CONFIG_CMD_ABOOTIMG.
> 
> To prepare for abootimg support, extract the boot command
> to a dedicated macro.
> 
> Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
>  include/configs/meson64_android.h | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/include/configs/meson64_android.h b/include/configs/meson64_android.h
> index 83fa25bfb1..0ce616c17e 100644
> --- a/include/configs/meson64_android.h
> +++ b/include/configs/meson64_android.h
> @@ -81,6 +81,8 @@
>  #define RECOVERY_PARTITION "recovery"
>  #endif
>  
> +#define BOOT_CMD "bootm ${loadaddr};"
> +
>  #define BOOTENV_DEV_FASTBOOT(devtypeu, devtypel, instance) \
>  	"bootcmd_fastboot=" \
>  		"setenv run_fastboot 0;" \
> @@ -152,7 +154,7 @@
>  			"part size mmc ${mmcdev} " RECOVERY_PARTITION "${slot_suffix} boot_size;" \
>  			"if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
>  				"echo Running Android Recovery...;" \
> -				"bootm ${loadaddr};" \
> +				BOOT_CMD \
>  			"fi;" \
>  			"echo Failed to boot Android...;" \
>  			"reset;" \
> @@ -174,7 +176,7 @@
>  		"if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
>  			"setenv bootargs \"${bootargs} " AB_BOOTARGS "\"  ; " \
>  			"echo Running Android...;" \
> -			"bootm ${loadaddr};" \
> +			BOOT_CMD \
>  		"fi;" \
>  		"echo Failed to boot Android...;" \
>  		"reset\0"
> 

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

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

* Re: [PATCH 6/9] configs: meson64_android: boot android via abootimg
  2021-08-05 15:17 ` [PATCH 6/9] configs: meson64_android: boot android via abootimg Mattijs Korpershoek
@ 2021-08-05 16:21   ` Neil Armstrong
  0 siblings, 0 replies; 30+ messages in thread
From: Neil Armstrong @ 2021-08-05 16:21 UTC (permalink / raw)
  To: Mattijs Korpershoek; +Cc: u-boot-amlogic, u-boot, Guillaume La Roque

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>

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

* Re: [PATCH 7/9] configs: sei510/sei610: reformat PARTS_default
  2021-08-05 15:17 ` [PATCH 7/9] configs: sei510/sei610: reformat PARTS_default Mattijs Korpershoek
@ 2021-08-05 16:21   ` Neil Armstrong
  0 siblings, 0 replies; 30+ messages in thread
From: Neil Armstrong @ 2021-08-05 16:21 UTC (permalink / raw)
  To: Mattijs Korpershoek; +Cc: u-boot-amlogic, u-boot

On 05/08/2021 17:17, Mattijs Korpershoek wrote:
> There is a mix of spaces and tabs at the leading \. This makes updating
> theses lines harder.
> 
> Add a single space before each \ for some consistency.
> 
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
>  include/configs/sei510.h | 14 +++++++-------
>  include/configs/sei610.h | 14 +++++++-------
>  2 files changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/include/configs/sei510.h b/include/configs/sei510.h
> index d37b4c6405..16a34c717d 100644
> --- a/include/configs/sei510.h
> +++ b/include/configs/sei510.h
> @@ -16,14 +16,14 @@
>  #define USERDATA_UUID "9b976e42-5207-11e9-8f16-ff47ac594b22;"
>  #define ROOT_UUID "ddb8c3f6-d94d-4394-b633-3134139cc2e0;"
>  
> -#define PARTS_DEFAULT                                        \
> -	"uuid_disk=${uuid_gpt_disk};"  			\
> +#define PARTS_DEFAULT \
> +	"uuid_disk=${uuid_gpt_disk};" \
>  	"name=boot,size=64M,bootable,uuid=${uuid_gpt_boot};" \
> -	"name=logo,size=2M,uuid=" LOGO_UUID             \
> -	"name=cache,size=256M,uuid=" CACHE_UUID             \
> -	"name=system,size=1536M,uuid=" SYSTEM_UUID           \
> -	"name=vendor,size=256M,uuid=" VENDOR_UUID            \
> -	"name=userdata,size=5341M,uuid=" USERDATA_UUID	\
> +	"name=logo,size=2M,uuid=" LOGO_UUID \
> +	"name=cache,size=256M,uuid=" CACHE_UUID \
> +	"name=system,size=1536M,uuid=" SYSTEM_UUID \
> +	"name=vendor,size=256M,uuid=" VENDOR_UUID \
> +	"name=userdata,size=5341M,uuid=" USERDATA_UUID \
>  	"name=rootfs,size=-,uuid=" ROOT_UUID
>  
>  
> diff --git a/include/configs/sei610.h b/include/configs/sei610.h
> index 9eeffdd72c..6d13fd143b 100644
> --- a/include/configs/sei610.h
> +++ b/include/configs/sei610.h
> @@ -16,14 +16,14 @@
>  #define USERDATA_UUID "9b976e42-5207-11e9-8f16-ff47ac594b22;"
>  #define ROOT_UUID "ddb8c3f6-d94d-4394-b633-3134139cc2e0;"
>  
> -#define PARTS_DEFAULT                                        \
> -	"uuid_disk=${uuid_gpt_disk};"  			\
> +#define PARTS_DEFAULT \
> +	"uuid_disk=${uuid_gpt_disk};" \
>  	"name=boot,size=64M,bootable,uuid=${uuid_gpt_boot};" \
> -	"name=logo,size=2M,uuid=" LOGO_UUID             \
> -	"name=cache,size=256M,uuid=" CACHE_UUID             \
> -	"name=system,size=1536M,uuid=" SYSTEM_UUID           \
> -	"name=vendor,size=256M,uuid=" VENDOR_UUID            \
> -	"name=userdata,size=12795M,uuid=" USERDATA_UUID	\
> +	"name=logo,size=2M,uuid=" LOGO_UUID \
> +	"name=cache,size=256M,uuid=" CACHE_UUID \
> +	"name=system,size=1536M,uuid=" SYSTEM_UUID \
> +	"name=vendor,size=256M,uuid=" VENDOR_UUID \
> +	"name=userdata,size=12795M,uuid=" USERDATA_UUID \
>  	"name=rootfs,size=-,uuid=" ROOT_UUID
>  
>  #include <configs/meson64_android.h>
> 

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

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

* Re: [PATCH 8/9] configs: sei510/sei610: don't use hard-coded gpt uuids
  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
  0 siblings, 0 replies; 30+ messages in thread
From: Neil Armstrong @ 2021-08-05 16:21 UTC (permalink / raw)
  To: Mattijs Korpershoek; +Cc: u-boot-amlogic, u-boot

On 05/08/2021 17:17, Mattijs Korpershoek wrote:
> doc/README.gpt states:
> 
>> The fields 'uuid' and 'uuid_disk' are optional if CONFIG_RANDOM_UUID is
>> enabled. A random uuid will be used if omitted or they point to an empty/
>> non-existent environment variable. The environment variable will be
>> set to the generated UUID.  The 'gpt guid' command reads the current
>> value of the uuid_disk from the GPT.
> 
> Since we have CONFIG_RANDOM_UUID=y, remove the hard-coded uuids
> and use meaningful variable names instead.
> 
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
>  include/configs/sei510.h | 12 ++++--------
>  include/configs/sei610.h | 12 ++++--------
>  2 files changed, 8 insertions(+), 16 deletions(-)
> 
> diff --git a/include/configs/sei510.h b/include/configs/sei510.h
> index 16a34c717d..5bf2668803 100644
> --- a/include/configs/sei510.h
> +++ b/include/configs/sei510.h
> @@ -10,20 +10,16 @@
>  #define __CONFIG_H
>  
>  #define LOGO_UUID "43a3305d-150f-4cc9-bd3b-38fca8693846;"
> -#define CACHE_UUID "99207ae6-5207-11e9-999e-6f77a3612069;"
> -#define SYSTEM_UUID "99f9b7ac-5207-11e9-8507-c3c037e393f3;"
> -#define VENDOR_UUID "9d082802-5207-11e9-954c-cbbce08ba108;"
> -#define USERDATA_UUID "9b976e42-5207-11e9-8f16-ff47ac594b22;"
>  #define ROOT_UUID "ddb8c3f6-d94d-4394-b633-3134139cc2e0;"
>  
>  #define PARTS_DEFAULT \
>  	"uuid_disk=${uuid_gpt_disk};" \
>  	"name=boot,size=64M,bootable,uuid=${uuid_gpt_boot};" \
>  	"name=logo,size=2M,uuid=" LOGO_UUID \
> -	"name=cache,size=256M,uuid=" CACHE_UUID \
> -	"name=system,size=1536M,uuid=" SYSTEM_UUID \
> -	"name=vendor,size=256M,uuid=" VENDOR_UUID \
> -	"name=userdata,size=5341M,uuid=" USERDATA_UUID \
> +	"name=cache,size=256M,uuid=${uuid_gpt_cache};" \
> +	"name=system,size=1536M,uuid=${uuid_gpt_system};" \
> +	"name=vendor,size=256M,uuid=${uuid_gpt_vendor};" \
> +	"name=userdata,size=5341M,uuid={uuid_gpt_userdata};" \
>  	"name=rootfs,size=-,uuid=" ROOT_UUID
>  
>  
> diff --git a/include/configs/sei610.h b/include/configs/sei610.h
> index 6d13fd143b..baace75a02 100644
> --- a/include/configs/sei610.h
> +++ b/include/configs/sei610.h
> @@ -10,20 +10,16 @@
>  #define __CONFIG_H
>  
>  #define LOGO_UUID "43a3305d-150f-4cc9-bd3b-38fca8693846;"
> -#define CACHE_UUID "99207ae6-5207-11e9-999e-6f77a3612069;"
> -#define SYSTEM_UUID "99f9b7ac-5207-11e9-8507-c3c037e393f3;"
> -#define VENDOR_UUID "9d082802-5207-11e9-954c-cbbce08ba108;"
> -#define USERDATA_UUID "9b976e42-5207-11e9-8f16-ff47ac594b22;"
>  #define ROOT_UUID "ddb8c3f6-d94d-4394-b633-3134139cc2e0;"
>  
>  #define PARTS_DEFAULT \
>  	"uuid_disk=${uuid_gpt_disk};" \
>  	"name=boot,size=64M,bootable,uuid=${uuid_gpt_boot};" \
>  	"name=logo,size=2M,uuid=" LOGO_UUID \
> -	"name=cache,size=256M,uuid=" CACHE_UUID \
> -	"name=system,size=1536M,uuid=" SYSTEM_UUID \
> -	"name=vendor,size=256M,uuid=" VENDOR_UUID \
> -	"name=userdata,size=12795M,uuid=" USERDATA_UUID \
> +	"name=cache,size=256M,uuid=${uuid_gpt_cache};" \
> +	"name=system,size=1536M,uuid=${uuid_gpt_system};" \
> +	"name=vendor,size=256M,uuid=${uuid_gpt_vendor};" \
> +	"name=userdata,size=12795M,uuid=${uuid_gpt_userdata};" \
>  	"name=rootfs,size=-,uuid=" ROOT_UUID
>  
>  #include <configs/meson64_android.h>
> 

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

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

* Re: [PATCH 9/9] configs: sei510/610: android bootflow via abootimg
  2021-08-05 15:17 ` [PATCH 9/9] configs: sei510/610: android bootflow via abootimg Mattijs Korpershoek
@ 2021-08-05 16:21   ` Neil Armstrong
  0 siblings, 0 replies; 30+ messages in thread
From: Neil Armstrong @ 2021-08-05 16:21 UTC (permalink / raw)
  To: Mattijs Korpershoek; +Cc: u-boot-amlogic, u-boot, Guillaume La Roque

On 05/08/2021 17:17, Mattijs Korpershoek wrote:
> From: Guillaume La Roque <glaroque@baylibre.com>
> 
> Activate the following Kconfig options:
> * AVB       for Android Verified Boot support
> * ADTIMG    for merging DTBOs
> * ABOOTIMG  for extracting Android boot image
> 
> Also rework the partitioning tables:
> - add a misc partition to handle BCB messages
> - add a dtbo partition to store various DTBOs
> - add a vbmeta partition for AVB hashes
> - Merge vendor and system into the "super" partition
> 
> Note: avb support is disables by default. To activate it:
>  => setenv force_avb 1;
>  => saveenv;
> 
> Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
>  configs/sei510_defconfig |  5 +++++
>  configs/sei610_defconfig |  5 +++++
>  include/configs/sei510.h | 11 +++++++----
>  include/configs/sei610.h | 13 ++++++++-----
>  4 files changed, 25 insertions(+), 9 deletions(-)
> 
> diff --git a/configs/sei510_defconfig b/configs/sei510_defconfig
> index 74328f2fd4..8099b40b55 100644
> --- a/configs/sei510_defconfig
> +++ b/configs/sei510_defconfig
> @@ -20,7 +20,10 @@ CONFIG_PREBOOT="run load_logo"
>  # CONFIG_CONSOLE_MUX is not set
>  # CONFIG_DISPLAY_CPUINFO is not set
>  CONFIG_MISC_INIT_R=y
> +CONFIG_AVB_VERIFY=y
>  # CONFIG_CMD_BDI is not set
> +CONFIG_CMD_ADTIMG=y
> +CONFIG_CMD_ABOOTIMG=y
>  # CONFIG_CMD_IMI is not set
>  CONFIG_CMD_BCB=y
>  CONFIG_CMD_GPIO=y
> @@ -32,6 +35,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y
>  # CONFIG_CMD_SETEXPR is not set
>  CONFIG_CMD_BMP=y
>  CONFIG_CMD_REGULATOR=y
> +CONFIG_CMD_AVB=y
>  CONFIG_OF_CONTROL=y
>  CONFIG_ENV_IS_IN_MMC=y
>  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
> @@ -84,4 +88,5 @@ CONFIG_VIDEO_BMP_RLE8=y
>  CONFIG_BMP_16BPP=y
>  CONFIG_BMP_24BPP=y
>  CONFIG_BMP_32BPP=y
> +CONFIG_LIBAVB=y
>  CONFIG_OF_LIBFDT_OVERLAY=y
> diff --git a/configs/sei610_defconfig b/configs/sei610_defconfig
> index 2a6d0e5995..e11f36ac79 100644
> --- a/configs/sei610_defconfig
> +++ b/configs/sei610_defconfig
> @@ -20,7 +20,10 @@ CONFIG_PREBOOT="run load_logo"
>  # CONFIG_CONSOLE_MUX is not set
>  # CONFIG_DISPLAY_CPUINFO is not set
>  CONFIG_MISC_INIT_R=y
> +CONFIG_AVB_VERIFY=y
>  # CONFIG_CMD_BDI is not set
> +CONFIG_CMD_ADTIMG=y
> +CONFIG_CMD_ABOOTIMG=y
>  # CONFIG_CMD_IMI is not set
>  CONFIG_CMD_BCB=y
>  CONFIG_CMD_GPIO=y
> @@ -32,6 +35,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y
>  # CONFIG_CMD_SETEXPR is not set
>  CONFIG_CMD_BMP=y
>  CONFIG_CMD_REGULATOR=y
> +CONFIG_CMD_AVB=y
>  CONFIG_OF_CONTROL=y
>  CONFIG_ENV_IS_IN_MMC=y
>  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
> @@ -84,4 +88,5 @@ CONFIG_VIDEO_BMP_RLE8=y
>  CONFIG_BMP_16BPP=y
>  CONFIG_BMP_24BPP=y
>  CONFIG_BMP_32BPP=y
> +CONFIG_LIBAVB=y
>  CONFIG_OF_LIBFDT_OVERLAY=y
> diff --git a/include/configs/sei510.h b/include/configs/sei510.h
> index 5bf2668803..ea91a06157 100644
> --- a/include/configs/sei510.h
> +++ b/include/configs/sei510.h
> @@ -14,12 +14,15 @@
>  
>  #define PARTS_DEFAULT \
>  	"uuid_disk=${uuid_gpt_disk};" \
> -	"name=boot,size=64M,bootable,uuid=${uuid_gpt_boot};" \
>  	"name=logo,size=2M,uuid=" LOGO_UUID \
> +	"name=misc,size=128K,uuid=${uuid_gpt_misc};" \
> +	"name=dtbo,size=8M,uuid=${uuid_gpt_dtbo};" \
> +	"name=vbmeta,size=64K,uuid=${uuid_gpt_vbmeta};" \
> +	"name=boot,size=32M,bootable,uuid=${uuid_gpt_boot};" \
> +	"name=recovery,size=32M,uuid=${uuid_gpt_recovery};" \
>  	"name=cache,size=256M,uuid=${uuid_gpt_cache};" \
> -	"name=system,size=1536M,uuid=${uuid_gpt_system};" \
> -	"name=vendor,size=256M,uuid=${uuid_gpt_vendor};" \
> -	"name=userdata,size=5341M,uuid={uuid_gpt_userdata};" \
> +	"name=super,size=2304M,uuid=${uuid_gpt_super};" \
> +	"name=userdata,size=4820M,uuid=${uuid_gpt_userdata};" \
>  	"name=rootfs,size=-,uuid=" ROOT_UUID
>  
>  
> diff --git a/include/configs/sei610.h b/include/configs/sei610.h
> index baace75a02..783eece271 100644
> --- a/include/configs/sei610.h
> +++ b/include/configs/sei610.h
> @@ -14,12 +14,15 @@
>  
>  #define PARTS_DEFAULT \
>  	"uuid_disk=${uuid_gpt_disk};" \
> -	"name=boot,size=64M,bootable,uuid=${uuid_gpt_boot};" \
> -	"name=logo,size=2M,uuid=" LOGO_UUID \
> +	"name=logo,start=512K,size=2M,uuid=" LOGO_UUID \
> +	"name=misc,size=512K,uuid=${uuid_gpt_misc};" \
> +	"name=dtbo,size=8M,uuid=${uuid_gpt_dtbo};" \
> +	"name=vbmeta,size=512K,uuid=${uuid_gpt_vbmeta};" \
> +	"name=boot,size=32M,bootable,uuid=${uuid_gpt_boot};" \
> +	"name=recovery,size=32M,uuid=${uuid_gpt_recovery};" \
>  	"name=cache,size=256M,uuid=${uuid_gpt_cache};" \
> -	"name=system,size=1536M,uuid=${uuid_gpt_system};" \
> -	"name=vendor,size=256M,uuid=${uuid_gpt_vendor};" \
> -	"name=userdata,size=12795M,uuid=${uuid_gpt_userdata};" \
> +	"name=super,size=2304M,uuid=${uuid_gpt_super};" \
> +	"name=userdata,size=12274M,uuid=${uuid_gpt_userdata};" \
>  	"name=rootfs,size=-,uuid=" ROOT_UUID
>  
>  #include <configs/meson64_android.h>
> 

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

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

* Re: [PATCH 1/9] configs: meson64: permit redefining SYS_MALLOC_LEN
  2021-08-05 16:20   ` Neil Armstrong
@ 2021-08-05 17:16     ` Tom Rini
  2021-08-06  7:54       ` Neil Armstrong
  0 siblings, 1 reply; 30+ messages in thread
From: Tom Rini @ 2021-08-05 17:16 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: Mattijs Korpershoek, u-boot-amlogic, u-boot, Guillaume La Roque

[-- Attachment #1: Type: text/plain, Size: 1253 bytes --]

On Thu, Aug 05, 2021 at 06:20:53PM +0200, Neil Armstrong wrote:
> On 05/08/2021 17:17, Mattijs Korpershoek wrote:
> > Permit redefining SYS_MALLOC_LEN for board specific configs.
> > This is especially useful for Android with AVB, which requires a malloc
> > length of 128M.
> > 
> > Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
> > Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> > ---
> >  include/configs/meson64.h | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/include/configs/meson64.h b/include/configs/meson64.h
> > index fb7f16d148..f9bb0240d2 100644
> > --- a/include/configs/meson64.h
> > +++ b/include/configs/meson64.h
> > @@ -32,7 +32,9 @@
> >  #define CONFIG_CPU_ARMV8
> >  #define CONFIG_REMAKE_ELF
> >  #define CONFIG_SYS_MAXARGS		32
> > +#ifndef CONFIG_SYS_MALLOC_LEN
> >  #define CONFIG_SYS_MALLOC_LEN		(32 << 20)
> > +#endif
> >  #define CONFIG_SYS_CBSIZE		1024
> >  
> >  #define CONFIG_SYS_SDRAM_BASE		0
> > 
> 
> Acked-by: Neil Armstrong <narmstrong@baylibre.com>

I prefer to see these as SZ_xxx, but also what's the minimum DRAM you're
going to see on a meson64 platform?  And if it's 1GB or more, why not
just use 128MB for everyone?

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH 0/9] meson64_android: Android boot flow using abootimg
  2021-08-05 15:17 [PATCH 0/9] meson64_android: Android boot flow using abootimg Mattijs Korpershoek
                   ` (8 preceding siblings ...)
  2021-08-05 15:17 ` [PATCH 9/9] configs: sei510/610: android bootflow via abootimg Mattijs Korpershoek
@ 2021-08-05 17:23 ` Tom Rini
  2021-08-06  7:57   ` Neil Armstrong
  2021-08-10  8:47 ` Neil Armstrong
  10 siblings, 1 reply; 30+ messages in thread
From: Tom Rini @ 2021-08-05 17:23 UTC (permalink / raw)
  To: Mattijs Korpershoek; +Cc: Neil Armstrong, u-boot-amlogic, u-boot

[-- Attachment #1: Type: text/plain, Size: 1552 bytes --]

On Thu, Aug 05, 2021 at 05:17:19PM +0200, Mattijs Korpershoek wrote:

> The SEI-610 and SEI-510 boards are well supported in the
> Android Open Source project via the yukawa [1] platform.
> 
> Their U-Boot version, despite being public [2] is not in mainline.
> 
> Android 10 and higher have significantly reworked the bootloader
> requirements:
> 
> * bootloader should pass slot information in case of A/B
> * bootloader should perform AVB verification in case it's supported
> * bootloader should read and apply dtb overlays from a dtbo partition
> 
> These series add support for all the above.
> 
> [1] https://android.googlesource.com/device/amlogic/yukawa
> [2] https://gitlab.com/baylibre/amlogic/atv/u-boot/-/tree/u-boot/v2021.07/integ

My high level concern with this series is that it takes what I assume is
the Android-only boot path, and adds further abstractions to it, it
looks like.  Can we just say "Here is the Android 10 boot path" (since
AVB has been around for a while) and here is the generic distro boot
path for non-Android?  Reading this over it looks like it becomes "Here
is the Android + AVB boot path", "Here is the Androidd non-AVB boot
path" and then I assume "Here is the generic distro boot path".

I'd also like to know if in general we can make some generic environment
macros for "Here is Android AVB boot path", so that we don't need to
duplicate this between SoCs.  At the very high level, something like the
generic distro boot framework, but that does Android instead.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH 1/9] configs: meson64: permit redefining SYS_MALLOC_LEN
  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:46         ` Tom Rini
  0 siblings, 2 replies; 30+ messages in thread
From: Neil Armstrong @ 2021-08-06  7:54 UTC (permalink / raw)
  To: Tom Rini; +Cc: Mattijs Korpershoek, u-boot-amlogic, u-boot, Guillaume La Roque

On 05/08/2021 19:16, Tom Rini wrote:
> On Thu, Aug 05, 2021 at 06:20:53PM +0200, Neil Armstrong wrote:
>> On 05/08/2021 17:17, Mattijs Korpershoek wrote:
>>> Permit redefining SYS_MALLOC_LEN for board specific configs.
>>> This is especially useful for Android with AVB, which requires a malloc
>>> length of 128M.
>>>
>>> Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
>>> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
>>> ---
>>>  include/configs/meson64.h | 2 ++
>>>  1 file changed, 2 insertions(+)
>>>
>>> diff --git a/include/configs/meson64.h b/include/configs/meson64.h
>>> index fb7f16d148..f9bb0240d2 100644
>>> --- a/include/configs/meson64.h
>>> +++ b/include/configs/meson64.h
>>> @@ -32,7 +32,9 @@
>>>  #define CONFIG_CPU_ARMV8
>>>  #define CONFIG_REMAKE_ELF
>>>  #define CONFIG_SYS_MAXARGS		32
>>> +#ifndef CONFIG_SYS_MALLOC_LEN
>>>  #define CONFIG_SYS_MALLOC_LEN		(32 << 20)
>>> +#endif
>>>  #define CONFIG_SYS_CBSIZE		1024
>>>  
>>>  #define CONFIG_SYS_SDRAM_BASE		0
>>>
>>
>> Acked-by: Neil Armstrong <narmstrong@baylibre.com>
> 
> I prefer to see these as SZ_xxx, but also what's the minimum DRAM you're
> going to see on a meson64 platform?  And if it's 1GB or more, why not
> just use 128MB for everyone?
> 

We can get down to 256MiB DRAM (very rare), but 512MiB is used on La Frite.

Neil

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

* Re: [PATCH 0/9] meson64_android: Android boot flow using abootimg
  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
  0 siblings, 1 reply; 30+ messages in thread
From: Neil Armstrong @ 2021-08-06  7:57 UTC (permalink / raw)
  To: Tom Rini, Mattijs Korpershoek; +Cc: u-boot-amlogic, u-boot

On 05/08/2021 19:23, Tom Rini wrote:
> On Thu, Aug 05, 2021 at 05:17:19PM +0200, Mattijs Korpershoek wrote:
> 
>> The SEI-610 and SEI-510 boards are well supported in the
>> Android Open Source project via the yukawa [1] platform.
>>
>> Their U-Boot version, despite being public [2] is not in mainline.
>>
>> Android 10 and higher have significantly reworked the bootloader
>> requirements:
>>
>> * bootloader should pass slot information in case of A/B
>> * bootloader should perform AVB verification in case it's supported
>> * bootloader should read and apply dtb overlays from a dtbo partition
>>
>> These series add support for all the above.
>>
>> [1] https://android.googlesource.com/device/amlogic/yukawa
>> [2] https://gitlab.com/baylibre/amlogic/atv/u-boot/-/tree/u-boot/v2021.07/integ
> 
> My high level concern with this series is that it takes what I assume is
> the Android-only boot path, and adds further abstractions to it, it
> looks like.  Can we just say "Here is the Android 10 boot path" (since
> AVB has been around for a while) and here is the generic distro boot
> path for non-Android?  Reading this over it looks like it becomes "Here
> is the Android + AVB boot path", "Here is the Androidd non-AVB boot
> path" and then I assume "Here is the generic distro boot path".
> 
> I'd also like to know if in general we can make some generic environment
> macros for "Here is Android AVB boot path", so that we don't need to
> duplicate this between SoCs.  At the very high level, something like the
> generic distro boot framework, but that does Android instead.
> 

We've been thinking about that, but the Android boot flow doesn't really leave place
for other methods.

In our implementation we decided to use the distro_bootcmd helper to setup the different
Android boot flow steps, it permits to have a much simpler cmd definition than the other
implementation, but makes mixing with the default boot steps more complex (or maybe there
is something we can use to enable/disable easily some distro BOOT_TARGET_DEVICES ?)

Neil

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

* Re: [PATCH 1/9] configs: meson64: permit redefining SYS_MALLOC_LEN
  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
  1 sibling, 1 reply; 30+ messages in thread
From: Mattijs Korpershoek @ 2021-08-06  9:24 UTC (permalink / raw)
  To: Neil Armstrong, Tom Rini; +Cc: u-boot-amlogic, u-boot, Guillaume La Roque

Hi Tom, Neil,

Neil Armstrong <narmstrong@baylibre.com> writes:

> On 05/08/2021 19:16, Tom Rini wrote:
>> On Thu, Aug 05, 2021 at 06:20:53PM +0200, Neil Armstrong wrote:
>>> On 05/08/2021 17:17, Mattijs Korpershoek wrote:
>>>> Permit redefining SYS_MALLOC_LEN for board specific configs.
>>>> This is especially useful for Android with AVB, which requires a malloc
>>>> length of 128M.
>>>>
>>>> Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
>>>> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
>>>> ---
>>>>  include/configs/meson64.h | 2 ++
>>>>  1 file changed, 2 insertions(+)
>>>>
>>>> diff --git a/include/configs/meson64.h b/include/configs/meson64.h
>>>> index fb7f16d148..f9bb0240d2 100644
>>>> --- a/include/configs/meson64.h
>>>> +++ b/include/configs/meson64.h
>>>> @@ -32,7 +32,9 @@
>>>>  #define CONFIG_CPU_ARMV8
>>>>  #define CONFIG_REMAKE_ELF
>>>>  #define CONFIG_SYS_MAXARGS		32
>>>> +#ifndef CONFIG_SYS_MALLOC_LEN
>>>>  #define CONFIG_SYS_MALLOC_LEN		(32 << 20)
>>>> +#endif
>>>>  #define CONFIG_SYS_CBSIZE		1024
>>>>  
>>>>  #define CONFIG_SYS_SDRAM_BASE		0
>>>>
>>>
>>> Acked-by: Neil Armstrong <narmstrong@baylibre.com>
>> 
>> I prefer to see these as SZ_xxx, but also what's the minimum DRAM you're
>> going to see on a meson64 platform?  And if it's 1GB or more, why not
>> just use 128MB for everyone?
>> 
>
> We can get down to 256MiB DRAM (very rare), but 512MiB is used on La Frite.
In that case, I think it's more reasonable to keep the change as-is.
I'll send a v2 replacing (32 << 20) by SZ_32M

Do you agree ?

Mattijs

>
> Neil

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

* Re: [PATCH 1/9] configs: meson64: permit redefining SYS_MALLOC_LEN
  2021-08-06  7:54       ` Neil Armstrong
  2021-08-06  9:24         ` Mattijs Korpershoek
@ 2021-08-06 12:46         ` Tom Rini
  1 sibling, 0 replies; 30+ messages in thread
From: Tom Rini @ 2021-08-06 12:46 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: Mattijs Korpershoek, u-boot-amlogic, u-boot, Guillaume La Roque

[-- Attachment #1: Type: text/plain, Size: 1538 bytes --]

On Fri, Aug 06, 2021 at 09:54:10AM +0200, Neil Armstrong wrote:
> On 05/08/2021 19:16, Tom Rini wrote:
> > On Thu, Aug 05, 2021 at 06:20:53PM +0200, Neil Armstrong wrote:
> >> On 05/08/2021 17:17, Mattijs Korpershoek wrote:
> >>> Permit redefining SYS_MALLOC_LEN for board specific configs.
> >>> This is especially useful for Android with AVB, which requires a malloc
> >>> length of 128M.
> >>>
> >>> Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
> >>> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> >>> ---
> >>>  include/configs/meson64.h | 2 ++
> >>>  1 file changed, 2 insertions(+)
> >>>
> >>> diff --git a/include/configs/meson64.h b/include/configs/meson64.h
> >>> index fb7f16d148..f9bb0240d2 100644
> >>> --- a/include/configs/meson64.h
> >>> +++ b/include/configs/meson64.h
> >>> @@ -32,7 +32,9 @@
> >>>  #define CONFIG_CPU_ARMV8
> >>>  #define CONFIG_REMAKE_ELF
> >>>  #define CONFIG_SYS_MAXARGS		32
> >>> +#ifndef CONFIG_SYS_MALLOC_LEN
> >>>  #define CONFIG_SYS_MALLOC_LEN		(32 << 20)
> >>> +#endif
> >>>  #define CONFIG_SYS_CBSIZE		1024
> >>>  
> >>>  #define CONFIG_SYS_SDRAM_BASE		0
> >>>
> >>
> >> Acked-by: Neil Armstrong <narmstrong@baylibre.com>
> > 
> > I prefer to see these as SZ_xxx, but also what's the minimum DRAM you're
> > going to see on a meson64 platform?  And if it's 1GB or more, why not
> > just use 128MB for everyone?
> > 
> 
> We can get down to 256MiB DRAM (very rare), but 512MiB is used on La Frite.

OK, thanks. 

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH 1/9] configs: meson64: permit redefining SYS_MALLOC_LEN
  2021-08-06  9:24         ` Mattijs Korpershoek
@ 2021-08-06 12:47           ` Tom Rini
  0 siblings, 0 replies; 30+ messages in thread
From: Tom Rini @ 2021-08-06 12:47 UTC (permalink / raw)
  To: Mattijs Korpershoek
  Cc: Neil Armstrong, u-boot-amlogic, u-boot, Guillaume La Roque

[-- Attachment #1: Type: text/plain, Size: 1829 bytes --]

On Fri, Aug 06, 2021 at 11:24:54AM +0200, Mattijs Korpershoek wrote:
> Hi Tom, Neil,
> 
> Neil Armstrong <narmstrong@baylibre.com> writes:
> 
> > On 05/08/2021 19:16, Tom Rini wrote:
> >> On Thu, Aug 05, 2021 at 06:20:53PM +0200, Neil Armstrong wrote:
> >>> On 05/08/2021 17:17, Mattijs Korpershoek wrote:
> >>>> Permit redefining SYS_MALLOC_LEN for board specific configs.
> >>>> This is especially useful for Android with AVB, which requires a malloc
> >>>> length of 128M.
> >>>>
> >>>> Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
> >>>> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> >>>> ---
> >>>>  include/configs/meson64.h | 2 ++
> >>>>  1 file changed, 2 insertions(+)
> >>>>
> >>>> diff --git a/include/configs/meson64.h b/include/configs/meson64.h
> >>>> index fb7f16d148..f9bb0240d2 100644
> >>>> --- a/include/configs/meson64.h
> >>>> +++ b/include/configs/meson64.h
> >>>> @@ -32,7 +32,9 @@
> >>>>  #define CONFIG_CPU_ARMV8
> >>>>  #define CONFIG_REMAKE_ELF
> >>>>  #define CONFIG_SYS_MAXARGS		32
> >>>> +#ifndef CONFIG_SYS_MALLOC_LEN
> >>>>  #define CONFIG_SYS_MALLOC_LEN		(32 << 20)
> >>>> +#endif
> >>>>  #define CONFIG_SYS_CBSIZE		1024
> >>>>  
> >>>>  #define CONFIG_SYS_SDRAM_BASE		0
> >>>>
> >>>
> >>> Acked-by: Neil Armstrong <narmstrong@baylibre.com>
> >> 
> >> I prefer to see these as SZ_xxx, but also what's the minimum DRAM you're
> >> going to see on a meson64 platform?  And if it's 1GB or more, why not
> >> just use 128MB for everyone?
> >> 
> >
> > We can get down to 256MiB DRAM (very rare), but 512MiB is used on La Frite.
> In that case, I think it's more reasonable to keep the change as-is.
> I'll send a v2 replacing (32 << 20) by SZ_32M

tbh, using SZ_xxx isn't a big enough issue to v2 things over.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH 0/9] meson64_android: Android boot flow using abootimg
  2021-08-06  7:57   ` Neil Armstrong
@ 2021-08-06 15:36     ` Mattijs Korpershoek
  2021-08-06 15:56       ` Tom Rini
  0 siblings, 1 reply; 30+ messages in thread
From: Mattijs Korpershoek @ 2021-08-06 15:36 UTC (permalink / raw)
  To: Neil Armstrong, Tom Rini; +Cc: u-boot-amlogic, u-boot

Hi Neil, Tom,

Neil Armstrong <narmstrong@baylibre.com> writes:

> On 05/08/2021 19:23, Tom Rini wrote:
>> On Thu, Aug 05, 2021 at 05:17:19PM +0200, Mattijs Korpershoek wrote:
>> 
>>> The SEI-610 and SEI-510 boards are well supported in the
>>> Android Open Source project via the yukawa [1] platform.
>>>
>>> Their U-Boot version, despite being public [2] is not in mainline.
>>>
>>> Android 10 and higher have significantly reworked the bootloader
>>> requirements:
>>>
>>> * bootloader should pass slot information in case of A/B
>>> * bootloader should perform AVB verification in case it's supported
>>> * bootloader should read and apply dtb overlays from a dtbo partition
>>>
>>> These series add support for all the above.
>>>
>>> [1] https://android.googlesource.com/device/amlogic/yukawa
>>> [2] https://gitlab.com/baylibre/amlogic/atv/u-boot/-/tree/u-boot/v2021.07/integ
>> 
>> My high level concern with this series is that it takes what I assume is
>> the Android-only boot path, and adds further abstractions to it, it
>> looks like.  Can we just say "Here is the Android 10 boot path" (since
>> AVB has been around for a while) and here is the generic distro boot
>> path for non-Android?  Reading this over it looks like it becomes "Here
>> is the Android + AVB boot path", "Here is the Androidd non-AVB boot
>> path" and then I assume "Here is the generic distro boot path".
Not exactly. Android supports multiple combinations:
- non-AVB + no-A/B  (legacy, no security). This is usually used for
development builds
- AVB + no-A/B
- AVB + A/B
Here, we should be supporting all of the above using compile flags.
>> 
>> I'd also like to know if in general we can make some generic environment
>> macros for "Here is Android AVB boot path", so that we don't need to
>> duplicate this between SoCs.  At the very high level, something like the
>> generic distro boot framework, but that does Android instead.
I agree. It would be really nice if we could have a generic "boot android" framework

TI has a ti_omap5_common.h which seems to support similar things.
However, it does not support the "no-A/B" mode.
In that file, we can also see board specific logic: namely the mapping
between the $board_name and the dtbo index passed to "abootimg".

Google has another approach via the boot_android[1] command.

We will keep looking into this.

For now, we have mostly worked on cleaning up/syncing the downstream [1]
yukawa tree in order to enable AOSP users to rebuild their U-Boot from mainline.

[1] http://patchwork.ozlabs.org/project/uboot/patch/20170402084952.5102-7-deymo@google.com/
[2] https://gitlab.com/baylibre/amlogic/atv/u-boot/-/tree/u-boot/v2021.07/integ
>> 
>
> We've been thinking about that, but the Android boot flow doesn't really leave place
> for other methods.
>
> In our implementation we decided to use the distro_bootcmd helper to setup the different
> Android boot flow steps, it permits to have a much simpler cmd definition than the other
> implementation, but makes mixing with the default boot steps more complex (or maybe there
> is something we can use to enable/disable easily some distro BOOT_TARGET_DEVICES ?)
>
> Neil

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

* Re: [PATCH 0/9] meson64_android: Android boot flow using abootimg
  2021-08-06 15:36     ` Mattijs Korpershoek
@ 2021-08-06 15:56       ` Tom Rini
  2021-08-10  8:41         ` Neil Armstrong
  0 siblings, 1 reply; 30+ messages in thread
From: Tom Rini @ 2021-08-06 15:56 UTC (permalink / raw)
  To: Mattijs Korpershoek; +Cc: Neil Armstrong, u-boot-amlogic, u-boot

[-- Attachment #1: Type: text/plain, Size: 2720 bytes --]

On Fri, Aug 06, 2021 at 05:36:41PM +0200, Mattijs Korpershoek wrote:
> Hi Neil, Tom,
> 
> Neil Armstrong <narmstrong@baylibre.com> writes:
> 
> > On 05/08/2021 19:23, Tom Rini wrote:
> >> On Thu, Aug 05, 2021 at 05:17:19PM +0200, Mattijs Korpershoek wrote:
> >> 
> >>> The SEI-610 and SEI-510 boards are well supported in the
> >>> Android Open Source project via the yukawa [1] platform.
> >>>
> >>> Their U-Boot version, despite being public [2] is not in mainline.
> >>>
> >>> Android 10 and higher have significantly reworked the bootloader
> >>> requirements:
> >>>
> >>> * bootloader should pass slot information in case of A/B
> >>> * bootloader should perform AVB verification in case it's supported
> >>> * bootloader should read and apply dtb overlays from a dtbo partition
> >>>
> >>> These series add support for all the above.
> >>>
> >>> [1] https://android.googlesource.com/device/amlogic/yukawa
> >>> [2] https://gitlab.com/baylibre/amlogic/atv/u-boot/-/tree/u-boot/v2021.07/integ
> >> 
> >> My high level concern with this series is that it takes what I assume is
> >> the Android-only boot path, and adds further abstractions to it, it
> >> looks like.  Can we just say "Here is the Android 10 boot path" (since
> >> AVB has been around for a while) and here is the generic distro boot
> >> path for non-Android?  Reading this over it looks like it becomes "Here
> >> is the Android + AVB boot path", "Here is the Androidd non-AVB boot
> >> path" and then I assume "Here is the generic distro boot path".
> Not exactly. Android supports multiple combinations:
> - non-AVB + no-A/B  (legacy, no security). This is usually used for
> development builds
> - AVB + no-A/B
> - AVB + A/B
> Here, we should be supporting all of the above using compile flags.
> >> 
> >> I'd also like to know if in general we can make some generic environment
> >> macros for "Here is Android AVB boot path", so that we don't need to
> >> duplicate this between SoCs.  At the very high level, something like the
> >> generic distro boot framework, but that does Android instead.
> I agree. It would be really nice if we could have a generic "boot android" framework
> 
> TI has a ti_omap5_common.h which seems to support similar things.
> However, it does not support the "no-A/B" mode.
> In that file, we can also see board specific logic: namely the mapping
> between the $board_name and the dtbo index passed to "abootimg".
> 
> Google has another approach via the boot_android[1] command.

I guess I'm a little disappointed that there was no follow up to the
question about boot_android.  I would like to see the Android support
made easier to work with.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH 0/9] meson64_android: Android boot flow using abootimg
  2021-08-06 15:56       ` Tom Rini
@ 2021-08-10  8:41         ` Neil Armstrong
  0 siblings, 0 replies; 30+ messages in thread
From: Neil Armstrong @ 2021-08-10  8:41 UTC (permalink / raw)
  To: Tom Rini, Mattijs Korpershoek; +Cc: u-boot-amlogic, u-boot

Hi,

On 06/08/2021 17:56, Tom Rini wrote:
> On Fri, Aug 06, 2021 at 05:36:41PM +0200, Mattijs Korpershoek wrote:
>> Hi Neil, Tom,
>>
>> Neil Armstrong <narmstrong@baylibre.com> writes:
>>
>>> On 05/08/2021 19:23, Tom Rini wrote:
>>>> On Thu, Aug 05, 2021 at 05:17:19PM +0200, Mattijs Korpershoek wrote:
>>>>
>>>>> The SEI-610 and SEI-510 boards are well supported in the
>>>>> Android Open Source project via the yukawa [1] platform.
>>>>>
>>>>> Their U-Boot version, despite being public [2] is not in mainline.
>>>>>
>>>>> Android 10 and higher have significantly reworked the bootloader
>>>>> requirements:
>>>>>
>>>>> * bootloader should pass slot information in case of A/B
>>>>> * bootloader should perform AVB verification in case it's supported
>>>>> * bootloader should read and apply dtb overlays from a dtbo partition
>>>>>
>>>>> These series add support for all the above.
>>>>>
>>>>> [1] https://android.googlesource.com/device/amlogic/yukawa
>>>>> [2] https://gitlab.com/baylibre/amlogic/atv/u-boot/-/tree/u-boot/v2021.07/integ
>>>>
>>>> My high level concern with this series is that it takes what I assume is
>>>> the Android-only boot path, and adds further abstractions to it, it
>>>> looks like.  Can we just say "Here is the Android 10 boot path" (since
>>>> AVB has been around for a while) and here is the generic distro boot
>>>> path for non-Android?  Reading this over it looks like it becomes "Here
>>>> is the Android + AVB boot path", "Here is the Androidd non-AVB boot
>>>> path" and then I assume "Here is the generic distro boot path".
>> Not exactly. Android supports multiple combinations:
>> - non-AVB + no-A/B  (legacy, no security). This is usually used for
>> development builds
>> - AVB + no-A/B
>> - AVB + A/B
>> Here, we should be supporting all of the above using compile flags.
>>>>
>>>> I'd also like to know if in general we can make some generic environment
>>>> macros for "Here is Android AVB boot path", so that we don't need to
>>>> duplicate this between SoCs.  At the very high level, something like the
>>>> generic distro boot framework, but that does Android instead.
>> I agree. It would be really nice if we could have a generic "boot android" framework
>>
>> TI has a ti_omap5_common.h which seems to support similar things.
>> However, it does not support the "no-A/B" mode.
>> In that file, we can also see board specific logic: namely the mapping
>> between the $board_name and the dtbo index passed to "abootimg".
>>
>> Google has another approach via the boot_android[1] command.
> 
> I guess I'm a little disappointed that there was no follow up to the
> question about boot_android.  I would like to see the Android support
> made easier to work with.
> 

We share the same disappointment, the Android boot flow is incredibly hard
to implement and test. And completely changes in incompatible ways between
new releases.

Neil

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

* Re: [PATCH 0/9] meson64_android: Android boot flow using abootimg
  2021-08-05 15:17 [PATCH 0/9] meson64_android: Android boot flow using abootimg Mattijs Korpershoek
                   ` (9 preceding siblings ...)
  2021-08-05 17:23 ` [PATCH 0/9] meson64_android: Android boot flow using abootimg Tom Rini
@ 2021-08-10  8:47 ` Neil Armstrong
  10 siblings, 0 replies; 30+ messages in thread
From: Neil Armstrong @ 2021-08-10  8:47 UTC (permalink / raw)
  To: Mattijs Korpershoek; +Cc: u-boot-amlogic, u-boot

On 05/08/2021 17:17, Mattijs Korpershoek wrote:
> The SEI-610 and SEI-510 boards are well supported in the
> Android Open Source project via the yukawa [1] platform.
> 
> Their U-Boot version, despite being public [2] is not in mainline.
> 
> Android 10 and higher have significantly reworked the bootloader
> requirements:
> 
> * bootloader should pass slot information in case of A/B
> * bootloader should perform AVB verification in case it's supported
> * bootloader should read and apply dtb overlays from a dtbo partition
> 
> These series add support for all the above.
> 
> [1] https://android.googlesource.com/device/amlogic/yukawa
> [2] https://gitlab.com/baylibre/amlogic/atv/u-boot/-/tree/u-boot/v2021.07/integ
> 
> Guillaume La Roque (2):
>   configs: meson64_android: boot android via abootimg
>   configs: sei510/610: android bootflow via abootimg
> 
> Mattijs Korpershoek (7):
>   configs: meson64: permit redefining SYS_MALLOC_LEN
>   configs: meson64_android: increase SYS_MALLOC_LEN to 128M for AVB
>   configs: meson64_android: implement AVB support
>   configs: meson64_android: implement A/B slot support
>   configs: meson64_android: define BOOT_CMD macro
>   configs: sei510/sei610: reformat PARTS_default
>   configs: sei510/sei610: don't use hard-coded gpt uuids
> 
>  configs/sei510_defconfig          |   5 ++
>  configs/sei610_defconfig          |   5 ++
>  include/configs/meson64.h         |   2 +
>  include/configs/meson64_android.h | 139 ++++++++++++++++++++++++++++--
>  include/configs/sei510.h          |  23 +++--
>  include/configs/sei610.h          |  23 +++--
>  6 files changed, 165 insertions(+), 32 deletions(-)
> 

Applied to u-boot-amlogic

Thanks,
Neil

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

end of thread, other threads:[~2021-08-10  8:47 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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.