Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save diegoponciano/9254375090143e0daf3d to your computer and use it in GitHub Desktop.
Save diegoponciano/9254375090143e0daf3d to your computer and use it in GitHub Desktop.
# 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-lrx22c-factory-86c04af6.tgz
# Download openrecovery-twrp-2.8.3.2-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-lrx22c-factory-86c04af6.tgz -C ./images
/path/n4update$ unzip -jXVK ./images/occam-lrx22c/image-occam-lrx22c.zip -d ./images/occam-lrx22c
/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-lrx22c-factory-86c04af6.tgz
/path/n4update$ rm ./images/occam-lrx22c/image-occam-lrx22c.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-lrx22c/bootloader-mako-makoz30f.img
/path/n4update$ fastboot reboot-bootloader
# Flash new radio & reboot bootloader
/path/n4update$ fastboot flash radio ./images/occam-lrx22c/radio-mako-m9615a-cefwmazm-2.0.1701.05.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-lrx22c/system.img
/path/n4update$ fastboot flash userdata ./images/occam-lrx22c/userdata.img
/path/n4update$ fastboot flash cache ./images/occam-lrx22c/cache.img
/path/n4update$ fastboot flash boot ./images/occam-lrx22c/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-lrx22c/recovery.img
/path/n4update$ fastboot flash recovery ./openrecovery-twrp-2.8.3.2-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