[PATCH 0/6] VIM3: misc cleanups to prepare android support

The Khadas VIM3 and VIM3L 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.
These series a couple of cleanups to prepare to add mainline U-Boot support for vim3 / vim3l so that we can boot Android.
[1] https://source.android.com/setup/build/devices#vim3_and_vim3l_boards [2] https://gitlab.com/baylibre/amlogic/atv/u-boot/-/tree/u-boot/v2021.07/integ
Mattijs Korpershoek (6): configs: sei610: fix typo in header comment configs: meson64_android: fix bad indent in EXTRA_ENV_SETTINGS configs: meson64_android: use CONFIG_FASTBOOT_USB_DEV configs: meson64_android: use boot part label instead of index configs: meson64_android: use logo part label instead of index configs: meson64_android: don't set console bootargs
include/configs/meson64_android.h | 30 +++++++++++++++++------------- include/configs/sei610.h | 2 +- 2 files changed, 18 insertions(+), 14 deletions(-)

s/510/610/
Signed-off-by: Guillaume La Roque glaroque@baylibre.com Signed-off-by: Mattijs Korpershoek mkorpershoek@baylibre.com --- include/configs/sei610.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/sei610.h b/include/configs/sei610.h index 6d093161c9..9eeffdd72c 100644 --- a/include/configs/sei610.h +++ b/include/configs/sei610.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0+ */ /* - * Configuration for the SEI510 + * Configuration for the SEI610 * * Copyright (C) 2019 Baylibre, SAS * Author: Jerome Brunet jbrunet@baylibre.com

On 29/07/2021 09:21, Mattijs Korpershoek wrote:
s/510/610/
Signed-off-by: Guillaume La Roque glaroque@baylibre.com Signed-off-by: Mattijs Korpershoek mkorpershoek@baylibre.com
include/configs/sei610.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/sei610.h b/include/configs/sei610.h index 6d093161c9..9eeffdd72c 100644 --- a/include/configs/sei610.h +++ b/include/configs/sei610.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0+ */ /*
- Configuration for the SEI510
- Configuration for the SEI610
- Copyright (C) 2019 Baylibre, SAS
- Author: Jerome Brunet jbrunet@baylibre.com
Acked-by: Neil Armstrong narmstrong@baylibre.com

both lines seem to be joined together which is not the case for the meson64.h EXTRA_ENV_SETTINGS.
Add a newline for consistency.
Signed-off-by: Guillaume La Roque mkorpershoek@baylibre.com Signed-off-by: Mattijs Korpershoek mkorpershoek@baylibre.com --- include/configs/meson64_android.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/configs/meson64_android.h b/include/configs/meson64_android.h index c47d51c853..661de76fd7 100644 --- a/include/configs/meson64_android.h +++ b/include/configs/meson64_android.h @@ -127,7 +127,8 @@ "kernel_addr_r=0x01080000\0" \ "pxefile_addr_r=0x01080000\0" \ "ramdisk_addr_r=0x13000000\0" \ - "fdtfile=amlogic/" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" BOOTENV + "fdtfile=amlogic/" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \ + BOOTENV
#include <configs/meson64.h>

On 29/07/2021 09:21, Mattijs Korpershoek wrote:
both lines seem to be joined together which is not the case for the meson64.h EXTRA_ENV_SETTINGS.
Add a newline for consistency.
Signed-off-by: Guillaume La Roque mkorpershoek@baylibre.com Signed-off-by: Mattijs Korpershoek mkorpershoek@baylibre.com
include/configs/meson64_android.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/configs/meson64_android.h b/include/configs/meson64_android.h index c47d51c853..661de76fd7 100644 --- a/include/configs/meson64_android.h +++ b/include/configs/meson64_android.h @@ -127,7 +127,8 @@ "kernel_addr_r=0x01080000\0" \ "pxefile_addr_r=0x01080000\0" \ "ramdisk_addr_r=0x13000000\0" \
- "fdtfile=amlogic/" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" BOOTENV
- "fdtfile=amlogic/" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
- BOOTENV
#include <configs/meson64.h>
Acked-by: Neil Armstrong narmstrong@baylibre.com

Right now, when running fastboot we use a hard-coded "0" for the device number.
Use the Kconfig option named CONFIG_FASTBOOT_USB_DEV instead.
Signed-off-by: Guillaume La Roque mkorpershoek@baylibre.com Signed-off-by: Mattijs Korpershoek mkorpershoek@baylibre.com --- include/configs/meson64_android.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/configs/meson64_android.h b/include/configs/meson64_android.h index 661de76fd7..4027a7fe0d 100644 --- a/include/configs/meson64_android.h +++ b/include/configs/meson64_android.h @@ -38,7 +38,7 @@ "fi;" \ "if test "${run_fastboot}" -eq 1; then " \ "echo Running Fastboot...;" \ - "fastboot 0;" \ + "fastboot " __stringify(CONFIG_FASTBOOT_USB_DEV) "; " \ "fi\0"
#define BOOTENV_DEV_NAME_FASTBOOT(devtypeu, devtypel, instance) \ @@ -69,7 +69,7 @@ "fi;" \ "if test "${run_recovery}" -eq 1; then " \ "echo Running Recovery...;" \ - "fastboot 0;" \ + "fastboot " __stringify(CONFIG_FASTBOOT_USB_DEV) "; " \ "fi\0"
#define BOOTENV_DEV_NAME_RECOVERY(devtypeu, devtypel, instance) \

On 29/07/2021 09:21, Mattijs Korpershoek wrote:
Right now, when running fastboot we use a hard-coded "0" for the device number.
Use the Kconfig option named CONFIG_FASTBOOT_USB_DEV instead.
Signed-off-by: Guillaume La Roque mkorpershoek@baylibre.com Signed-off-by: Mattijs Korpershoek mkorpershoek@baylibre.com
include/configs/meson64_android.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/configs/meson64_android.h b/include/configs/meson64_android.h index 661de76fd7..4027a7fe0d 100644 --- a/include/configs/meson64_android.h +++ b/include/configs/meson64_android.h @@ -38,7 +38,7 @@ "fi;" \ "if test "${run_fastboot}" -eq 1; then " \ "echo Running Fastboot...;" \
"fastboot 0;" \
"fi\0""fastboot " __stringify(CONFIG_FASTBOOT_USB_DEV) "; " \
#define BOOTENV_DEV_NAME_FASTBOOT(devtypeu, devtypel, instance) \ @@ -69,7 +69,7 @@ "fi;" \ "if test "${run_recovery}" -eq 1; then " \ "echo Running Recovery...;" \
"fastboot 0;" \
"fi\0""fastboot " __stringify(CONFIG_FASTBOOT_USB_DEV) "; " \
#define BOOTENV_DEV_NAME_RECOVERY(devtypeu, devtypel, instance) \
Acked-by: Neil Armstrong narmstrong@baylibre.com

To boot Android, we read the gpt and assume that the partition with index "1" will be the "boot" partition.
This might not always be the case, as there are no requirements from Android on the partition order.
However, Android does seem to use the "boot" label quite a lot on their public documentation [1]
Load the boot partition by label instead of by index
[1] https://source.android.com/devices/bootloader/partitions Signed-off-by: Guillaume La Roque mkorpershoek@baylibre.com Signed-off-by: Mattijs Korpershoek mkorpershoek@baylibre.com --- include/configs/meson64_android.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/include/configs/meson64_android.h b/include/configs/meson64_android.h index 4027a7fe0d..e22f05c889 100644 --- a/include/configs/meson64_android.h +++ b/include/configs/meson64_android.h @@ -9,6 +9,9 @@ #ifndef __MESON64_ANDROID_CONFIG_H #define __MESON64_ANDROID_CONFIG_H
+#ifndef BOOT_PARTITION +#define BOOT_PARTITION "boot" +#endif
#define BOOTENV_DEV_FASTBOOT(devtypeu, devtypel, instance) \ "bootcmd_fastboot=" \ @@ -77,11 +80,11 @@
#define BOOTENV_DEV_SYSTEM(devtypeu, devtypel, instance) \ "bootcmd_system=" \ - "echo Loading Android boot partition...;" \ + "echo Loading Android " BOOT_PARTITION " partition...;" \ "mmc dev ${mmcdev};" \ "setenv bootargs ${bootargs} console=${console} androidboot.serialno=${serial#};" \ - "part start mmc ${mmcdev} ${bootpart} boot_start;" \ - "part size mmc ${mmcdev} ${bootpart} boot_size;" \ + "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 " \ "echo Running Android...;" \ "bootm ${loadaddr};" \ @@ -111,7 +114,6 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ "partitions=" PARTS_DEFAULT "\0" \ "mmcdev=2\0" \ - "bootpart=1\0" \ "logopart=2\0" \ "gpio_recovery=88\0" \ "check_button=gpio input ${gpio_recovery};test $? -eq 0;\0" \

On 29/07/2021 09:21, Mattijs Korpershoek wrote:
To boot Android, we read the gpt and assume that the partition with index "1" will be the "boot" partition.
This might not always be the case, as there are no requirements from Android on the partition order.
However, Android does seem to use the "boot" label quite a lot on their public documentation [1]
Load the boot partition by label instead of by index
[1] https://source.android.com/devices/bootloader/partitions Signed-off-by: Guillaume La Roque mkorpershoek@baylibre.com Signed-off-by: Mattijs Korpershoek mkorpershoek@baylibre.com
include/configs/meson64_android.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/include/configs/meson64_android.h b/include/configs/meson64_android.h index 4027a7fe0d..e22f05c889 100644 --- a/include/configs/meson64_android.h +++ b/include/configs/meson64_android.h @@ -9,6 +9,9 @@ #ifndef __MESON64_ANDROID_CONFIG_H #define __MESON64_ANDROID_CONFIG_H
+#ifndef BOOT_PARTITION +#define BOOT_PARTITION "boot" +#endif
#define BOOTENV_DEV_FASTBOOT(devtypeu, devtypel, instance) \ "bootcmd_fastboot=" \ @@ -77,11 +80,11 @@
#define BOOTENV_DEV_SYSTEM(devtypeu, devtypel, instance) \ "bootcmd_system=" \
"echo Loading Android boot partition...;" \
"mmc dev ${mmcdev};" \ "setenv bootargs ${bootargs} console=${console} androidboot.serialno=${serial#};" \"echo Loading Android " BOOT_PARTITION " partition...;" \
"part start mmc ${mmcdev} ${bootpart} boot_start;" \
"part size mmc ${mmcdev} ${bootpart} boot_size;" \
"part start mmc ${mmcdev} " BOOT_PARTITION " boot_start;" \
"if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \ "echo Running Android...;" \ "bootm ${loadaddr};" \"part size mmc ${mmcdev} " BOOT_PARTITION " boot_size;" \
@@ -111,7 +114,6 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ "partitions=" PARTS_DEFAULT "\0" \ "mmcdev=2\0" \
- "bootpart=1\0" \ "logopart=2\0" \ "gpio_recovery=88\0" \ "check_button=gpio input ${gpio_recovery};test $? -eq 0;\0" \
Acked-by: Neil Armstrong narmstrong@baylibre.com

To display the bootup logo, we read the gpt and assume that the partition with index "2" will be the "logo" partition.
This might not always be the case, and it's very error-prone.
Load the logo partition by label instead of by index.
Signed-off-by: Guillaume La Roque mkorpershoek@baylibre.com Signed-off-by: Mattijs Korpershoek mkorpershoek@baylibre.com --- include/configs/meson64_android.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/include/configs/meson64_android.h b/include/configs/meson64_android.h index e22f05c889..56545a72f8 100644 --- a/include/configs/meson64_android.h +++ b/include/configs/meson64_android.h @@ -13,6 +13,10 @@ #define BOOT_PARTITION "boot" #endif
+#ifndef LOGO_PARTITION +#define LOGO_PARTITION "logo" +#endif + #define BOOTENV_DEV_FASTBOOT(devtypeu, devtypel, instance) \ "bootcmd_fastboot=" \ "sm reboot_reason reason;" \ @@ -104,8 +108,8 @@ "if test "${boot_source}" != "usb" && " \ "gpt verify mmc ${mmcdev} ${partitions}; then; " \ "mmc dev ${mmcdev};" \ - "part start mmc ${mmcdev} ${logopart} boot_start;" \ - "part size mmc ${mmcdev} ${logopart} boot_size;" \ + "part start mmc ${mmcdev} " LOGO_PARTITION " boot_start;" \ + "part size mmc ${mmcdev} " LOGO_PARTITION " boot_size;" \ "if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \ "bmp display ${loadaddr} m m;" \ "fi;" \ @@ -114,7 +118,6 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ "partitions=" PARTS_DEFAULT "\0" \ "mmcdev=2\0" \ - "logopart=2\0" \ "gpio_recovery=88\0" \ "check_button=gpio input ${gpio_recovery};test $? -eq 0;\0" \ "load_logo=" PREBOOT_LOAD_LOGO "\0" \

On 29/07/2021 09:21, Mattijs Korpershoek wrote:
To display the bootup logo, we read the gpt and assume that the partition with index "2" will be the "logo" partition.
This might not always be the case, and it's very error-prone.
Load the logo partition by label instead of by index.
Signed-off-by: Guillaume La Roque mkorpershoek@baylibre.com Signed-off-by: Mattijs Korpershoek mkorpershoek@baylibre.com
include/configs/meson64_android.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/include/configs/meson64_android.h b/include/configs/meson64_android.h index e22f05c889..56545a72f8 100644 --- a/include/configs/meson64_android.h +++ b/include/configs/meson64_android.h @@ -13,6 +13,10 @@ #define BOOT_PARTITION "boot" #endif
+#ifndef LOGO_PARTITION +#define LOGO_PARTITION "logo" +#endif
#define BOOTENV_DEV_FASTBOOT(devtypeu, devtypel, instance) \ "bootcmd_fastboot=" \ "sm reboot_reason reason;" \ @@ -104,8 +108,8 @@ "if test "${boot_source}" != "usb" && " \ "gpt verify mmc ${mmcdev} ${partitions}; then; " \ "mmc dev ${mmcdev};" \
"part start mmc ${mmcdev} ${logopart} boot_start;" \
"part size mmc ${mmcdev} ${logopart} boot_size;" \
"part start mmc ${mmcdev} " LOGO_PARTITION " boot_start;" \
"if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \ "bmp display ${loadaddr} m m;" \ "fi;" \"part size mmc ${mmcdev} " LOGO_PARTITION " boot_size;" \
@@ -114,7 +118,6 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ "partitions=" PARTS_DEFAULT "\0" \ "mmcdev=2\0" \
- "logopart=2\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

The console bootargs are already set from the kernel commandline. On Android, this is done in yukawa at [1]
Don't set it in the bootloader since it's overridden by the kernel anyways.
[1] https://android-review.googlesource.com/c/device/amlogic/yukawa/+/1112994 Signed-off-by: Guillaume La Roque mkorpershoek@baylibre.com Signed-off-by: Mattijs Korpershoek mkorpershoek@baylibre.com --- include/configs/meson64_android.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/include/configs/meson64_android.h b/include/configs/meson64_android.h index 56545a72f8..3b61d5f703 100644 --- a/include/configs/meson64_android.h +++ b/include/configs/meson64_android.h @@ -86,7 +86,7 @@ "bootcmd_system=" \ "echo Loading Android " BOOT_PARTITION " partition...;" \ "mmc dev ${mmcdev};" \ - "setenv bootargs ${bootargs} console=${console} androidboot.serialno=${serial#};" \ + "setenv bootargs ${bootargs} androidboot.serialno=${serial#};" \ "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 " \ @@ -121,8 +121,6 @@ "gpio_recovery=88\0" \ "check_button=gpio input ${gpio_recovery};test $? -eq 0;\0" \ "load_logo=" PREBOOT_LOAD_LOGO "\0" \ - "console=/dev/ttyAML0\0" \ - "bootargs=no_console_suspend\0" \ "stdin=" STDIN_CFG "\0" \ "stdout=" STDOUT_CFG "\0" \ "stderr=" STDOUT_CFG "\0" \

On 29/07/2021 09:21, Mattijs Korpershoek wrote:
The console bootargs are already set from the kernel commandline. On Android, this is done in yukawa at [1]
Don't set it in the bootloader since it's overridden by the kernel anyways.
[1] https://android-review.googlesource.com/c/device/amlogic/yukawa/+/1112994 Signed-off-by: Guillaume La Roque mkorpershoek@baylibre.com Signed-off-by: Mattijs Korpershoek mkorpershoek@baylibre.com
include/configs/meson64_android.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/include/configs/meson64_android.h b/include/configs/meson64_android.h index 56545a72f8..3b61d5f703 100644 --- a/include/configs/meson64_android.h +++ b/include/configs/meson64_android.h @@ -86,7 +86,7 @@ "bootcmd_system=" \ "echo Loading Android " BOOT_PARTITION " partition...;" \ "mmc dev ${mmcdev};" \
"setenv bootargs ${bootargs} console=${console} androidboot.serialno=${serial#};" \
"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 " \"setenv bootargs ${bootargs} androidboot.serialno=${serial#};" \
@@ -121,8 +121,6 @@ "gpio_recovery=88\0" \ "check_button=gpio input ${gpio_recovery};test $? -eq 0;\0" \ "load_logo=" PREBOOT_LOAD_LOGO "\0" \
- "console=/dev/ttyAML0\0" \
- "bootargs=no_console_suspend\0" \ "stdin=" STDIN_CFG "\0" \ "stdout=" STDOUT_CFG "\0" \ "stderr=" STDOUT_CFG "\0" \
Acked-by: Neil Armstrong narmstrong@baylibre.com

On 29/07/2021 09:21, Mattijs Korpershoek wrote:
The Khadas VIM3 and VIM3L 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.
These series a couple of cleanups to prepare to add mainline U-Boot support for vim3 / vim3l so that we can boot Android.
[1] https://source.android.com/setup/build/devices#vim3_and_vim3l_boards [2] https://gitlab.com/baylibre/amlogic/atv/u-boot/-/tree/u-boot/v2021.07/integ
Mattijs Korpershoek (6): configs: sei610: fix typo in header comment configs: meson64_android: fix bad indent in EXTRA_ENV_SETTINGS configs: meson64_android: use CONFIG_FASTBOOT_USB_DEV configs: meson64_android: use boot part label instead of index configs: meson64_android: use logo part label instead of index configs: meson64_android: don't set console bootargs
include/configs/meson64_android.h | 30 +++++++++++++++++------------- include/configs/sei610.h | 2 +- 2 files changed, 18 insertions(+), 14 deletions(-)
Applied to u-boot-amlogic
Thanks, Neil
participants (2)
-
Mattijs Korpershoek
-
Neil Armstrong