Search code examples
androidlinux-kernelkernelandroid-source

Installing Custom Android Kernel in Sony Xperia NXT series (U, Sola, P, S)


I have a Sony Xperia P. It runs on 6_0_B_1_564 Kernel and Andriod 2.3.7. I have compiled a custom kernel from the source. I changed the extraversion etc. I have got the zImage. How do I install it on my phone?

I have already tried Anykernel.zip method. When I try to install it using Clockworkmod, I get-

--Installing: /sdcard/new_kernel.zip
Finding update package...
Opening update package...
Installing update...
AnyKernel Updater by Koush.
Extracting System Files...
Extracting Kernel files...
Changing device name...
Done!

Install from sdcard complete.

But when I start the phone its the same old kernel

When I when through the contents of the zip file, I found that there is no boot.img in it.

Can I flash the kernel using Fastboot?


Solution

  • Finally I did manage to install the custom kernel. Guess the procedure will work for all the Sony Xperia NXT series phones (Xperia U, Sola, P, S). This is how I did it -

    1. Download the Stock Kernel from the following links -

      Sony Xperia U

      Sony Xperia Sola

      Sony Xperia P

      Sony Xperia S

      These will be ELF format.

    2. Download the Image generation script from here.

    3. Unpack the Stock Kernel.

      7z e kernel.elf

      This yields three files -

      0 - Kernel

      1 - RAMDisk

      2 - Resource Power Manager (only for Xperia S)

    4. Replace the kernel with out custom compiled kernel(zImage). Note that zImage is renamed to 0. Since we intend to change only the kernel, keep the RAMDisk and Resource Power Manager(if any) as it is.

    5. Generate the Kernel Image using the Script downloaded before

      For Xperia U, Sola and P -

      python mkelf.py -o new_kernel.elf 0@0x00200000 1@0x01200000,ramdisk

      For Xperia S -

      python mkelf.py -o new_kernel.elf 0@0x40208000 1@0x41200000,ramdisk 2@0x20000,rpm

      This generates a new kernel new_kernel.elf

    6. Reboot the phone into Fastboot mode by holding the Volume-Up button and then pressing the Power button in switched off state.

    7. Flash the new kernel

      android-sdk-linux/platform-tools/fastboot -i 0x0fce flash boot new_kernel.elf

      Reboot the phone.

      android-sdk-linux/platform-tools/fastboot -i 0x0fce reboot