From fe0cd9813b71ca80600e2bb122bc60fac519e477 Mon Sep 17 00:00:00 2001 From: Ahmed Harhash Date: Mon, 13 Jan 2025 04:32:17 +0200 Subject: [PATCH 1/2] flash: Introduce rebooting to fastbootd --- flash/factory.common | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/flash/factory.common b/flash/factory.common index 7a0ed8b..ce2d570 100755 --- a/flash/factory.common +++ b/flash/factory.common @@ -120,6 +120,18 @@ find_device() { done } +# Switch to fastbootd +switch_to_fastbootd() { + echo "INFO: Switching device to fastbootd mode..." + "${FASTBOOT_BIN}" -s "${sn}" reboot fastboot || { + echo "ERROR: Unable to switch to fastbootd mode." + abort_now + } + sleep 5 # Wait for the device to reboot into fastbootd + echo "INFO: Device is now in fastbootd mode." +} + + # Flash (or manipulate) relevant partitions flash_device() { flash_images_ab_or_abort "${sn}" "${FLASH_AB_FW_IMGS}" @@ -155,6 +167,10 @@ flash_factory() { # If only one device is found $sn will store its serial number find_device + if [ "${USE_FASTBOOTD}" = "true" ]; then + switch_to_fastbootd + fi + # Check if the device is properly unlocked check_unlock_status @@ -282,4 +298,3 @@ reboot_device() { echo "INFO: You can unplug the USB cable now." echo "" } - -- GitLab From 40015e5a2c9b7cc2f2a1c7eba8fcaba9b1339a5f Mon Sep 17 00:00:00 2001 From: Ahmed Harhash Date: Mon, 13 Jan 2025 04:33:37 +0200 Subject: [PATCH 2/2] flash: Add OnePlus Nord (avicii) --- flash/avicii/config.mk | 10 ++++++++++ flash/avicii/flash_avicii_factory.sh | 22 ++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 flash/avicii/config.mk create mode 100644 flash/avicii/flash_avicii_factory.sh diff --git a/flash/avicii/config.mk b/flash/avicii/config.mk new file mode 100644 index 0000000..73837cd --- /dev/null +++ b/flash/avicii/config.mk @@ -0,0 +1,10 @@ +HLOS_IMAGES_TARGET := boot.img \ + dtbo.img \ + odm.img \ + product.img \ + recovery.img \ + system.img \ + system_ext.img \ + vbmeta.img \ + vbmeta_system.img \ + vendor.img diff --git a/flash/avicii/flash_avicii_factory.sh b/flash/avicii/flash_avicii_factory.sh new file mode 100644 index 0000000..e3f9a38 --- /dev/null +++ b/flash/avicii/flash_avicii_factory.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +# Target device info +PRODUCT="OnePlus Nord" +PRODUCT_ID="lito" + +# Target Flashing Images info +FLASH_AB_FW_IMGS="abl aop bluetooth devcfg dsp featenabler hyp imagefv keymaster logo modem qupfw storsec tz uefisecapp xbl_config xbl" +FLASH_AB_IMGS="boot dtbo recovery vbmeta vbmeta_system" +FLASH_A_IMGS="odm product system system_ext vendor" +ERASE_IMGS="userdata metadata" + +# Target flash process behavior +CLEAN_FLASH=true +VIRTUAL_AB=false +USE_FASTBOOTD=true + +# Source common functions +source ./factory.common || { echo "ERROR: Failed to source factory.common"; exit 1; } + +# Common flashing function +flash_factory -- GitLab