Loading flash/FP4/flash_FP4_factory.sh +36 −6 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ ########## ########## # This script flashes a software release and complete wipes the device. # This script flashes a software release and completely wipes the device. # ########## Loading Loading @@ -56,7 +56,6 @@ find_device() { ;; 1) echo "INFO: One ${PRODUCT} in fastboot mode found (serial number: ${sn})." DEVICE_FOUND="true" break ;; Loading @@ -82,9 +81,38 @@ find_device() { done } # Check if the device is properly unlocked check_unlock_status() { PHONE_IS_READY=true if (fastboot getvar is-userspace 2>&1 | grep -q yes); then echo "Info: Your phone is in fastbootD mode." if (fastboot getvar unlocked 2>&1 | grep -q no); then echo "Error: Your phone is still locked." echo "Did you execute 'fastboot flashing unlock'?" PHONE_IS_READY=false fi else echo "Info: Your phone is in regular bootloader mode." if (fastboot getvar unlocked 2>&1 | grep -q no); then echo "Error: Your phone is still locked." echo "Did you execute 'fastboot flashing unlock'?" PHONE_IS_READY=false fi if (fastboot oem device-info 2>&1 | grep -q "critical unlocked: false"); then echo "Error: Critical partitions are still locked." echo "Did you execute 'fastboot flashing unlock_critical'?" PHONE_IS_READY=false fi fi if [ "$PHONE_IS_READY" = "false" ]; then echo "Error: Your phone is not ready for flashing yet (see above), aborting..." exit 1 fi } # Flash (or manipulate) relevant partitions flash_device() { flash_image_ab_or_abort "${sn}" bluetooth "${IMAGES_DIR}/bluetooth.img" flash_image_ab_or_abort "${sn}" devcfg "${IMAGES_DIR}/devcfg.img" flash_image_ab_or_abort "${sn}" dsp "${IMAGES_DIR}/dsp.img" Loading Loading @@ -115,7 +143,6 @@ flash_device() { "$FASTBOOT_BIN" -s "${sn}" erase metadata "$FASTBOOT_BIN" -s "${sn}" --set-active=a } # Flash an image to a partition. Abort on failure. Loading @@ -137,7 +164,7 @@ flash_image_or_abort() { fi } # Flash an image to both A and B slot of partition. Abort on failure. # Flash an image to both A and B slots of a partition. Abort on failure. # Arguments: <device serial number> <partition name without slot> <image file> flash_image_ab_or_abort() { flash_image_or_abort "${1}" "${2}_a" "${3}" Loading Loading @@ -192,6 +219,9 @@ os_checks # If only one device is found $sn will store its serial number find_device # Check if the device is properly unlocked check_unlock_status # Flash the device flash_device Loading Loading
flash/FP4/flash_FP4_factory.sh +36 −6 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ ########## ########## # This script flashes a software release and complete wipes the device. # This script flashes a software release and completely wipes the device. # ########## Loading Loading @@ -56,7 +56,6 @@ find_device() { ;; 1) echo "INFO: One ${PRODUCT} in fastboot mode found (serial number: ${sn})." DEVICE_FOUND="true" break ;; Loading @@ -82,9 +81,38 @@ find_device() { done } # Check if the device is properly unlocked check_unlock_status() { PHONE_IS_READY=true if (fastboot getvar is-userspace 2>&1 | grep -q yes); then echo "Info: Your phone is in fastbootD mode." if (fastboot getvar unlocked 2>&1 | grep -q no); then echo "Error: Your phone is still locked." echo "Did you execute 'fastboot flashing unlock'?" PHONE_IS_READY=false fi else echo "Info: Your phone is in regular bootloader mode." if (fastboot getvar unlocked 2>&1 | grep -q no); then echo "Error: Your phone is still locked." echo "Did you execute 'fastboot flashing unlock'?" PHONE_IS_READY=false fi if (fastboot oem device-info 2>&1 | grep -q "critical unlocked: false"); then echo "Error: Critical partitions are still locked." echo "Did you execute 'fastboot flashing unlock_critical'?" PHONE_IS_READY=false fi fi if [ "$PHONE_IS_READY" = "false" ]; then echo "Error: Your phone is not ready for flashing yet (see above), aborting..." exit 1 fi } # Flash (or manipulate) relevant partitions flash_device() { flash_image_ab_or_abort "${sn}" bluetooth "${IMAGES_DIR}/bluetooth.img" flash_image_ab_or_abort "${sn}" devcfg "${IMAGES_DIR}/devcfg.img" flash_image_ab_or_abort "${sn}" dsp "${IMAGES_DIR}/dsp.img" Loading Loading @@ -115,7 +143,6 @@ flash_device() { "$FASTBOOT_BIN" -s "${sn}" erase metadata "$FASTBOOT_BIN" -s "${sn}" --set-active=a } # Flash an image to a partition. Abort on failure. Loading @@ -137,7 +164,7 @@ flash_image_or_abort() { fi } # Flash an image to both A and B slot of partition. Abort on failure. # Flash an image to both A and B slots of a partition. Abort on failure. # Arguments: <device serial number> <partition name without slot> <image file> flash_image_ab_or_abort() { flash_image_or_abort "${1}" "${2}_a" "${3}" Loading Loading @@ -192,6 +219,9 @@ os_checks # If only one device is found $sn will store its serial number find_device # Check if the device is properly unlocked check_unlock_status # Flash the device flash_device Loading