From 55edd5a536b44250737edc464ebc244e42029d9b Mon Sep 17 00:00:00 2001 From: Daniel Jacob Chittoor Date: Fri, 28 Apr 2023 00:55:51 +0530 Subject: [PATCH 1/3] flash: one: Add cache image to HLOS target --- flash/one/config.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/flash/one/config.mk b/flash/one/config.mk index 66690f1..a6aec37 100644 --- a/flash/one/config.mk +++ b/flash/one/config.mk @@ -1,4 +1,5 @@ HLOS_IMAGES_TARGET := boot.img \ + cache.img \ recovery.img \ dtbo.img \ vbmeta_system.img \ -- GitLab From f747f92500d0b0c1f10478cefa0ed831e41f2722 Mon Sep 17 00:00:00 2001 From: Daniel Jacob Chittoor Date: Fri, 28 Apr 2023 00:56:36 +0530 Subject: [PATCH 2/3] flash: one: Flash `preloader_ufs.img` --- flash/one/flash_one_factory.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flash/one/flash_one_factory.sh b/flash/one/flash_one_factory.sh index 0c297cc..6266748 100755 --- a/flash/one/flash_one_factory.sh +++ b/flash/one/flash_one_factory.sh @@ -96,7 +96,7 @@ flash_device() { flash_image_or_abort "${sn}" lk lk.img flash_image_or_abort "${sn}" logo logo.bin flash_image_or_abort "${sn}" md1img md1img.img - flash_image_or_abort "${sn}" preloader preloader_g1970upt_v2_gk_p60c_oj_r.bin + flash_image_or_abort "${sn}" preloader preloader_ufs.img flash_image_or_abort "${sn}" recovery recovery.img flash_image_or_abort "${sn}" scp2 scp.img flash_image_or_abort "${sn}" scp1 scp.img -- GitLab From dc0a05f4ae013b2e769423fefeb223fcfbfea40d Mon Sep 17 00:00:00 2001 From: Bharath Date: Mon, 17 Oct 2022 11:13:50 +0530 Subject: [PATCH 3/3] flash: one: Add data wipe check --- flash/one/flash_one_factory.sh | 39 +++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/flash/one/flash_one_factory.sh b/flash/one/flash_one_factory.sh index 6266748..709bec0 100755 --- a/flash/one/flash_one_factory.sh +++ b/flash/one/flash_one_factory.sh @@ -14,6 +14,8 @@ set -e set -u +CLEAN_FLASH="true" # Control data wipe behavior. Default is "true". + # Target device info PRODUCT="Murena One" PRODUCT_ID="g1970upt_v2_gk_p60c_oj_r" @@ -111,9 +113,12 @@ flash_device() { flash_image_or_abort "${sn}" vbmeta_system vbmeta_system.img flash_image_or_abort "${sn}" vbmeta vbmeta.img - "$FASTBOOT_BIN" -s "${sn}" erase userdata - "$FASTBOOT_BIN" -s "${sn}" format md_udc - flash_image_or_abort "${sn}" userdata userdata.img + if [ "${CLEAN_FLASH}" = "true" ] + then + "$FASTBOOT_BIN" -s "${sn}" erase userdata + "$FASTBOOT_BIN" -s "${sn}" format md_udc + flash_image_or_abort "${sn}" userdata userdata.img + fi } # Flash an image to a partition. Abort on failure. @@ -172,6 +177,31 @@ reboot_device() { echo "" } +# Warn about data wipe, and ask for confirmation +data_wipe_check() { + if [ "${CLEAN_FLASH}" = "true" ] + then + echo "" + echo "WARNING: Flashing this image wipes all user data and settings on the phone." + echo " Are you sure you want to wipe data and continue?" + echo "" + # Read user's input + read -rp " Type \"Yes\" (case sensitive) and press enter to wipe data and continue. Else, just press enter: " a + echo "" + if [ "_${a:-"No"}" != '_Yes' ] + # NOTE: $a is being set by the read command above, + # so the check for a to be set is mostly redundant + then + echo "WARNING: You DID NOT type \"Yes\", proceeding without data wipe." + echo "" + CLEAN_FLASH="false" + else + echo "WARNING: You typed \"Yes\", proceeding with data wipe." + CLEAN_FLASH="true" + fi + fi +} + echo "" echo "*** ${PRODUCT} flashing script ***" echo "" @@ -186,6 +216,9 @@ os_checks # If only one device is found $sn will store its serial number find_device +# Call function to look for data wipe check +data_wipe_check + # Flash the device flash_device -- GitLab