UPDATE `NEXUS 5`
SET `VERSION`='5.1', `BUILD`='LMY47D', `RECOVERY`='CUSTOM', `ROOTED`=1
WHERE `VERSION`='5.0.1' && `BUILD`='LRX22C' && `RECOVERY`='CUSTOM' && `ROOTED`=1
&& `WANNA_KEEP_USERDATA`=1;
This guide is forked and updated for Android 5.1 OTA from me. Big thanks to the original author eyecatchup and his guide from LRX21O to LRX22C here.
This guide also works without any problems for encrypted phones because data partition is not touched.
When you tampered with the Android system, you can't install OTAs; installation
fails. Sometimes it's enough to flash the stock recovery to use adb sideload update.zip
, but often, especially when you tampered a lot, this also fails.
Even after unrooting and flashing stock boot, recovery and cache it can fail. So one might ask whether the only way is to do a clean install using the latest factory image instead. For those who ask themselves this question: Before you do so, take a minute and read on.
This document describes how I successfully updated my Nexus 5 from stock Android 5.0.1 (LRX22C) with TWRP 2.8.2.0 and rooted with SuperSU to Android 5.1 (LMY47D) with TWRP 2.8.5.2 and rooted with SuperSU - without loosing user data.
NOTE: The steps outlined in this document assume the Android SDK to be
installed on your PC and the adb
, fastboot
and android.[bat|sh]
to be
in your PATH
variable! Oh, and if it burns down your house, it's not my
fault. Proceed at own risk.
-
Download OTA zip from Google's servers to your PC. http://android.clients.google.com/packages/ota/google_hammerhead/e16268c5a3df75a65054ab258d7d615288b7e3b4.signed-hammerhead-ota-LMY47D-from-LRX22C-radio-restricted.zip -
e16268c5a3df75a65054ab258d7d615288b7e3b4.signed-hammerhead-ota-LMY47D-from-LRX22C-radio-restricted.zip
-
Rename the downloaded zip to 'update.zip' (without the quotes (and if you're on windows and known file extension are hidden, make sure you not end up with update.zip.zip).
-
To the same folder, download the latest SuperSU flashable zip.
http://download.chainfire.eu/supersu -UPDATE-SuperSU-v2.46.zip
-
To the same folder, download the latest TWRP recovery image for hammerhead.
http://techerrata.com/browse/twrp2/hammerhead -openrecovery-twrp-2.8.5.2-hammerhead.img
-
To the same folder, download the 5.0.1 factory image tgz archive from Google's servers.
https://developers.google.com/android/nexus/images#hammerheadlrx22c -hammerhead-lrx22c-factory-0f9eda1b.tgz
-
From the 5.0.1 tgz archive extract the
recovery.img
,boot.img
andsystem.img
files to the same directory where your downloads are located.
(Tip: With 7zip, for example, you can 'internally' open the archives within the archive and extract just the files you need. The same is possible with command line tools, of course.)
The directory structure should look like this now:
..
boot.img
openrecovery-twrp-2.8.5.2-hammerhead.img
recovery.img
system.img
update.zip
UPDATE-SuperSU-v2.46.zip
Open a terminal on your PC and cd into the directory where your downloaded files are located. Now go on by running the commands in the terminal as follows (type only those lines prefixed with '> ', but without actually typing the '> '!).
# On Windows:
> android.bat update sdk -u -t platform-tools,tools
# On Linux/Mac:
> android.sh update sdk -u -t platform-tools,tools
You may need to accept a license agreement. Type 'y' and hit enter.
Do you accept the license 'android-sdk-license-5be876d5' [y/n]: y
Installing Archives:
Preparing to install archives
Downloading Android SDK Tools, revision 24.0.2
Installing Android SDK Tools, revision 24.0.2
Installed Android SDK Tools, revision 24.0.299%)
Done. 1 package installed.</code>
# On Windows:
> android.bat update adb
# On Linux/Mac:
> android.sh update adb
If adb was updated, command line will ask you to restart it. Do so.
adb has been updated. You must restart adb with the following commands
adb kill-server
adb start-server
--
Now, we're finally ready to go..
Connect your device (USB debugging enabled, of course) to your PC.
Back at your terminal, go on by running the commands as follows (type only those lines prefixed with '> ', but without actually typing the '> '!).
# Make sure the device is recognized
> adb devices
# Boot into bootloader mode
> adb reboot bootloader
# In bootloader mode, make again sure the device is recognized
> fastboot devices
# Flash stock LRX22C recovery image
> fastboot flash recovery recovery.img
# Flash stock LRX22C system image
> fastboot flash system system.img
# Flash stock LRX22C boot image
> fastboot flash boot boot.img
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. When the device says it's awaiting commands, type from the PC's command line:
adb sideload update.zip
When OTA update successfully installed, select 'reboot bootloader' from the recovery options again using the volume rockers and press the power button.
Back in bootloader mode, type from the PC's command line:
fastboot flash recovery openrecovery-twrp-2.8.5.2-hammerhead.img
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. When the device says it's awaiting commands, type from the PC's command line:
adb sideload UPDATE-SuperSU-v2.46.zip
When done, confirm to reboot system. Finished. Mission completed.
You're now on 5.1 with your custom recovery, rooted and can pick up from where you left.
All apps, customizations, settings, SD-Card contents are still there. Maybe only some root apps need to be installed again.
PS: First boot, as always, will take some minutes.