Upgrading your nexus phone the adb way

Because I got fed up with OTAs and I also play too much with my phone, I decided to load up factory images directly with ADB. This process does not wipe the data for me, as long as you are careful on what you wipe.

In order to do this, you need to have your bootloader unlocked, if you unlock it now, you will lose all your data.

Here goes:

# check that you see your phone
fastboot devices
# get latest image
wget https://dl.google.com/dl/android/aosp/hammerhead-lmy47d-factory-6c1ad81e.tgz
# md5sum this shit
md5sum hammerhead-lmy47d-factory-6c1ad81e.tgz
# untar and get into it
tar xvf hammerhead-lmy47d-factory-6c1ad81e.tgz
cd hammerhead-lmy47d/
# unzip the different images
unzip image-hammerhead-lmy47d.zip
# flash all the shit
fastboot flash radio radio-hammerhead-m8974a-2.0.50.2.25.img
fastboot flash system system.img
fastboot flash boot boot.img
# reboot in recovery and flush cache and dalvik
# reboot and let it upgrade, profit.