Warning: This process is recommended for those who are familar with flashing using custom recoveries, proceed at your own risk. Make a backup of your device before proceeding. You take your own risk and I'm not responsible for any damages to your phone. If you are not familar at using custom recoveries and do not know how to use fastboot to return your Nexus to stock, stop here.
WHAT IS IT
These are flashable zip packages compatible with custom recoveries (CWM and TWRP) that will install factory stock image files to the Nexus 4 and returning it to factory state. The image files being flashed are unmodified stock image (*.img) files. The purpose I made these packages is to make it easy to return to factory stock for those who have rooted. The flashable packages will check to make sure if the device is a Nexus 4 before flashing.
INSTRUCTIONS
0. Backup
Make a nandriod backup of your current working rom and copy the backup to your PC incase you need to restore it.
This is not necessary, but if you previously re-locked your bootloader, make sure your bootloader is unlocked (use this app to unlock bootloader without wiping data) so in case things goes wrong you can install custom recovery and retrieve your data.
1. Download the flashable zip packages and flash them using custom recoveries
The full firmware is split up into 5 packages so you can flash each "partition" individually, or retain certain ones you want to keep. Images available for flashing:
[bootloader, boot (kernel), radio (baseband), recovery, system (the main OS)]
(download links in bottom of post)
It is recommended to wipe "system" partition first if you'll be flashing over it.
Notice: The "userdata.img" is not included for flashing, which mean your user installed apps, settings and internal storage files will not be erased. (This do not pertain to system installed apps (apps located in /system/app) and their settings, as well as root. These will be erased when you flash the "system" package.)
2. If you flashed the "system" zip package, it is not required, though highly recommended do a "factory reset" wipe or "fix permissions" to prevent system errors
If you have flashed the "system" package, which contain the main OS files, I recommend two things before rebooting:
A. Factory reset
Factory reset using custom recoveries will erase your apps and settings, but leave your internal storage files alone. This will ensure you don't have any bugs when switching between different Android version or roms.
Do not use the factory reset option in stock android or stock recovery unless you must, unlike with custom recoveries they will wipe your internal storage (this is where all your photos, music and downloaded files are located). Custom recoveries leave them alone unless you specifically wipe internal storage (also known as "/data/media").
B. If you want to keep your apps, settings and not do a factory reset
Do a "Fix Permissions" in your custom recovery.
Due to potential mismatching of settings between your previously installed rom and the newly installed stock rom, it may cause serious errors. This will not likely be an issue if you go from an older stock Android version to a new one. No guarantee however.
However, when the user migrate from between different custom roms or going from a custom rom back to stock while retaining apps data, issues can and will arise. You may receive a "System UIDs inconsistent" error. If you do, boot into custom recovery and apply "Fix Permissions". This may not resolve all errors, in which case the only remedy is to do a factory reset. The results will vary depending on the rom you used previously and your specific settings.
Hints:
The CWM version I'm using for the Nexus 4 doesn't include a 'fix permissions' option, you might want to use TWRP instead.
Reboot and cross your fingers.
DOWNLOAD
MD5 sums
Code:ba9dce78e97defdbdfd7fd8e4dba4acf stock_occam_bootloader_makoz30d.zip f74abac18d620267c15c48b622525f6a stock_occam_kot49h_boot_3.4.0-perf-g2cae413.zip 0a82fee97cd2629d77d6fc103947a6aa stock_occam_kot49h_radio_m9615a-cefwmazm-2.0.1700.98.zip 2e139b2851049093c0c063ab0999a7d2 stock_occam_kot49h_recovery.zip aa851415a7b1502def8e6cb239ff64ec stock_occam_kot49h_system_4.4.2.zip
How these packages are made:
-The bootloader files are taken from official Google OTA update package.
-The boot, radio and recovery img are taken from official Google factory image.
-The original system.img is 'sparse' and had to be unsparse to be compatible with custom recoveries, however all files within are unmodified. For more info, see here.
-The script file for each flash package is called "updater-script", which is located in the folder "/meta-inf/com/google/android/" in each zip files. Don't edit it if you don't know what you're doing though.
Last edited: