Last active
October 14, 2024 16:17
-
-
Save mmtrt/f1793210429640c39039dc1ac7f2a79b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SCRIPT_PATH=$(dirname $0) | |
handle_error(){ | |
echo $@ | |
exit 2; | |
} | |
#flash images | |
fastboot $* erase boot || handle_error erase boot error | |
fastboot $* erase metadata || handle_error erase metadata error | |
fastboot $* flash preloader_a `dirname $0`/preloader_raw.img || handle_error flash preloader_a error | |
fastboot $* flash preloader_b `dirname $0`/preloader_raw.img || handle_error flash preloader_b error | |
fastboot $* flash logo_a `dirname $0`/logo.img | |
if [ $? -ne 0 ] ; then echo "Flash logo_a error"; exit 1; fi | |
fastboot $* flash logo_b `dirname $0`/logo.img | |
if [ $? -ne 0 ] ; then echo "Flash logo_b error"; exit 1; fi | |
fastboot $* flash tee_a `dirname $0`/tee.img | |
if [ $? -ne 0 ] ; then echo "Flash tee_a error"; exit 1; fi | |
fastboot $* flash tee_b `dirname $0`/tee.img | |
if [ $? -ne 0 ] ; then echo "Flash tee_b error"; exit 1; fi | |
fastboot $* flash scp_a `dirname $0`/scp.img | |
if [ $? -ne 0 ] ; then echo "Flash scp_a error"; exit 1; fi | |
fastboot $* flash scp_b `dirname $0`/scp.img | |
if [ $? -ne 0 ] ; then echo "Flash scp_b error"; exit 1; fi | |
fastboot $* flash sspm_a `dirname $0`/sspm.img | |
if [ $? -ne 0 ] ; then echo "Flash sspm_a error"; exit 1; fi | |
fastboot $* flash sspm_b `dirname $0`/sspm.img | |
if [ $? -ne 0 ] ; then echo "Flash sspm_b error"; exit 1; fi | |
fastboot $* flash lk_a `dirname $0`/lk.img | |
if [ $? -ne 0 ] ; then echo "Flash lk_a error"; exit 1; fi | |
fastboot $* flash lk_b `dirname $0`/lk.img | |
if [ $? -ne 0 ] ; then echo "Flash lk_b error"; exit 1; fi | |
fastboot $* flash boot_a `dirname $0`/boot.img | |
if [ $? -ne 0 ] ; then echo "Flash boot_a error"; exit 1; fi | |
fastboot $* flash boot_b `dirname $0`/boot.img | |
if [ $? -ne 0 ] ; then echo "Flash boot_b error"; exit 1; fi | |
fastboot $* flash pi_img_a `dirname $0`/pi_img.img | |
if [ $? -ne 0 ] ; then echo "Flash pi_img_a error"; exit 1; fi | |
fastboot $* flash pi_img_b `dirname $0`/pi_img.img | |
if [ $? -ne 0 ] ; then echo "Flash pi_img_b error"; exit 1; fi | |
fastboot $* flash dpm_a `dirname $0`/dpm.img | |
if [ $? -ne 0 ] ; then echo "Flash dpm_a error"; exit 1; fi | |
fastboot $* flash dpm_b `dirname $0`/dpm.img | |
if [ $? -ne 0 ] ; then echo "Flash dpm_b error"; exit 1; fi | |
fastboot $* flash mcupm_a `dirname $0`/mcupm.img | |
if [ $? -ne 0 ] ; then echo "Flash mcupm_a error"; exit 1; fi | |
fastboot $* flash mcupm_b `dirname $0`/mcupm.img | |
if [ $? -ne 0 ] ; then echo "Flash mcupm_b error"; exit 1; fi | |
fastboot $* flash gz_a `dirname $0`/gz.img | |
if [ $? -ne 0 ] ; then echo "Flash gz_a error"; exit 1; fi | |
fastboot $* flash gz_b `dirname $0`/gz.img | |
if [ $? -ne 0 ] ; then echo "Flash gz_b error"; exit 1; fi | |
fastboot $* flash dtbo_a `dirname $0`/dtbo.img | |
if [ $? -ne 0 ] ; then echo "Flash dtbo_a error"; exit 1; fi | |
fastboot $* flash dtbo_b `dirname $0`/dtbo.img | |
if [ $? -ne 0 ] ; then echo "Flash dtbo_b error"; exit 1; fi | |
fastboot $* flash vbmeta_a `dirname $0`/vbmeta.img | |
if [ $? -ne 0 ] ; then echo "Flash vbmeta_a error"; exit 1; fi | |
fastboot $* flash vbmeta_b `dirname $0`/vbmeta.img | |
if [ $? -ne 0 ] ; then echo "Flash vbmeta_b error"; exit 1; fi | |
fastboot $* flash spmfw_a `dirname $0`/spmfw.img | |
if [ $? -ne 0 ] ; then echo "Flash spmfw_a error"; exit 1; fi | |
fastboot $* flash spmfw_b `dirname $0`/spmfw.img | |
if [ $? -ne 0 ] ; then echo "Flash spmfw_b error"; exit 1; fi | |
fastboot $* flash md1img_a `dirname $0`/md1img.img | |
if [ $? -ne 0 ] ; then echo "Flash md1img_a error"; exit 1; fi | |
fastboot $* flash vbmeta_system_a `dirname $0`/vbmeta_system.img | |
if [ $? -ne 0 ] ; then echo "Flash vbmeta_system_a error"; exit 1; fi | |
fastboot $* flash vbmeta_vendor_a `dirname $0`/vbmeta_vendor.img | |
if [ $? -ne 0 ] ; then echo "Flash vbmeta_vendor_a error"; exit 1; fi | |
fastboot $* flash vbmeta_system_b `dirname $0`/vbmeta_system.img | |
if [ $? -ne 0 ] ; then echo "Flash vbmeta_system_b error"; exit 1; fi | |
fastboot $* flash vbmeta_vendor_b `dirname $0`/vbmeta_vendor.img | |
if [ $? -ne 0 ] ; then echo "Flash vbmeta_vendor_b error"; exit 1; fi | |
#flash logical partitions | |
fastboot reboot fastboot | |
fastboot $* flash mi_ext `dirname $0`/mi_ext.img | |
if [ $? -ne 0 ] ; then echo "Flash mi_ext error"; exit 1; fi | |
fastboot $* flash product `dirname $0`/product.img | |
if [ $? -ne 0 ] ; then echo "Flash product error"; exit 1; fi | |
fastboot $* flash vendor_a `dirname $0`/vendor.img | |
if [ $? -ne 0 ] ; then echo "Flash vendor_a error"; exit 1; fi | |
fastboot $* flash system_a `dirname $0`/system.img | |
if [ $? -ne 0 ] ; then echo "Flash system_a error"; exit 1; fi | |
fastboot $* flash system_ext_a `dirname $0`/system_ext.img | |
if [ $? -ne 0 ] ; then echo "Flash system_ext_a error"; exit 1; fi | |
fastboot reboot bootloader | |
fastboot $* set_active a | |
if [ $? -ne 0 ] ; then echo "boot from slot a"; exit 1; fi | |
fastboot $* oem cdms | |
fastboot erase userdata | |
# reboot | |
fastboot $* reboot | |
if [ $? -ne 0 ] ; then echo "Reboot error"; exit 1; fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment