Tuesday, February 7, 2012

Flashing the Galaxy Nexus to Stock

After rooting my Galaxy Nexus and removing some "system" apps, I learned that once you do that, you can no longer take system updates. Also, if you install an alternative "recovery" ROM (like ClockWorkMod), my understanding is that you cannot take updates. Yet, the phone will still prompt you for system updates, attempt to install them, and then fail upon reboot, leaving you with what seems to be a dead phone (you'll see a robot on it's back with chest open and a floating red exclamation point within a triangle). Not exactly what I'd call a great user experience.

My primary goal with rooting was to extend battery life and I believe most of my battery savings came from disabling services using the Autostarts app. IIUC, using the Autostarts app does not disable the ability to take updates. So, I decided to flash my GN back to stock so that I could once again take system updates and get rid of the annoying update reminders.

To get back to stock, I grabbed the 4.0.1 (ITL41D) yakju package from the factory images page (since I have a GSM Nexus) and unzipped it.

Note that I'm running Linux---I would not recommend trying this unless you are also running Linux and are generally familiar with the Linux command line. I would also recommend that you have adb and fastboot installed in a location that is part of your $PATH. fastboot is necessary; adb will help make sure you can access your phone.

After unpacking, I checked whether I could access my phone:

$ adb devices
* daemon not running. starting it now *
* daemon started successfully *
List of devices attached 
0146B5BB04002013        device
So far, so good. If you don't get any devices or get "???????????", see my post on rooting the GN. Next, I shut down my phone, then booted into "fastboot" mode by holding VOLUME UP and VOLUME DOWN buttons, then pressing the POWER button. Fastboot mode shows a large green robot with his chest open. It also says "Fastboot mode" in small print toward the bottom. Next, checked that I could access the phone:
$ fastboot devices
0146B5BB04002013        fastboot
Finally, I ran the flash-all.sh script from the 4.0.1 stock package. Well, actually, I copied the commands from flash-all.sh one-by-one. The first two "flash" commands went quickly. The last took a while as it had to copy and install the 181M image. I watched as my phone finished installing then went through its boot sequence a twice. Finally, I got the new user tutorial. My phone is back to 4.0.1 stock. Yeah!

Note: I previously tried using the 4.0.2 stock image, but found that I wasn't able to root my phone with that image.

Note: After rooting and turning off many services via Autostarts, I was successfully able to apply a system update (ITL41F) to my phone.

Note: I successfully used the manual method to root my phone this time.