Created
November 22, 2014 13:06
-
-
Save eyecatchup/50538a628dc8c1b08d22 to your computer and use it in GitHub Desktop.
The safest way to flash factory images - This is a manual step-by-step procedure to flash Android 5.0 (LRX21T) factory images onto the Nexus 4 (aka mako).
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
# Create a new working directory and cd into it | |
~$ mkdir -p /path/n4update && cd /path/n4update | |
# Download all files you need | |
/path/n4update$ wget --no-check-certificates https://dl.google.com/dl/android/aosp/occam-lrx21t-factory-51cee750.tgz | |
# Download openrecovery-twrp-2.8.2.0-mako.img from http://techerrata.com/browse/twrp2/mako to the same path | |
# Download CF-Auto-Root-mako-occam-nexus4.zip from http://autoroot.chainfire.eu to the same path | |
# Extract downloaded file archives | |
/path/n4update$ mkdir -p ./images && tar zxvf occam-lrx21t-factory-51cee750.tgz -C ./images | |
/path/n4update$ unzip -jXVK ./images/occam-lrx21t/image-occam-lrx21t.zip -d ./images/occam-lrx21t | |
/path/n4update$ unzip -XVK CF-Auto-Root-mako-occam-nexus4.zip -d ./cf | |
# Remove unneeded archive files | |
/path/n4update$ rm CF-Auto-Root-mako-occam-nexus4.zip | |
/path/n4update$ rm occam-lrx21t-factory-51cee750.tgz | |
/path/n4update$ rm ./images/occam-lrx21t/image-occam-lrx21t.zip | |
# Update required flashing utility tools via SDK manager's command line options | |
/path/n4update$ android.[bat|sh] update sdk -u -t platform-tools,tools | |
/path/n4update$ android.[bat|sh] update adb | |
# Boot into bootloader mode | |
/path/n4update$ adb reboot bootloader | |
# In bootloader mode, make sure the device is recognized | |
/path/n4update$ fastboot devices | |
# Erase old boot, cache, system & userdata partitions | |
/path/n4update$ fastboot erase boot | |
/path/n4update$ fastboot erase cache | |
/path/n4update$ fastboot erase system | |
/path/n4update$ fastboot erase userdata | |
# IGNORE THIS COMMAND, IF YOU HAVE A CUSTOM RECOVERY INSTALLED AND WANT TO KEEP IT. | |
# IF YOU HAVE THE STOCK RECOVERY, DO NOT IGNORE THE NEXT LINE. | |
/path/n4update$ fastboot erase recovery | |
# Flash new bootloader & reboot into | |
/path/n4update$ fastboot flash bootloader ./images/occam-lrx21t/bootloader-mako-makoz30f.img | |
/path/n4update$ fastboot reboot-bootloader | |
# Flash new radio & reboot bootloader | |
/path/n4update$ fastboot flash radio ./images/occam-lrx21t/radio-mako-m9615a-cefwmazm-2.0.1701.04.img | |
/path/n4update$ fastboot reboot-bootloader | |
# Do wipe again. | |
/path/n4update$ fastboot -w | |
# Flash new boot, cache, system & userdata partitions | |
/path/n4update$ fastboot flash system ./images/occam-lrx21t/system.img | |
/path/n4update$ fastboot flash userdata ./images/occam-lrx21t/userdata.img | |
/path/n4update$ fastboot flash cache ./images/occam-lrx21t/cache.img | |
/path/n4update$ fastboot flash boot ./images/occam-lrx21t/boot.img | |
# ONLY REQUIRED, IF YOU ERASED THE RECOVERY PARTITION BEFORE. | |
# USE ONLY ONE OF THE FOLLOWING TWO LINES (1. Stock, 2. TWRP)! | |
/path/n4update$ fastboot flash recovery ./images/occam-lrx21t/recovery.img | |
/path/n4update$ fastboot flash recovery ./openrecovery-twrp-2.8.2.0-mako.img | |
# Reboot the system using the CF-Auto-Root boot image | |
/path/n4update$ fastboot boot ./cf/image/CF-Auto-Root-mako-occam-nexus4.img | |
# Device will reboot when CF-Auto-Root finished its job. | |
# Done. | |
# Bye |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment