Download the correct factory image

Six files from the factory image are:

  • bootloader-mako-makoz10o.img (or whatever the name of the bootloader image that you downloaded)
  • radio-mako-m9615a-cefwmazm-2.0.1700.48.img (or whatever the name is of the radio image)
  • system.img
  • userdata.img
  • boot.img
  • recovery.img

Get the correct custom recovery

To install custom recovery:

  • Download the correct file.
  • Turn off your device.
  • Turn on the device and keep holding volume down until a menu shows up. The device will now be in fastboot mode.
  • Plug the device into your computer. If you have the right drivers installed, your screen should now say FASTBOOT USB.
  • Run the following command via the command line:
    • fastboot flash recovery recoveryfilename.img
    • Note that you will need to change the last part to match the name of the file that you just downloaded. You will also need adb and fastboot for your computer.
  • The stock ROM will automatically replace TWRP with the stock recovery. To prevent the stock ROM from replacing TWRP, boot TWRP, go to the mount menu and mount system, press the home button, then press Advanced -> File Manager. Browse to /system and select the file named recovery-from-boot.p then choose to rename the file to recovery-from-boot.bak

Follow the full manual Nexus 4 instructions here

C. Download the required files to your computer and extract them 1) All of the files that are required, need to be in one (i.e., the same) directory. It does not matter what it is called, but all the files need to be in there, with NO subfolders. EVERYTHING needs to be extracted into this one directory; 2) Download the attachment from the end of this post and extract the contents to the directory created in step 1. Note: if all you want to do is unlock your bootloader, skip to step 7 in this section (C). 3) Download the version of Android you want from here. Make sure you are using an occam image which is for the Nexus 4. Most old versions are not usually available on that site; however, there is a mirror on this site: Random Phantasmagoria. 4) Download the appropriate version (for your computer) of 7-zip from here and install it. 5) Extract the files from within the .tgz file which you downloaded in step 3 using 7-zip, not WinZip or WinRAR or whatever. 6) Make sure you have extracted ALL the files (including extracting any files in any archives inside the .tgz file). You should have six (6) files ending with .img in the directory you created in step 1. The other files you extracted from the .tgz are not necessary; 7) Reboot your device into bootloader mode (by turning it off, hold volume down, and press and hold power) and plug it into your computer; 8) Open a command prompt in the same directory (i.e., make sure you are in the same directory as your files are located). You can hold the shift key when you are in the folder in Windows explorer and right-click in a blank spot and it will open a command prompt.

D. Type in the commands into the command prompt 1) Make sure your computer recognizes your device by typing: fastboot devices 2) Unlock your bootloader (if you have not already done so): fastboot oem unlock 3) You will see a prompt on your device. This will wipe your entire device (including the /sdcard folder). Accept. Note: you use the volume keys to change the option and the power button to accept. You cannot use the touch screen. 4) Reboot by typing: fastboot reboot-bootloader 5) Flash the bootloader: fastboot flash bootloader bootloader-mako-makoz10o.img (or whatever the name of the bootloader image that you downloaded). 6) Reboot: fastboot reboot-bootloader 7) Flash the radio: fastboot flash radio radio-mako-m9615a-cefwmazm-2.0.1700.48.img (or whatever the name is of the radio image that you downloaded). 8) Reboot: fastboot reboot-bootloader 9) Flash the system partition: fastboot flash system system.img 10) Flash the data partition: fastboot flash userdata userdata.img Note: this command will wipe your device (including /sdcard), EVEN if your bootloader is already unlocked. See note 2 below. 11) Flash the kernel/ramdisk: fastboot flash boot boot.img 12) Flash the recovery partition: fastboot flash recovery recovery.img 13) Erase the cache partition: either a) fastboot erase cache OR b) fastboot format cache <<== the second option seems to work better for most people. Thanks joostburg. 14) Reboot: fastboot reboot 15) Done! The first boot will likely take quite a bit longer than you are used to, as Android builds the Dalvik cache.

To root, use the WUG Nexus root toolkit

To restore factory boot or recovery

You said you're running 4.2.2 stock, not a custom ROM, so unless you've made any significant changes to your system you should be able to update when one is released without much issue. You will probably need to reflash the stock kernel and likely recovery as well. Both of these can be pulled out of the factory image downloadable from Google and flashed in fastboot. The files in the factory image will be named recovery.img and boot.img for the recovery and kernel, respectively. You flash them in fastboot using:

  • fastboot flash recovery recovery.img
  • fastboot flash boot boot.img

Easy as that.

To undo Franco Kernel


I keep getting "/system/bin/thermal-engine-hh" has unexpected contents

    Franco Kernel? Here's what you do:

    Rename /system/lib/hw/ to /system/lib/hw/ 
    Rename /system/bin/thermal-engine-hh-bak to /system/bin/thermal-engine-hh

    Flash stock kernel - Reboot to the bootloader and flash stock Kernel by downloading the Nexus images and then fastboot flash boot boot.img (or restore if using FK Updater)

Page last modified on December 05, 2013, at 11:39 PM