[Motorola Photon Q 4G LTE] thedarkness000:
[How-To] Re-stock the XT897 and update to Jelly Bean

Well, I've got Jelly Bean working now so, as promised, I'll outline how I did it. I'm not going to get much sleep tonight, but that's okay! :laugh:

This method is only useful if you're having trouble flashing using RSD Lite. It is much easier to flash one of the official firmware images, then update to JB.

READ THIS BEFORE YOU START!

Before you even think about starting this process, make sure you have a backup of your phone's current state in case something goes wrong. The instructions below will necessarily contain a backup step in order to set up your TWRP backup directory, but redundancy never hurts.

I would also recommend backing up your applications and data in an easy-to-restore way (like using Titanium Backup). That way, you can restore most of your apps right back the way they were once you get Jelly Bean.

Preparation

You're gonna need quite a few files to complete this process. As I'm still under the 10-post minimum to allow posting of links, this might get a little messy, but bear with me. I've included the .crc files for the OTA updates as well. I'm not sure if they're absolutely necessary, but I always had them in place when applying the updates.

You will need the following files:

drakeheart77's (almost) stock image (grab everything except the stock recovery)

hxxp://d-h.st/NVc - the XT897 stock recovery image (it's >1% different than the recovery image that drakeheart77 links, but I'm posting the exact version I used just to be sure)

hxxp://d-h.st/s5L - the TWRP recovery image for the XT897 (originally found somewhere on xda-dev forums, can't re-find it now)

hxxp://d-h.st/HPt - the modem from the SPR-89_ASA-36-42 firmware image (you can also grab the image from hxxp://sbf.droid-developers.org/asanti_c/list.php and extract the modem yourself, if you're feeling adventurous)

hxxp://d-h.st/iry - the 77.6.36 to 77.8.10 OTA

hxxp://d-h.st/1NQ - and its .crc file

hxxp://d-h.st/f3Y - the 77.8.10 to 77.8.14 OTA

hxxp://d-h.st/Yla - and its .crc file

hxxp://d-h.st/P0n - the 77.8.14 to 98.10.5 OTA (a.k.a. the JB update)

hxxp://d-h.st/x9p - and its .crc file

MD5/SHA1 Checksums

recovery.img

MD5: 46cb664521f98b1c1987c288a101a5ec

SHA1: f5fb0e11ee4137824849e0fa8f9f9a2b93967093

openrecovery-twrp-2.5.0.0-asanti_c.img

MD5: c1a78e0b8ea627d3ff62dba1908e365a

SHA1: 33673e33e88c5a3034a07fe79268b31efe3991cc

NON-HLOS.bin

MD5: c89ce1ffac4fe7368fd9a0bca95ca217

SHA1: 0b88d9f3054f1c0fd961c08c61884c7c74f57396

Blur_Version.77.6.36.XT897.Sprint.en.US.zip

MD5: 1c58b7d5f32de0429142b19eb08cfd51

SHA1: 112d889e7d67226cad4375c0f51ec7acba37d72c

Blur_Version.77.8.10.XT897.Sprint.en.US.zip

MD5: 4d495ed0aae135636d40ca9a0d82642f

SHA1: be872a53055fb6031569edd46426b6972d76a256

Blur_Version.77.8.14.XT897.Sprint.en.US.zip

MD5: 40f10865036deefdf53af5d5fa6f8c90

SHA1: bc59855a2a95a80ae80e102860621236fb9e1a55

Notes for Noobs

I'm going to quickly detail here how to get into the recovery console and bootloader. If you already know how, skip ahead to the next section.

Recovery

You can access the recovery console in two ways:

Enable USB debugging on your phone (Settings > Developer options > USB debugging)

Hook up your phone to your PC (while the phone is powered on)

From your Android SDK tools directory, run adb reboot recovery

-OR-

While the phone is either off or in the bootloader:

Press the Volume Up button

Whilst holding Volume Up, press the power button

Hold both for about 2 seconds

Release the power button

Continue to hold Volume Up until you see the dead Android (stock) or the TeamWin logo (TWRP)

For the stock recovery, you need to press Volume Up and Volume Down simultaneously to bring up the menu. Vol Up/Dn navigates, Power selects the highlighted option.

Bootloader

You can access the bootloader in two ways:

Enable USB debugging on your phone (Settings > Developer options > USB debugging)

Hook up your phone to your PC (while the phone is powered on)

From your Android SDK tools directory, run adb reboot bootloader

-OR-

While the phone is either off or in the bootloader:

Press the Volume Down button

Whilst holding Volume Down, press the power button

Hold both for about 2 seconds

Release the power button

Continue to hold Volume Down until the fastboot information appears

Backing Up and Copying Files

If at any point during this process, adb returns the message error: more than one device and emulator, you will need to kill the adb.exe process on your PC and execute the command again.

Navigate to the tools directory in your Android SDK and create a folder called images. Copy recovery.img, openrecovery-twrp-2.5.0.0-asanti_c.img, and NON-HLOS.bin into the folder.

Go back up to the tools directory and, without anything selected, shift+right-click > Open command window here

Reboot your phone into the bootloader

Flash the TWRP recovery image by running fastboot flash recovery images\openrecovery-twrp-2.5.0.0-asanti_c.img at the command prompt

Reboot your phone into recovery

Tap the Backup button, and select external_sdcard (the button just above the Enable compression checkbox) as the backup location

The default setting to include System, Data, and Boot is sufficient for a complete backup. Swipe to back up.

Once the backup completes, reboot. If TWRP asks you if you want to root, say no.

Connect your SD card to your computer

In your SD card's root, copy in all three of the OTA zips, along with their .crc files

Navigate to TWRP\BACKUPS\<serial number>\. You should see a folder here with the date and time of your backup.

Create a new folder alongside your backup called ICS-Stock, and copy in boot.emmc.win, boot.emmc.win.md5, system.ext4.win, and system.ext4.win.md5

Eject your SD card and put it back in your phone

Restoring and Flashing

Boot your phone into recovery

Tap Wipe and swipe to factory reset (this wipes out your user data so it doesn't interfere with the process)

After the wipe finishes, go back to the main menu and hit Restore

Select the external_sdcard storage and tap the ICS-Stock backup

Check the Enable MD5 verification box and swipe to restore

Shut down the phone after the restore completes (Reboot > Power Off)

Now, at this point, if we tried to install the OTA, it would complain about some of the modem files failing the integrity check, but we're going to remedy that situation.

Boot your phone into the bootloader and connect it to your PC

From that command prompt you opened, run fastboot flash modem images\NON-HLOS.bin

The output should look something like this:

sending 'modem' (48324 KB)... OKAY [ 3.996s]
writing 'modem'... OKAY [ 12.326s]

If you get a "max download size" error, try this command instead: fastboot flash modem images\NON-HLOS.bin -S 0 (thanks to hagforz for pointing out this fix!)

Flash the stock recovery back by running fastboot flash recovery images\recovery.img

Updating

After applying each of the OTA updates, I received an error saying something like "Update failed. Please try again later." Everything seemed to be fine, though, so I ignored it and you should, too.

Boot up your phone and confirm that you're running version 77.6.36 (Settings > About phone > SW version)

Reboot into recovery and select apply update from external storage

Select the Blur_Version.77.6.36.XT897.Sprint.en.US.zip file

Once the update completes, reboot and check that you're now running version 77.8.10

Apply the Blur_Version.77.8.10.XT897.Sprint.en.US.zip update the same way

Reboot, check that your version is now 7.8.14

At this point, I also ran a Profile and PRL update. Probably not necessary, but you might want to just in case.

Apply the Blur_Version.77.8.14.XT897.Sprint.en.US.zip update. This is a long one, so you might wanna make a cup of coffee or something.

As mentioned in previous posts, this update will likely produce the following error during the install:

Symlinks and permissions...
set_perm: some changes failed
E:Error in /tmp/sideload/package.zip
(Status 7)
Installation aborted.

However, I haven't been able to see any effect of this error on the system, as the update appears to apply just fine anyway.

Reboot, check for version 98.10.5

Congratulations! You now have Jelly Bean! At this point I would highly recommend re-flashing TWRP and making a backup.

Please let me know if you encounter any problems, as I'd be happy to help. Also, I'm probably going to re-read and edit this tomorrow (or some other time when I'm not sleep-deprived).

----

I'm going to try huatz84's storage swap hack later, since that seems pretty nifty, and I'll post some screenshots and an overview-type-thing of the major changes in JB since everyone seems to want that.