Created
January 27, 2018 05:15
-
-
Save npjohnson/834104da1aa423f6254d773e4e4c2427 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
#!/bin/sh | |
# Copyright 2012 The Android Open Source Project | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# Variables | |
BUILD_ID=OCX27.109-36 | |
CARRIER=T-Mobile | |
# Device Check | |
echo -n "Are you on a Bootloader Unlocked $CARRIER Moto Z2 Force? (y/n)? " | |
read answer | |
if echo "$answer" | grep -iq "^y" ;then | |
echo "Continuing Flash..." | |
else | |
echo "You aren't on the correct device." | |
fi | |
# Hacky Fastboot Version Check | |
if ! grep -q dtbo.sig $(which fastboot); then | |
echo "Please upgrade fastboot." | |
echo "The newest version can be found at: https://dl.google.com/android/repository/platform-tools-latest-linux.zip" | |
exit 1 | |
fi | |
# Bootloader | |
echo "Flashing Bootloader partitions..." | |
fastboot flash xbl_a xbl.img | |
fastboot flash xbl_b xbl.img | |
fastboot flash abl_a abl.img | |
fastboot flash abl_b abl.img | |
fastboot flash cmnlib_a cmnlib.img | |
fastboot flash cmnlib_b cmnlib.img | |
fastboot flash cmnlib64_a cmnlib64.img | |
fastboot flash cmnlib64_b cmnlib64.img | |
fastboot flash keymaster_a keymaster.img | |
fastboot flash keymaster_b keymaster.img | |
fastboot flash rpm_a rpm.img | |
fastboot flash rpm_b rpm.img | |
fastboot flash pmic_a pmic.img | |
fastboot flash pmic_b pmic.img | |
fastboot flash hyp_a hyp.img | |
fastboot flash hyp_b pmic.img | |
fastboot flash devcfg_a devcfg.mbm | |
fastboot flash devcfg_b devcfg.mbm | |
fastboot flash storsec_a storsec.mbm | |
fastboot flash storsec_b storsec.mbm | |
fastboot flash prov_a prov64.mbm | |
fastboot flash prov_b prov64.mbm | |
fastboot reboot-bootloader | |
sleep 5 | |
# Modem/Firmware | |
echo "Flashing Modem & Firmware partitions..." | |
fastboot flash modem_a NON-HLOS.bin | |
fastboot flash modem_b NON-HLOS.bin | |
fastboot flash fsg_a fsg.mbm | |
fastboot flash fsg_b fsg.mbm | |
fastboot erase modemst1 | |
fastboot erase modemst2 | |
fastboot flash bluetooth_a BTFM.bin | |
fastboot flash bluetooth_b BTFM.bin | |
fastboot flash dsp_a adspso.bin | |
fastboot flash dsp_b adspso.bin | |
fastboot reboot-bootloader | |
sleep 5 | |
# System/Boot/DTBO/OEM | |
echo "Flashing Boot/DTBO partitions..." | |
fastboot flash boot_a boot.img | |
fastboot flash boot_b boot.img | |
fastboot flash dto_a dto.img | |
fastboot flash dto_b dto.img | |
echo "Flashing System partition... (this may take a while)" | |
fastboot flash system_a system.img | |
fastboot flash system_b system.img | |
echo "Flashing OEM partition..." | |
fastboot flash oem_a oem.img | |
fastboot flash oem_b.img | |
# Non-Optional Wipes | |
echo "Wiping Carrier/DDR partitions..." | |
fastboot erase carrier | |
fastboot erase ddr | |
# Optional Wipe | |
echo -n "Would you like to wipe data? (y/n)? " | |
read answer1 | |
if echo "$answer1" | grep -iq "^y" ;then | |
fastboot erase userdata | |
else | |
echo "You may experience unexpected errors if your data is incompatible with the target version." | |
fi | |
echo "Flash Complete. Slots A & B are now on build $BUILD_ID for the $CARRIER Moto Z2 Force." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment