Skip to content

Instantly share code, notes, and snippets.

@djhworld
Created October 24, 2015 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djhworld/fc6f6409f385b9cbc085 to your computer and use it in GitHub Desktop.
Save djhworld/fc6f6409f385b9cbc085 to your computer and use it in GitHub Desktop.
flash nexus 5 to newer android version
function prompt {
echo $1
read -p "Ready? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo
else
echo "Quitting"
exit
fi
}
FOLDER=$1
echo "FOLDER = $FOLDER"
prompt "Boot into bootloader mode"
./adb reboot bootloader
sleep 10
./fastboot devices
prompt "Going to flash recovery image, system image and boot image"
./fastboot flash recovery $FOLDER/recovery.img
./fastboot flash system $FOLDER/system.img
./fastboot flash boot $FOLDER/boot.img
prompt "When the last flash is confirmed, use the volume rockers to choose 'Recovery mode' and confirm with the power button.
When you see the little Android lying with the red triangle warning sign on it, hold the power then press the volume up button to get to the recovery options.
When you got to the recovery options, select 'apply update from ADB' using the volume rockers again and press the power button to choose it."
./adb sideload $FOLDER/update.zip
prompt "When OTA update successfully installed, select 'reboot bootloader' from the recovery options again using the volume rockers and press the power button."
./fastboot flash recovery $FOLDER/twrp-2.8.7.1-hammerhead.img
prompt "When the flash is confirmed, use the volume rockers to choose 'Recovery mode' and confirm with the power button.
Now in the TWRP recovery menu, choose 'Advanced' > 'adb sideload'. Check both option, clear 'Dalvik-Cache' and 'Clear Cache' and swipe the bar to start sideload mode. Wait for device to say it's awaiting commands..."
./adb sideload $FOLDER/UPDATE-SuperSU-v2.40.zip
echo "Finished!"
@djhworld
Copy link
Author

Note: you need to adapt the instructions here. Be careful, this script could brick your phone....

https://gist.github.com/eyecatchup/ec0a852428c19705380e

Download all the necessary files, then run the above script, with the first argument being the folder where you downloaded the files too

./nexus-android-update.sh ./511m-to-6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment