From 91493f28d277d175cdf6e286c334bdc430626cd7 Mon Sep 17 00:00:00 2001 From: SahilSonar Date: Tue, 7 Apr 2026 15:37:47 +0530 Subject: [PATCH 1/3] flash: factory.common: Move check_unlock_status check early --- flash/factory.common | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flash/factory.common b/flash/factory.common index 9131a7d..6b504e5 100755 --- a/flash/factory.common +++ b/flash/factory.common @@ -190,13 +190,13 @@ flash_factory() { # If only one device is found $sn will store its serial number find_device + # Check if the device is properly unlocked + check_unlock_status + if [ "${USE_FASTBOOTD}" = "true" ]; then switch_to_fastbootd fi - # Check if the device is properly unlocked - check_unlock_status - # Flash the device flash_device -- GitLab From 4eb9b62716cdcaa1fc57a88f59091da73aecb08e Mon Sep 17 00:00:00 2001 From: SahilSonar Date: Tue, 7 Apr 2026 15:44:33 +0530 Subject: [PATCH 2/3] flash: factory.common: Add early A-only/AB image flashing Retrofit devices require flashing boot before switching to fastbootd. --- flash/factory.common | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/flash/factory.common b/flash/factory.common index 6b504e5..fd2c5b4 100755 --- a/flash/factory.common +++ b/flash/factory.common @@ -144,6 +144,11 @@ switch_to_fastbootd() { echo "INFO: Device is now in fastbootd mode." } +# Flash (or manipulate) relevant early partitions +flash_device_early() { + flash_images_ab_or_abort "${sn}" "${FLASH_AB_EARLY_IMGS}" + flash_images_a_or_abort "${sn}" "${FLASH_A_EARLY_IMGS}" +} # Flash (or manipulate) relevant partitions flash_device() { @@ -180,6 +185,8 @@ flash_factory() { VIRTUAL_AB="${VIRTUAL_AB:-false}" FLASH_AB_FW_IMGS="${FLASH_AB_FW_IMGS:-}" FLASH_A_FW_IMGS="${FLASH_A_FW_IMGS:-}" + FLASH_AB_EARLY_IMGS="${FLASH_AB_EARLY_IMGS:-}" + FLASH_A_EARLY_IMGS="${FLASH_A_EARLY_IMGS:-}" FLASH_AB_IMGS="${FLASH_AB_IMGS:-}" FLASH_A_IMGS="${FLASH_A_IMGS:-}" ERASE_IMGS="${ERASE_IMGS:-}" @@ -193,6 +200,9 @@ flash_factory() { # Check if the device is properly unlocked check_unlock_status + # Retrofit devices require flashing boot before switching to fastbootd + flash_device_early + if [ "${USE_FASTBOOTD}" = "true" ]; then switch_to_fastbootd fi -- GitLab From 4961782b160a7ea33ed4698251df9d5dd604b2e5 Mon Sep 17 00:00:00 2001 From: SahilSonar Date: Tue, 7 Apr 2026 16:11:23 +0530 Subject: [PATCH 3/3] flash: factory.common: Add WIPE_SUPER flag Dynamic retrofit device requires erasing super --- flash/factory.common | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/flash/factory.common b/flash/factory.common index fd2c5b4..d6d076d 100755 --- a/flash/factory.common +++ b/flash/factory.common @@ -161,6 +161,12 @@ then "${FASTBOOT_BIN}" -s "${sn}" reboot bootloader fi +if [ "${WIPE_SUPER}" = "true" ] +then + echo "INFO: Wiping super image" + "${FASTBOOT_BIN}" -s "${sn}" wipe-super "${IMAGES_DIR}/super_empty.img" +fi + flash_images_ab_or_abort "${sn}" "${FLASH_AB_IMGS}" flash_images_a_or_abort "${sn}" "${FLASH_A_IMGS}" @@ -182,6 +188,7 @@ flash_factory() { USE_FASTBOOTD="${USE_FASTBOOTD:-false}" FW_BL_RESTART="${FW_BL_RESTART:-false}" CLEAN_FLASH="${CLEAN_FLASH:-false}" + WIPE_SUPER="${WIPE_SUPER:-false}" VIRTUAL_AB="${VIRTUAL_AB:-false}" FLASH_AB_FW_IMGS="${FLASH_AB_FW_IMGS:-}" FLASH_A_FW_IMGS="${FLASH_A_FW_IMGS:-}" -- GitLab