Loading flash-scripts/linux/fp4_install-from-fastboot.sh +88 −193 Original line number Diff line number Diff line Loading @@ -22,10 +22,11 @@ # Exit status # - 0 : /e/ installed # - 1 : user data wipe failed # - 2 : flashing of a partition failed # - 4 : setting slot failed # - 5 : flashing of a secure partition failed # - 1 : erasing userdata or metadata failed # - 2 : flashing of a non-critical partition failed # - 4 : setting active slot to a failed # - 5 : flashing of a critical partition failed # namely: {devcfg_ab, xbl_ab, tz_ab, hyp_ab, keymaster_ab, abl_ab, aop_ab, imagefv_ab, multiimgoem_ab, qupfw_ab, uefisecapp_ab, xbl_config_ab} # - 101 : ARCHIVE_PATH missing # - 102 : archive could not be unpacked Loading @@ -47,321 +48,215 @@ then fi cd "$ARCHIVE_FOLDER_PATH" sleep 1 if ! "$JAR_PATH" -x -v -f "$ARCHIVE_PATH" ; then exit 102 ; fi then exit 102 fi echo "unpacked archive" sleep 1 echo "=== Flash slot a" echo "== start with one critical slot to check if critical is unlocked" if ! "$FASTBOOT_PATH" flash xbl_config_a xbl_config.img ; then exit 5 ; fi echo "flashed config" sleep 1 echo "== flash uncritical slots" echo "=== Flash slot a ===" if ! "$FASTBOOT_PATH" flash bluetooth_a bluetooth.img ; then exit 2 ; fi echo "flashed bluetooth" sleep 1 if ! "$FASTBOOT_PATH" flash devcfg_a devcfg.img ; then exit 5 ; fi echo "flashed devcfg" sleep 1 if ! "$FASTBOOT_PATH" flash dsp_a dsp.img ; then exit 2 ; fi echo "flashed dsp" sleep 1 if ! "$FASTBOOT_PATH" flash modem_a modem.img ; then exit 2 ; fi echo "flashed modem" sleep 1 if ! "$FASTBOOT_PATH" flash boot_a boot.img ; then exit 2 ; fi echo "flashed boot" sleep 1 if ! "$FASTBOOT_PATH" flash recovery_a recovery.img ; then exit 2 ; fi echo "flashed recovery" if ! "$FASTBOOT_PATH" flash xbl_a xbl.img ; then exit 5 ; fi echo "flashed xbl" sleep 1 if ! "$FASTBOOT_PATH" flash dtbo_a dtbo.img ; then exit 2 ; fi echo "flashed dtbo" if ! "$FASTBOOT_PATH" flash tz_a tz.img ; then exit 5 ; fi echo "flashed tz" sleep 1 if ! "$FASTBOOT_PATH" flash vbmeta_system_a vbmeta_system.img ; then exit 2 ; fi echo "flashed vbmeta_system" if ! "$FASTBOOT_PATH" flash hyp_a hyp.img ; then exit 5 ; fi echo "flashed hyp" sleep 1 if ! "$FASTBOOT_PATH" flash vbmeta_a vbmeta.img ; then exit 2 ; fi echo "flashed vbmeta" if ! "$FASTBOOT_PATH" flash keymaster_a keymaster.img ; then exit 5 ; fi echo "flashed keymaster" sleep 1 if ! "$FASTBOOT_PATH" flash featenabler_a featenabler.img ; then exit 2 ; fi echo "flashed featenabler" if ! "$FASTBOOT_PATH" flash abl_a abl.img ; then exit 5 ; fi echo "flashed abl" sleep 1 if ! "$FASTBOOT_PATH" flash core_nhlos_a core_nhlos.img ; then exit 2 ; fi echo "flashed core_nhlos" if ! "$FASTBOOT_PATH" flash boot_a boot.img ; then exit 2 ; fi echo "flashed boot" sleep 1 echo "=== Flash critical slots" if ! "$FASTBOOT_PATH" flash devcfg_a devcfg.img ; then exit 5 ; fi echo "flashed devcfg" if ! "$FASTBOOT_PATH" flash recovery_a recovery.img ; then exit 2 ; fi echo "flashed recovery" sleep 1 if ! "$FASTBOOT_PATH" flash xbl_a xbl.img ; then exit 5 ; fi echo "flashed xbl" if ! "$FASTBOOT_PATH" flash dtbo_a dtbo.img ; then exit 2 ; fi echo "flashed dtbo" sleep 1 if ! "$FASTBOOT_PATH" flash tz_a tz.img ; then exit 5 ; fi echo "flashed tz" if ! "$FASTBOOT_PATH" flash vbmeta_system_a vbmeta_system.img ; then exit 2 ; fi echo "flashed vbmeta_system" sleep 1 if ! "$FASTBOOT_PATH" flash hyp_a hyp.img ; then exit 5 ; fi echo "flashed hyp" if ! "$FASTBOOT_PATH" flash vbmeta_a vbmeta.img ; then exit 2 ; fi echo "flashed vbmeta" sleep 1 if ! "$FASTBOOT_PATH" flash keymaster_a keymaster.img ; then exit 5 ; fi echo "flashed keymaster" if ! "$FASTBOOT_PATH" flash super super.img ; then exit 2 ; fi echo "flashed super" sleep 1 if ! "$FASTBOOT_PATH" flash abl_a abl.img ; then exit 5 ; fi echo "flashed abl" sleep 1 if ! "$FASTBOOT_PATH" flash aop_a aop.img ; then exit 5 ; fi echo "flashed aop" sleep 1 if ! "$FASTBOOT_PATH" flash featenabler_a featenabler.img ; then exit 2 ; fi echo "flashed featenabler" sleep 1 if ! "$FASTBOOT_PATH" flash imagefv_a imagefv.img ; then exit 5 ; fi echo "flashed imagefv" sleep 1 if ! "$FASTBOOT_PATH" flash multiimgoem_a multiimgoem.img ; then exit 5 ; fi echo "flashed multiimgoem" sleep 1 if ! "$FASTBOOT_PATH" flash qupfw_a qupfw.img ; then exit 5 ; fi echo "flashed qupfw" sleep 1 if ! "$FASTBOOT_PATH" flash uefisecapp_a uefisecapp.img ; then exit 5 ; fi echo "flashed uefisecapp" sleep 1 echo "=== Flash slot b" echo "== start with one critical slot to check if critical is unlocked" if ! "$FASTBOOT_PATH" flash xbl_config_b xbl_config.img ; then exit 5 ; fi echo "flashed config" sleep 1 echo "== flash uncritical slots" if ! "$FASTBOOT_PATH" flash bluetooth_b bluetooth.img ; then exit 2 ; fi echo "flashed bluetooth" if ! "$FASTBOOT_PATH" flash xbl_config_a xbl_config.img ; then exit 5 ; fi echo "flashed xbl_config" sleep 1 if ! "$FASTBOOT_PATH" flash dsp_b dsp.img ; then exit 2 ; fi echo "flashed dsp" if ! "$FASTBOOT_PATH" flash core_nhlos_a core_nhlos.img ; then exit 2 ; fi echo "flashed core_nhlos" sleep 1 if ! "$FASTBOOT_PATH" flash modem_b modem.img ; then exit 2 ; fi echo "flashed modem" echo "=== Flash slot b ===" if ! "$FASTBOOT_PATH" flash bluetooth_b bluetooth.img ; then exit 2 ; fi echo "flashed bluetooth_b" sleep 1 if ! "$FASTBOOT_PATH" flash boot_b boot.img ; then exit 2 ; fi echo "flashed boot" if ! "$FASTBOOT_PATH" flash devcfg_b devcfg.img ; then exit 5 ; fi echo "flashed devcfg_b" sleep 1 if ! "$FASTBOOT_PATH" flash recovery_b recovery.img ; then exit 2 ; fi echo "flashed recovery" if ! "$FASTBOOT_PATH" flash dsp_b dsp.img ; then exit 2 ; fi echo "flashed dsp_b" sleep 1 if ! "$FASTBOOT_PATH" flash dtbo_b dtbo.img ; then exit 2 ; fi echo "flashed dtbo" if ! "$FASTBOOT_PATH" flash modem_b modem.img ; then exit 2 ; fi echo "flashed modem_b" sleep 1 if ! "$FASTBOOT_PATH" flash vbmeta_system_b vbmeta_system.img ; then exit 2 ; fi echo "flashed vbmeta_system" if ! "$FASTBOOT_PATH" flash xbl_b xbl.img ; then exit 5 ; fi echo "flashed xbl_b" sleep 1 if ! "$FASTBOOT_PATH" flash vbmeta_b vbmeta.img ; then exit 2 ; fi echo "flashed vbmeta" if ! "$FASTBOOT_PATH" flash tz_b tz.img ; then exit 5 ; fi echo "flashed tz_b" sleep 1 if ! "$FASTBOOT_PATH" flash featenabler_b featenabler.img ; then exit 2 ; fi echo "flashed featenabler" if ! "$FASTBOOT_PATH" flash hyp_b hyp.img ; then exit 5 ; fi echo "flashed hyp_b" sleep 1 if ! "$FASTBOOT_PATH" flash core_nhlos_b core_nhlos.img ; then exit 2 ; fi echo "flashed core_nhlos" if ! "$FASTBOOT_PATH" flash keymaster_b keymaster.img ; then exit 5 ; fi echo "flashed keymaster_b" sleep 1 echo "=== Flash critical slots" if ! "$FASTBOOT_PATH" flash devcfg_b devcfg.img ; then exit 5 ; fi echo "flashed devcfg" if ! "$FASTBOOT_PATH" flash abl_b abl.img ; then exit 5 ; fi echo "flashed abl_b" sleep 1 if ! "$FASTBOOT_PATH" flash xbl_b xbl.img ; then exit 5 ; fi echo "flashed xbl" if ! "$FASTBOOT_PATH" flash boot_b boot.img ; then exit 2 ; fi echo "flashed boot_b" sleep 1 if ! "$FASTBOOT_PATH" flash tz_b tz.img ; then exit 5 ; fi echo "flashed tz" if ! "$FASTBOOT_PATH" flash recovery_b recovery.img ; then exit 2 ; fi echo "flashed recovery_b" sleep 1 if ! "$FASTBOOT_PATH" flash hyp_b hyp.img ; then exit 5 ; fi echo "flashed hyp" if ! "$FASTBOOT_PATH" flash dtbo_b dtbo.img ; then exit 2 ; fi echo "flashed dtbo_b" sleep 1 if ! "$FASTBOOT_PATH" flash keymaster_b keymaster.img ; then exit 5 ; fi echo "flashed keymaster" if ! "$FASTBOOT_PATH" flash vbmeta_system_b vbmeta_system.img ; then exit 2 ; fi echo "flashed vbmeta_system_b" sleep 1 if ! "$FASTBOOT_PATH" flash abl_b abl.img ; then exit 5 ; fi echo "flashed abl" if ! "$FASTBOOT_PATH" flash vbmeta_b vbmeta.img ; then exit 2 ; fi echo "flashed vbmeta_b" sleep 1 if ! "$FASTBOOT_PATH" flash aop_b aop.img ; then exit 5 ; fi echo "flashed aop_b" sleep 1 echo "flashed aop" if ! "$FASTBOOT_PATH" flash featenabler_b featenabler.img ; then exit 2 ; fi echo "flashed featenabler_b" sleep 1 if ! "$FASTBOOT_PATH" flash imagefv_b imagefv.img ; then exit 5 ; fi echo "flashed imagefv" echo "flashed imagefv_b" sleep 1 if ! "$FASTBOOT_PATH" flash multiimgoem_b multiimgoem.img ; then exit 5 ; fi echo "flashed multiimgoem" echo "flashed multiimgoem_b" sleep 1 if ! "$FASTBOOT_PATH" flash qupfw_b qupfw.img ; then exit 5 ; fi echo "flashed qupfw" echo "flashed qupfw_b" sleep 1 if ! "$FASTBOOT_PATH" flash uefisecapp_b uefisecapp.img ; then exit 5 ; fi echo "flashed uefisecapp" echo "flashed uefisecapp_b" sleep 1 echo "=== Flash common slot" if ! "$FASTBOOT_PATH" flash super super.img ; then exit 2 ; fi echo "flashed super" if ! "$FASTBOOT_PATH" flash xbl_config_b xbl_config.img ; then exit 5 ; fi echo "flashed xbl_config_b" sleep 1 echo "=== Wipe user data and meta data in 5 seconds..." if ! "$FASTBOOT_PATH" flash core_nhlos_b core_nhlos.img ; then exit 2 ; fi echo "flashed core_nhlos_b" sleep 1 echo "=== Wiping userdata and metadata ===" sleep 3 if ! "$FASTBOOT_PATH" erase userdata ; then exit 1 ; fi echo "wiped userdata" sleep 1 if ! "$FASTBOOT_PATH" erase metadata ; then exit 1 ; fi echo "user and meta data wiped" echo "wiped metadata" sleep 3 echo "Select slot a for booting..." echo "=== Setting active slot to a ===" if ! "$FASTBOOT_PATH" --set-active=a ; then exit 4 ; fi echo "boot from slot a selected" echo "switched to slot a" flash-scripts/linux/fp4_lock.sh +16 −9 Original line number Diff line number Diff line #!/bin/bash # Copyright (C) 2020 ECORP SAS - Author: Vincent Bourgmayer # Updated ff2u # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by Loading @@ -23,17 +22,25 @@ # Exit status # - 0 : success # - 1 : Error # - 101 : no device found in fastboot # - 102 : locking the bootloader failed FASTBOOT_FOLDER_PATH=$1 FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" echo "fastboot path: $FASTBOOT_PATH" #1 On check that device is in recovery mode if ! "$FASTBOOT_PATH" devices 2>&1 | grep "fastboot" then echo "Device not detected in fastboot" exit 101 fi # Lock the bootloader if ! "$FASTBOOT_PATH" flashing lock ; then exit 102 ; fi #Then we wait that it left this state while [ "$($FASTBOOT_PATH devices | grep -q fastboot; echo $?)" = 0 ] do sleep 1s done if ! "$FASTBOOT_PATH" flashing lock then exit 102 fi sleep 10 flash-scripts/linux/fp4_lock_critical.sh +5 −9 Original line number Diff line number Diff line Loading @@ -23,23 +23,19 @@ # Exit status # - 0 : success # - 1 : Error # - 102 : locking the bootloader failed # - 101 : locking the bootloader failed FASTBOOT_FOLDER_PATH=$1 FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" # Lock the bootloader if [ "$($FASTBOOT_PATH flashing lock_critical; echo $?)" = 1 ] then if [ "$($FASTBOOT_PATH flashing lock_critical 2>&1 | grep -q "Device already : locked!"; echo $?)" = 0 ] then echo "Critical partitions already locked" else echo "OEM-lock fails" exit 10 fi echo "Lock Critical fails!" exit 101 fi sleep 10s echo "Critical locked!" #Then we wait that it left this state while [ "$($FASTBOOT_PATH devices | grep -q fastboot; echo $?)" = 0 ] Loading flash-scripts/linux/fp4_oem-unlock-critical.sh +9 −9 Original line number Diff line number Diff line Loading @@ -27,16 +27,16 @@ FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" echo "fastboot path: $FASTBOOT_PATH" if [ "$($FASTBOOT_PATH flashing unlock_critical; echo $?)" = 1 ] then if [ "$($FASTBOOT_PATH flashing unlock_critical 2>&1 | grep -q "Device already : unlocked!"; echo $?)" = 0 ] if [ "$($FASTBOOT_PATH oem device-info 2>&1 | grep -q "critical unlocked: true"; echo $?)" = 0 ] then echo "Critical partitions already unlocked" sleep 10s echo "Device already critically unlocked!" else echo "OEM-unlock fails" if [ "$($FASTBOOT_PATH flashing unlock_critical; echo $?)" = 1 ] then echo "Crtical unlock fails!" exit 10 fi fi sleep 10s echo "OEM unlocked" echo "Critical unlocked!" fi flash-scripts/linux/fp4_oem-unlock.sh +1 −3 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ echo "fastboot path: $FASTBOOT_PATH" if [ "$($FASTBOOT_PATH getvar unlocked 2>&1 | grep -q yes; echo $?)" = 0 ] then sleep 10s echo "Device already unlocked" else if [ "$($FASTBOOT_PATH flashing unlock; echo $?)" = 1 ] Loading @@ -39,6 +40,3 @@ else sleep 10s echo "OEM unlocked" fi Loading
flash-scripts/linux/fp4_install-from-fastboot.sh +88 −193 Original line number Diff line number Diff line Loading @@ -22,10 +22,11 @@ # Exit status # - 0 : /e/ installed # - 1 : user data wipe failed # - 2 : flashing of a partition failed # - 4 : setting slot failed # - 5 : flashing of a secure partition failed # - 1 : erasing userdata or metadata failed # - 2 : flashing of a non-critical partition failed # - 4 : setting active slot to a failed # - 5 : flashing of a critical partition failed # namely: {devcfg_ab, xbl_ab, tz_ab, hyp_ab, keymaster_ab, abl_ab, aop_ab, imagefv_ab, multiimgoem_ab, qupfw_ab, uefisecapp_ab, xbl_config_ab} # - 101 : ARCHIVE_PATH missing # - 102 : archive could not be unpacked Loading @@ -47,321 +48,215 @@ then fi cd "$ARCHIVE_FOLDER_PATH" sleep 1 if ! "$JAR_PATH" -x -v -f "$ARCHIVE_PATH" ; then exit 102 ; fi then exit 102 fi echo "unpacked archive" sleep 1 echo "=== Flash slot a" echo "== start with one critical slot to check if critical is unlocked" if ! "$FASTBOOT_PATH" flash xbl_config_a xbl_config.img ; then exit 5 ; fi echo "flashed config" sleep 1 echo "== flash uncritical slots" echo "=== Flash slot a ===" if ! "$FASTBOOT_PATH" flash bluetooth_a bluetooth.img ; then exit 2 ; fi echo "flashed bluetooth" sleep 1 if ! "$FASTBOOT_PATH" flash devcfg_a devcfg.img ; then exit 5 ; fi echo "flashed devcfg" sleep 1 if ! "$FASTBOOT_PATH" flash dsp_a dsp.img ; then exit 2 ; fi echo "flashed dsp" sleep 1 if ! "$FASTBOOT_PATH" flash modem_a modem.img ; then exit 2 ; fi echo "flashed modem" sleep 1 if ! "$FASTBOOT_PATH" flash boot_a boot.img ; then exit 2 ; fi echo "flashed boot" sleep 1 if ! "$FASTBOOT_PATH" flash recovery_a recovery.img ; then exit 2 ; fi echo "flashed recovery" if ! "$FASTBOOT_PATH" flash xbl_a xbl.img ; then exit 5 ; fi echo "flashed xbl" sleep 1 if ! "$FASTBOOT_PATH" flash dtbo_a dtbo.img ; then exit 2 ; fi echo "flashed dtbo" if ! "$FASTBOOT_PATH" flash tz_a tz.img ; then exit 5 ; fi echo "flashed tz" sleep 1 if ! "$FASTBOOT_PATH" flash vbmeta_system_a vbmeta_system.img ; then exit 2 ; fi echo "flashed vbmeta_system" if ! "$FASTBOOT_PATH" flash hyp_a hyp.img ; then exit 5 ; fi echo "flashed hyp" sleep 1 if ! "$FASTBOOT_PATH" flash vbmeta_a vbmeta.img ; then exit 2 ; fi echo "flashed vbmeta" if ! "$FASTBOOT_PATH" flash keymaster_a keymaster.img ; then exit 5 ; fi echo "flashed keymaster" sleep 1 if ! "$FASTBOOT_PATH" flash featenabler_a featenabler.img ; then exit 2 ; fi echo "flashed featenabler" if ! "$FASTBOOT_PATH" flash abl_a abl.img ; then exit 5 ; fi echo "flashed abl" sleep 1 if ! "$FASTBOOT_PATH" flash core_nhlos_a core_nhlos.img ; then exit 2 ; fi echo "flashed core_nhlos" if ! "$FASTBOOT_PATH" flash boot_a boot.img ; then exit 2 ; fi echo "flashed boot" sleep 1 echo "=== Flash critical slots" if ! "$FASTBOOT_PATH" flash devcfg_a devcfg.img ; then exit 5 ; fi echo "flashed devcfg" if ! "$FASTBOOT_PATH" flash recovery_a recovery.img ; then exit 2 ; fi echo "flashed recovery" sleep 1 if ! "$FASTBOOT_PATH" flash xbl_a xbl.img ; then exit 5 ; fi echo "flashed xbl" if ! "$FASTBOOT_PATH" flash dtbo_a dtbo.img ; then exit 2 ; fi echo "flashed dtbo" sleep 1 if ! "$FASTBOOT_PATH" flash tz_a tz.img ; then exit 5 ; fi echo "flashed tz" if ! "$FASTBOOT_PATH" flash vbmeta_system_a vbmeta_system.img ; then exit 2 ; fi echo "flashed vbmeta_system" sleep 1 if ! "$FASTBOOT_PATH" flash hyp_a hyp.img ; then exit 5 ; fi echo "flashed hyp" if ! "$FASTBOOT_PATH" flash vbmeta_a vbmeta.img ; then exit 2 ; fi echo "flashed vbmeta" sleep 1 if ! "$FASTBOOT_PATH" flash keymaster_a keymaster.img ; then exit 5 ; fi echo "flashed keymaster" if ! "$FASTBOOT_PATH" flash super super.img ; then exit 2 ; fi echo "flashed super" sleep 1 if ! "$FASTBOOT_PATH" flash abl_a abl.img ; then exit 5 ; fi echo "flashed abl" sleep 1 if ! "$FASTBOOT_PATH" flash aop_a aop.img ; then exit 5 ; fi echo "flashed aop" sleep 1 if ! "$FASTBOOT_PATH" flash featenabler_a featenabler.img ; then exit 2 ; fi echo "flashed featenabler" sleep 1 if ! "$FASTBOOT_PATH" flash imagefv_a imagefv.img ; then exit 5 ; fi echo "flashed imagefv" sleep 1 if ! "$FASTBOOT_PATH" flash multiimgoem_a multiimgoem.img ; then exit 5 ; fi echo "flashed multiimgoem" sleep 1 if ! "$FASTBOOT_PATH" flash qupfw_a qupfw.img ; then exit 5 ; fi echo "flashed qupfw" sleep 1 if ! "$FASTBOOT_PATH" flash uefisecapp_a uefisecapp.img ; then exit 5 ; fi echo "flashed uefisecapp" sleep 1 echo "=== Flash slot b" echo "== start with one critical slot to check if critical is unlocked" if ! "$FASTBOOT_PATH" flash xbl_config_b xbl_config.img ; then exit 5 ; fi echo "flashed config" sleep 1 echo "== flash uncritical slots" if ! "$FASTBOOT_PATH" flash bluetooth_b bluetooth.img ; then exit 2 ; fi echo "flashed bluetooth" if ! "$FASTBOOT_PATH" flash xbl_config_a xbl_config.img ; then exit 5 ; fi echo "flashed xbl_config" sleep 1 if ! "$FASTBOOT_PATH" flash dsp_b dsp.img ; then exit 2 ; fi echo "flashed dsp" if ! "$FASTBOOT_PATH" flash core_nhlos_a core_nhlos.img ; then exit 2 ; fi echo "flashed core_nhlos" sleep 1 if ! "$FASTBOOT_PATH" flash modem_b modem.img ; then exit 2 ; fi echo "flashed modem" echo "=== Flash slot b ===" if ! "$FASTBOOT_PATH" flash bluetooth_b bluetooth.img ; then exit 2 ; fi echo "flashed bluetooth_b" sleep 1 if ! "$FASTBOOT_PATH" flash boot_b boot.img ; then exit 2 ; fi echo "flashed boot" if ! "$FASTBOOT_PATH" flash devcfg_b devcfg.img ; then exit 5 ; fi echo "flashed devcfg_b" sleep 1 if ! "$FASTBOOT_PATH" flash recovery_b recovery.img ; then exit 2 ; fi echo "flashed recovery" if ! "$FASTBOOT_PATH" flash dsp_b dsp.img ; then exit 2 ; fi echo "flashed dsp_b" sleep 1 if ! "$FASTBOOT_PATH" flash dtbo_b dtbo.img ; then exit 2 ; fi echo "flashed dtbo" if ! "$FASTBOOT_PATH" flash modem_b modem.img ; then exit 2 ; fi echo "flashed modem_b" sleep 1 if ! "$FASTBOOT_PATH" flash vbmeta_system_b vbmeta_system.img ; then exit 2 ; fi echo "flashed vbmeta_system" if ! "$FASTBOOT_PATH" flash xbl_b xbl.img ; then exit 5 ; fi echo "flashed xbl_b" sleep 1 if ! "$FASTBOOT_PATH" flash vbmeta_b vbmeta.img ; then exit 2 ; fi echo "flashed vbmeta" if ! "$FASTBOOT_PATH" flash tz_b tz.img ; then exit 5 ; fi echo "flashed tz_b" sleep 1 if ! "$FASTBOOT_PATH" flash featenabler_b featenabler.img ; then exit 2 ; fi echo "flashed featenabler" if ! "$FASTBOOT_PATH" flash hyp_b hyp.img ; then exit 5 ; fi echo "flashed hyp_b" sleep 1 if ! "$FASTBOOT_PATH" flash core_nhlos_b core_nhlos.img ; then exit 2 ; fi echo "flashed core_nhlos" if ! "$FASTBOOT_PATH" flash keymaster_b keymaster.img ; then exit 5 ; fi echo "flashed keymaster_b" sleep 1 echo "=== Flash critical slots" if ! "$FASTBOOT_PATH" flash devcfg_b devcfg.img ; then exit 5 ; fi echo "flashed devcfg" if ! "$FASTBOOT_PATH" flash abl_b abl.img ; then exit 5 ; fi echo "flashed abl_b" sleep 1 if ! "$FASTBOOT_PATH" flash xbl_b xbl.img ; then exit 5 ; fi echo "flashed xbl" if ! "$FASTBOOT_PATH" flash boot_b boot.img ; then exit 2 ; fi echo "flashed boot_b" sleep 1 if ! "$FASTBOOT_PATH" flash tz_b tz.img ; then exit 5 ; fi echo "flashed tz" if ! "$FASTBOOT_PATH" flash recovery_b recovery.img ; then exit 2 ; fi echo "flashed recovery_b" sleep 1 if ! "$FASTBOOT_PATH" flash hyp_b hyp.img ; then exit 5 ; fi echo "flashed hyp" if ! "$FASTBOOT_PATH" flash dtbo_b dtbo.img ; then exit 2 ; fi echo "flashed dtbo_b" sleep 1 if ! "$FASTBOOT_PATH" flash keymaster_b keymaster.img ; then exit 5 ; fi echo "flashed keymaster" if ! "$FASTBOOT_PATH" flash vbmeta_system_b vbmeta_system.img ; then exit 2 ; fi echo "flashed vbmeta_system_b" sleep 1 if ! "$FASTBOOT_PATH" flash abl_b abl.img ; then exit 5 ; fi echo "flashed abl" if ! "$FASTBOOT_PATH" flash vbmeta_b vbmeta.img ; then exit 2 ; fi echo "flashed vbmeta_b" sleep 1 if ! "$FASTBOOT_PATH" flash aop_b aop.img ; then exit 5 ; fi echo "flashed aop_b" sleep 1 echo "flashed aop" if ! "$FASTBOOT_PATH" flash featenabler_b featenabler.img ; then exit 2 ; fi echo "flashed featenabler_b" sleep 1 if ! "$FASTBOOT_PATH" flash imagefv_b imagefv.img ; then exit 5 ; fi echo "flashed imagefv" echo "flashed imagefv_b" sleep 1 if ! "$FASTBOOT_PATH" flash multiimgoem_b multiimgoem.img ; then exit 5 ; fi echo "flashed multiimgoem" echo "flashed multiimgoem_b" sleep 1 if ! "$FASTBOOT_PATH" flash qupfw_b qupfw.img ; then exit 5 ; fi echo "flashed qupfw" echo "flashed qupfw_b" sleep 1 if ! "$FASTBOOT_PATH" flash uefisecapp_b uefisecapp.img ; then exit 5 ; fi echo "flashed uefisecapp" echo "flashed uefisecapp_b" sleep 1 echo "=== Flash common slot" if ! "$FASTBOOT_PATH" flash super super.img ; then exit 2 ; fi echo "flashed super" if ! "$FASTBOOT_PATH" flash xbl_config_b xbl_config.img ; then exit 5 ; fi echo "flashed xbl_config_b" sleep 1 echo "=== Wipe user data and meta data in 5 seconds..." if ! "$FASTBOOT_PATH" flash core_nhlos_b core_nhlos.img ; then exit 2 ; fi echo "flashed core_nhlos_b" sleep 1 echo "=== Wiping userdata and metadata ===" sleep 3 if ! "$FASTBOOT_PATH" erase userdata ; then exit 1 ; fi echo "wiped userdata" sleep 1 if ! "$FASTBOOT_PATH" erase metadata ; then exit 1 ; fi echo "user and meta data wiped" echo "wiped metadata" sleep 3 echo "Select slot a for booting..." echo "=== Setting active slot to a ===" if ! "$FASTBOOT_PATH" --set-active=a ; then exit 4 ; fi echo "boot from slot a selected" echo "switched to slot a"
flash-scripts/linux/fp4_lock.sh +16 −9 Original line number Diff line number Diff line #!/bin/bash # Copyright (C) 2020 ECORP SAS - Author: Vincent Bourgmayer # Updated ff2u # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by Loading @@ -23,17 +22,25 @@ # Exit status # - 0 : success # - 1 : Error # - 101 : no device found in fastboot # - 102 : locking the bootloader failed FASTBOOT_FOLDER_PATH=$1 FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" echo "fastboot path: $FASTBOOT_PATH" #1 On check that device is in recovery mode if ! "$FASTBOOT_PATH" devices 2>&1 | grep "fastboot" then echo "Device not detected in fastboot" exit 101 fi # Lock the bootloader if ! "$FASTBOOT_PATH" flashing lock ; then exit 102 ; fi #Then we wait that it left this state while [ "$($FASTBOOT_PATH devices | grep -q fastboot; echo $?)" = 0 ] do sleep 1s done if ! "$FASTBOOT_PATH" flashing lock then exit 102 fi sleep 10
flash-scripts/linux/fp4_lock_critical.sh +5 −9 Original line number Diff line number Diff line Loading @@ -23,23 +23,19 @@ # Exit status # - 0 : success # - 1 : Error # - 102 : locking the bootloader failed # - 101 : locking the bootloader failed FASTBOOT_FOLDER_PATH=$1 FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" # Lock the bootloader if [ "$($FASTBOOT_PATH flashing lock_critical; echo $?)" = 1 ] then if [ "$($FASTBOOT_PATH flashing lock_critical 2>&1 | grep -q "Device already : locked!"; echo $?)" = 0 ] then echo "Critical partitions already locked" else echo "OEM-lock fails" exit 10 fi echo "Lock Critical fails!" exit 101 fi sleep 10s echo "Critical locked!" #Then we wait that it left this state while [ "$($FASTBOOT_PATH devices | grep -q fastboot; echo $?)" = 0 ] Loading
flash-scripts/linux/fp4_oem-unlock-critical.sh +9 −9 Original line number Diff line number Diff line Loading @@ -27,16 +27,16 @@ FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" echo "fastboot path: $FASTBOOT_PATH" if [ "$($FASTBOOT_PATH flashing unlock_critical; echo $?)" = 1 ] then if [ "$($FASTBOOT_PATH flashing unlock_critical 2>&1 | grep -q "Device already : unlocked!"; echo $?)" = 0 ] if [ "$($FASTBOOT_PATH oem device-info 2>&1 | grep -q "critical unlocked: true"; echo $?)" = 0 ] then echo "Critical partitions already unlocked" sleep 10s echo "Device already critically unlocked!" else echo "OEM-unlock fails" if [ "$($FASTBOOT_PATH flashing unlock_critical; echo $?)" = 1 ] then echo "Crtical unlock fails!" exit 10 fi fi sleep 10s echo "OEM unlocked" echo "Critical unlocked!" fi
flash-scripts/linux/fp4_oem-unlock.sh +1 −3 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ echo "fastboot path: $FASTBOOT_PATH" if [ "$($FASTBOOT_PATH getvar unlocked 2>&1 | grep -q yes; echo $?)" = 0 ] then sleep 10s echo "Device already unlocked" else if [ "$($FASTBOOT_PATH flashing unlock; echo $?)" = 1 ] Loading @@ -39,6 +40,3 @@ else sleep 10s echo "OEM unlocked" fi