The definitive guide on hacking the Nexus 4, part 3: How to install a custom ROM
The definitive guide on hacking the Nexus 4, part 3
Legal disclaimer: We are not responsible for any damage or loss to your device or computer system. Therefore, should you decide to follow these steps, you do so at your own risk and peril and agree to hold us harmless from any damage or loss you may experience. Should you disagree with the foregoing, please do not read any further.
What is a custom ROM?
ROM stands for “Read Only Memory”. This implies that you can read from memory, but you cannot write on it. ROM by definition means that you cannot modify it, flash it or change it in anyway. This is a bit confusing as we’ll be flashing a custom ROM below. However, we’re “hacking” Android in order to accomplish this. Nintendo games are a good example of a ROM. You can save your progress on a part of the cartridge, but the game itself is read only memory. There is some debate on whether or not the term “custom firmware” would be more apropos than “custom ROM”. For example, users install a custom firmware on their router, but no one says that they are installing a custom ROM on their router. Almost every other embedded device in the world uses the term “firmware”, except for Android. Smartphone manufacturers may use the term ROM because they want its users to think that it unmodifiable, but that’s clearly not true. Suffice to say, this is probably a semantic dispute not worth fighting. As far as Android phones are concerned, the Android development community overwhelming decided to use the term “custom ROM”, so that’s what we’ll be using.
Why would you want to install a custom ROM?
How to install a custom ROM
1) Download the latest CyanogenMod nightly zip file onto your PC. The latest build is at the top of the page. It’s approximately 177MB. Do not unzip it. Nightly builds are supposed to be experimental and not for daily use, but we’ve never had any problems running them. We’ve never seen a single crash or “forced closed”. It’s been nothing but butter smooth. No features are known to be broken. Wifi hotspot, GPS and standard wifi are all working perfectly in CyanogenMod. It’s important to note that wifi hotspot on LTE data does not work out of the box (as this phone was never supposed to support LTE), but we’ll show you how to fix this in part 6.
2) Download the latest version of Google Apps onto your PC. The latest version is near the top of the table. It’s approximately 90MB. Do not unzip it. This is a collection of Google’s most popular apps, gmail, google maps, etc. (apps that you cannot download from the Play Store). Google asked the Android development community not to bundle Google’s apps with custom ROM’s. That’s why you need to flash the Google Apps separately. Back in the day, they used to be all bundled together.
3) This step is optional. If you’re the paranoid sort and you’re afraid of bricking your phone. You can help minimize the risk of installing a corrupted zip file by running a “checksum” test to make sure that the 2 downloaded zip files have not been corrupted. MD5 checksum is a popular way to check the integrity of a file. To do this, download, install and run this small free tool called WinMD5. Go back to the two pages where you downloaded the zip files and you’ll notice a series of seemingly random sequence of letters and numbers below the download links, as seen below. This is the MD5 checksum hash code. Copy these codes.
To verify the integrity of the zip files, click “Browse” in the WinMD5 program to select the first zip file and paste the matching MD5 checksum found on the webpage into the white box in WinMD5 labelled “Original file MD5 checksum value” and click “Verify”. If the hashes match, it means that the file is not corrupted. Do the same for the other zip file. If the hashes don’t match, it means that you either selected the wrong zip file, you copied and pasted the wrong checksum or the downloaded zip file is corrupted (so you should download it again).
If you don’t see your phone appear in explorer, you may need to disable USB Debugging and enable (Media Transfer Protocol) MTP by clicking on “Connected as media device”. Once you connect your phone to a PC, the “Connected as media device” notification will usually appear. You can enable MTP through this notification.
Double click on the Nexus 4 icon in the file manager on your PC and you should see the contents of your phone. We’re going to make a new directory called “ROM” inside the sdcard of the Nexus 4. You may not see a directory called “sdcard” on your PC (you’ll probably just see “Internal Storage”), but it’s the folder with sub-directories such as “Android”, “DCIM”, “Download”, etc. The final result in the ROM directory should look something like below.
5) Let’s boot into Fastboot mode. So, disconnect the USB cable and turn off your phone. To enter into Fastboot mode (while the phone is off), push and hold volume up and volume down and the power button (hold all three together) for a few seconds. Once the phone vibrates and you see a little android man, as seen below, you can let go of all 3 buttons. The bootloader should be unlocked when you’re installing a custom ROM and Kernel. It may work even if it’s locked, but it’s best not to take chances.
6) Push volume down 2 times until the “Start” menu has changed to “Recovery Mode”, as shown below. Once you see “Recovery Mode”, push power to select it. Your phone will now start ClockworkMod–which is the Android custom recovery we installed in Part 2.
7) If you see something like below, that means that you’re in ClockworkMod. This is where the magic happens. Before we install the Custom ROM, let’s do some house cleaning to avoid possible conflicts (old system files mixing with new system files, it’s not pretty). Please note that the following steps will wipe your user data, so backup anything that you need before doing this. You can navigate through ClockworkMod with the Volume Up/Volume Down buttons or you can touch the screen to select a menu option.
First, select “wipe cache partition” and select “Yes – Wipe Cache”.
8) Once that is complete, let’s install the custom ROM. Select “install zip from sdcard” from the home screen of ClockworkMod, then navigate to the “ROM” folder you created beforehand. To do that, open the folder called “0″ (this may be different on your phone), then select the folder called “ROM” then select the Cyanogenmod zip file. The installation process should look something like this. It will finish installing very quickly.
9) Afterwards, let’s install the Google Apps. Go back to the home screen of ClockworkMod and select “install zip from sdcard”, select a folder called “0″ (this may be different on your phone), then select the folder called “ROM” then select the Google Apps zip file. The installation process should look something like this. It will install quickly as well.
10) Go back to the ClockworkMod home screen and select “Reboot System Now”. Your phone should reboot and you should see a new boot screen with a new CyanogenMod animation. That’s a first sign that it seems to be working. If the phone stays on this animated screen for more than 5 minutes, you probably got yourself stuck in a co-called “boot loop”. In this case, go back into Fastboot mode and re-do all of the steps and try again.
Once the phone is fully booted, go into “Settings” then “About phone” and you should see something like below. Here you have a confirmation that you’re running CyanogenMod. CyanogenMod has a lot of neat features, so feel free to play around to explore the new options. Finally, give yourself a pat on the back and go have a cold beer. You deserve it.
Please stay tuned for Part 4 where we will discuss what is a Kernel and how to do install a custom Kernel. Kernel hacking is what separates the men from the boys. We’ll discuss more about this in Part 8 where we’ll try to optimize the Kernel for maximize battery life.