Skip to content

Instantly share code, notes, and snippets.

@ThEMarD
Created January 13, 2021 09:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThEMarD/fa301a1f6282e982282a879e3b908ad5 to your computer and use it in GitHub Desktop.
Save ThEMarD/fa301a1f6282e982282a879e3b908ad5 to your computer and use it in GitHub Desktop.
flash all script for payton pie
#!/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.
# This is based on Nolen's nash script https://gist.github.com/npjohnson/834104da1aa423f6254d773e4e4c2427
# Device Check
echo -n "Are you on a Bootloader Unlocked? (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
# 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 dspso.bin
fastboot flash dsp_b dspso.bin
fastboot reboot-bootloader
sleep 5
# System/Boot/DTBO/OEM
echo "Flashing Boot partitions..."
fastboot flash boot_a boot.img
fastboot flash boot_b boot.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 oem.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 updated."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment