Skip to contentSkip to conversation

meson64_android: fix initial flashing failures

PATCH In review Mattijs Korpershoek 2 participants 4 messages Nov 17, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover meson64_android: fix initial flashing failures

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.

For initial boards, with an empty eMMC, we can have boot loops while using the flashing process described in [3].

This series add 2 fixes for these bootloops.

[1] https://android.googlesource.com/device/amlogic/yukawa
[2] https://gitlab.com/baylibre/amlogic/atv/u-boot/-/tree/u-boot/v2021.07/integ
[3] https://gitlab.com/baylibre/amlogic/atv/aosp/device/amlogic/yukawa/-/wikis/Khadas_VIM3#flash-android-bootloader

Neil Armstrong (2):
configs: meson64_android: bypass other checks on run_fastboot=1
configs: meson64_android: add PANIC stage for SYSTEM fails

 include/configs/meson64_android.h | 47 +++++++++++++++++++------------
 1 file changed, 29 insertions(+), 18 deletions(-)

base-commit: 4f4f974a46244270c1c6723017711c0aa8250206

Signature · 1 line
2.32.0
#1 lore raw

PATCH 1/2 configs: meson64_android: bypass other checks on run_fastboot=1

From: Neil Armstrong <[email protected]>

This can lead to GPT and BCB errors even if fastboot was selected early by usb rom boot and the eMMC is blank/invalid.

---
 include/configs/meson64_android.h | 35 +++++++++++++++++--------------
 1 file changed, 19 insertions(+), 16 deletions(-)
include/configs/meson64_android.h +19 -16
index fb3ccc329a7e..93d8f8ec99de 100644
@@ -140,24 +140,27 @@
 			"echo Fastboot forced by usb rom boot;" \
 			"setenv run_fastboot 1;" \
 		"fi;" \
-		"if gpt verify mmc ${mmcdev} ${partitions}; then; " \
-		"else " \
-			"echo Broken MMC partition scheme;" \
-			"setenv run_fastboot 1;" \
-		"fi;" \
-		"if bcb load " __stringify(CONFIG_FASTBOOT_FLASH_MMC_DEV) " " \
-		CONTROL_PARTITION "; then " \
-			"if bcb test command = bootonce-bootloader; then " \
-				"echo BCB: Bootloader boot...; " \
-				"bcb clear command; bcb store; " \
+		"if test \"${run_fastboot}\" -eq 0; then " \
+			"if gpt verify mmc ${mmcdev} ${partitions}; then; " \
+			"else " \
+				"echo Broken MMC partition scheme;" \
 				"setenv run_fastboot 1;" \
 			"fi; " \
-			"if bcb test command = boot-fastboot; then " \
-				"echo BCB: fastboot userspace boot...; " \
-				"setenv force_recovery 1;" \
-			"fi; " \
-		"else " \
-			"echo Warning: BCB is corrupted or does not exist; " \
+		"fi;" \
+		"if test \"${run_fastboot}\" -eq 0; then " \
+			"if bcb load " __stringify(CONFIG_FASTBOOT_FLASH_MMC_DEV) " " \
+			CONTROL_PARTITION "; then " \
+				"if bcb test command = bootonce-bootloader; then " \
+					"echo BCB: Bootloader boot...; " \
+					"bcb clear command; bcb store; " \
+					"setenv run_fastboot 1;" \
+				"elif bcb test command = boot-fastboot; then " \
+					"echo BCB: fastboot userspace boot...; " \
+					"setenv force_recovery 1;" \
+				"fi; " \
+			"else " \
+				"echo Warning: BCB is corrupted or does not exist; " \
+			"fi;" \
 		"fi;" \
 		"if test \"${run_fastboot}\" -eq 1; then " \
 			"echo Running Fastboot...;" \
Signature · 1 line
2.32.0
#2 lore raw

PATCH 2/2 configs: meson64_android: add PANIC stage for SYSTEM fails

In reply to Mattijs Korpershoek

From: Neil Armstrong <[email protected]>

If bootloader was updated without running oem format, reboot will cause boot loop because the SYSTEM stage fails.

Add a final PANIC stage running fastboot to permit recovery.

---
 include/configs/meson64_android.h | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
include/configs/meson64_android.h +10 -2
index 93d8f8ec99de..7cd1ab034118 100644
@@ -233,16 +233,24 @@
 			"echo Running Android...;" \
 			BOOT_CMD \
 		"fi;" \
-		"echo Failed to boot Android...;" \
-		"reset\0"
+		"echo Failed to boot Android...;\0"
 
 #define BOOTENV_DEV_NAME_SYSTEM(devtypeu, devtypel, instance)	\
 		"system "
 
+#define BOOTENV_DEV_PANIC(devtypeu, devtypel, instance) \
+	"bootcmd_panic=" \
+		"fastboot " __stringify(CONFIG_FASTBOOT_USB_DEV) "; " \
+		"reset\0"
+
+#define BOOTENV_DEV_NAME_PANIC(devtypeu, devtypel, instance)	\
+		"panic "
+
 #define BOOT_TARGET_DEVICES(func) \
 	func(FASTBOOT, fastboot, na) \
 	func(RECOVERY, recovery, na) \
 	func(SYSTEM, system, na) \
+	func(PANIC, panic, na) \
 
 #define PREBOOT_LOAD_LOGO \
 	"if test \"${boot_source}\" != \"usb\" && " \
Signature · 1 line
2.32.0
#3 lore raw
In reply to Mattijs Korpershoek

Hi,

Quoted 18 lines · 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.

For initial boards, with an empty eMMC, we can have boot loops while using the flashing process described in [3].

This series add 2 fixes for these bootloops.

[1] https://android.googlesource.com/device/amlogic/yukawa
[2] https://gitlab.com/baylibre/amlogic/atv/u-boot/-/tree/u-boot/v2021.07/integ
[3] https://gitlab.com/baylibre/amlogic/atv/aosp/device/amlogic/yukawa/-/wikis/Khadas_VIM3#flash-android-bootloader

Neil Armstrong (2):
configs: meson64_android: bypass other checks on run_fastboot=1
configs: meson64_android: add PANIC stage for SYSTEM fails

Quoted 6 lines
 include/configs/meson64_android.h | 47 +++++++++++++++++++------------
 1 file changed, 29 insertions(+), 18 deletions(-)

base-commit: 4f4f974a46244270c1c6723017711c0aa8250206

Thanks,
Applied to u-boot-amlogic

Neil