Restore stock Android on Nexus 7

Device: Nexus 7 2012 (model) -> grouper (device) -> nakasi (device-appropriate Google ROMs)

After experimenting a bit with CyanogenMod, my first attempt to restore stock Android to my tablet hit a snag when the flashing procedure stumbled over the included bootloader file in Google's tarball: bootloader-grouper-4.23.img packaged in the v4.4.4 KTU84P factory image. The solution was to download a bootloader extracted from an earlier image and swap out the buggy version in the current image.

To successfully flash a factory image under Linux:

0. Backup

This procedure erases all data on the tablet. Google settings will be restored during post-install setup but anything of importance stored in device memory will require backup.

1. Tools

Verify that MTP and adb + fastboot are installed.

2. Image

Download the latest device-specific factory image and unpack the tarball. Factory images for my Nexus 7 are code-named nakasi.

3. Replace bootloader

Work around the buggy bootloader by downloading and replacing it with this alternate file.

4. Fastboot

Connect the tablet. Start adb and restart the tablet in fastboot mode:

$ adb start-server
$ adb reboot bootloader

5. Flash image

Navigate to the factory image folder and run:

$ ./flash-all.sh

After flashing is complete the device will reboot into its default factory state.

More • androidlinux