Sunday, December 15, 2013

How to flash Samsung Galaxy Nexus with the latest factory image

I was running CyanogenMod on a Google/Samsung Nexus Galaxy and decided to go back to the stock Google image from the Factory Images for Nexus Devices page. The latest factory image for the Galaxy Nexus is 4.3 (JWR66Y).

Make sure to download the correct image for your Nexus phone. In my case it's "yakju" for the Galaxy Nexus "maguro" (yakju-jwr66y-factory-09207065.tgz).

I downloaded the yakju archive and extracted the .tgz with 7za:

cd \temp
curl -k -O
7za x yakju-jwr66y-factory-09207065.tgz
7za x yakju-jwr66y-factory-09207065.tar
cd yakju-jwr66y

I wanted to see if I had the Samsung driver installed on my Windows 8.1 laptop:  Go to Device Manager:

So, no clearly I didn't have the driver for the phone yet: Device Manager shows the Nexus phone as "Unknown USB Device (Device Descriptor Request Failed)".

At this point, I decided to put the phone into fastboot anyway and see if I could flash the factory image without the Samsung driver (hint: no, it didn't work):

To use adb.exe and fastboot.exe, I just used the Android SDK in my Android Studio installation. I added the sdk/platform-tools folder to my PATH and put the device into fastboot mode:

set PATH=%PATH%;D:\Android\android-studio\sdk\platform-tools
adb reboot bootloader

Now the phone is in fastboot mode (while in "fastboot mode" you can "flash" the Android firmware, i.e. modify the system image / operating system):

However, as I feared, fastboot.exe couldn't see the phone, because the Samsung driver wasn't installed, i.e. when I ran  "fastboot devices" no devices were listed. While in fastboot mode, Device Manager now shows the phone as "Other Devices" -> "Android 1.0":

I downloaded Samsung_USB_Driver_for_Mobile_Phones_v1.5.14.0.exe from Samsung's website. 

During the process of installing the Samsung USB driver I had to reboot my Windows 8.1 a few times (and I also had to take the battery out of the phone once to get it out of fastboot mode because the phone seemed to hang).

I right-clicked on the "Android 1.0" device and clicked "Update Driver Software...". Then I selected "Let me pick from a list of device drivers on my computer" and then selected the "SAMSUNG Android Phone" from the list:

And on the next screen I selected "SAMSUNG Electronics Co., Ltd." ->  "SAMSUNG Android ADB Interface":

Windows confirms that the Samsung driver is installed OK:

After updating the "Android 1.0" device's driver to "Samsung Android ADB Interface", Fastboot now shows the device:

C:\temp\yakju-jwr66y> fastboot devices
0356B9BB0201A005        fastboot

Now run flash-all.bat from the downloaded factory image folder. That's it! That batch file runs fastboot.exe a few times to install the new factory image. Now Android 4.3 is installed successfully on the Nexus phone.

Monday, December 09, 2013

Keep it simple

I was browsing around on the Quantified Self website and saw these nice easy tips / lessons learned on QS, but clearly these are 100% applicable to software development (and practically any aspect of life). They are pretty obvious points, but worth reminding yourself of now and then, especially when you're as easily distracted as I am :-)
  1. Something is better than nothing. Engaging yourself in some experiment, no matter how flawed it may be, is better than never starting. The best way to learn is to do. So go out and do something!
  2. When you decide to start something try and do the simplest thing that you think might give you some insight. It’s great to have ambitious ideas, but keeping it simple ensures your experiment is manageable.
  3. Mistakes are worthwhile. Some of our best knowledge comes from learning from our failures so don’t be afraid of failing. By keeping it simple you also keep the mistakes small and manageable.
  4. Seek help from others.