Flash Custom Kernel and Custom ROM into Any Sony Xperia Phone
July 19, 2012 § 139 Comments
If you search the net “how to flash a kernel” or “how to flash custom ROM”, you will get a million sites. Some are easy, some are confusing and some assumes that you are an expert. I thought, “why don’t I compile all those info for a new android user who wants to get his hands dirty by trying and tasting new ROMs and kernels other than the stock ones?” and the result is this post This post is written with a Sony Ericsson Xperia Mini Pro as example, but will work for all the Sony Xperia devices.
As this post is for new users, I will put some basic definitions first. If you are already acquainted with these terms, head over to the “Unlocking Bootloader” section right away.
- Kernel: Bridge between hardware and the Android OS. It is used for hardware information exchange and control the hardware parts.
- ROM: Read Only Memory. It includes all data corresponding to Android OS. It is kind of the user interface of your desktop OS.
- Bootloader: It controls the “turning on” process of the phone, brings you the home screen(s). The phone won’t turn on without a proper bootloader.
Cell phone manufacturers lock their devices’ bootloaders so that no virus or potentially dangerous malware or the user him/herself cannot change it. A virus can change your phone’s bootloader and make your phone unbootable. On the other hand, if you want to install a custom kernel or custom ROM (much like installing a new operating system in your desktop/laptop PC), you have to unlock the bootloader. Don’t worry, this action is reversible and won’t harm your phone.
- First, check that your phone is allowed to be unlocked. Dial *#*#7378423#*#* on your phone. Tap Service info > Configuration > Rooting Status. If Bootloader unlock allowed says Yes, then you can continue with the next step. If it says No, or if the status is missing, your device cannot be unlocked.
- Download the “fastboot” package from here. This is a software which will unlock your phone’s bootloader. Unzip it and place the folder on your PC’s desktop (or anywhere else).
- Download the “fastboot” drivers from here. Install them accordingly.
- Head over to Sony’s Bootloader Unlocking page. Click to confirm that you are sure! Accept the legal terms.
- Put your name, your phone’s IMEI number and your email ID in respective fields. Your phone’s IMEI number is found by dialing *#06# on your phone. Write that down by discarding the last digit (phone’s IMEI numbers are 14-digit. Sony Xperia devices will give you a number with 15-digit once you dial *#06#. Just ignore the last digit). On the next page, you will be given an unlock code. Write this down as well.
- Turn off your phone. Wait for 30 seconds. Connect your phone to the PC while keeping the volume up key pressed. Your phone’s LED will lit blue (indicating fastboot mode).
- Head over to the location where you kept the previously unzipped fastboot folder. Right click while keeping pressed the SHIFT key on the folder and select “Open command prompt here”.
- Type fastboot.exe -i 0x0fce getvar version to ensure your have entered bootloader mode (you will get version on java example, 0.3)
- Type fastboot.exe -i 0x0fce oem unlock 0xKEY (replace KEY with unlock code you got from Sony’s website earlier)
- Voila, your phone’s bootloader is now unlocked.
- Disconnect your phone from the PC and wait 30 seconds before starting the next step.
The best kernel (my personal opinion) for the 2011 Xperia devices is built by kamarush, a recognized developer of XDA community. I will use this kernel for this tutorial. You may choose any other kernel, but the ROM I am going to flash on the next section works best with this kernel.
- Download the appropriate kernel for your device: any one of Krsh Kernel or Rage Kernel or MESA Kernel will do. For example, you will find the kernel for SK17i here. It is an *.img file. Place this file somewhere on your computer.
- Download and install “Flashtool” on your computer from here. On the “Installation” tab of the website, you will find the download links. First download the 0.8.0.0 package and install it. Then download and install the update v0.8.6.0.
- Download the custom ROM of your choice. I would suggest the MiniCMSandwich AOSP Lite by kamarush. This is the best ROM for your Xperia, really. Its very lite and your phone will experience the pure AOSP flavor from Google Android ICS 4.0.4. Head over to this page and download the ROM file (it is a zip file). If you used the Krsh Kernel V3.0, you need to download the “wifi modules” zip file from here. Download the Google Apps from here. Place all these three zip files on the SD card of your phone.
- After you finished installing the Flashtool, start it (it usually installs in the path C:\Flashtool\). Click on the lightning bolt sign and select “Fastboot mode” and click OK.
- Connect your phone to the computer while keeping the volume up button pressed.
- Click on “select kernel to flash”
- Browse to the folder where you placed the *.img file and select it.
- Flashtool will install the kernel into your phone. Disconnect your phone from the PC. Wait 30 seconds.
INSTALLING THE CUSTOM ROM
- Turn your phone on. When you see the Sony or Sony Ericsson logo on the screen, keep pressing the volume down key. It will take you to the CWM recovery mode, which was installed automatically with the kernel.
- Use the volume up and down keys to navigate through menu items and the Home key for selecting.
- Do a full wipe (format data, system, cache, Dalvik cache and battery cache).
- Choose “install from SD card” and then select “choose zip file”. Select the ROM file first (MiniCMSandwich Lite Final v4).
- It will take you to the very much intuitive Aroma installer, which is very easy and much like installing an operating system on your PC.
- After finishing the installation, your phone will reboot. While rebooting, enter the CWM Recovery again using the volume down key.
- This time, do not wipe anything. Just select “install zip from SD card” and point to the wifi modules zip file. Similarly, install the Google Apps zip file.
- Turn off your phone from the CWM Recovery menu.
- Turn on your phone, first boot may take a long time, do not worry.
- Now you should get a pure AOSP flavor in your Xperia device.
A big thanks to all the developers of XDA community, specially kamarush.