5,815,095 Members 38,388 Now Online
XDA Developers Android and Mobile Development Forum

[Tutorial] Kernel building instructions for Xperia SP

Tip us?
 
DooMLoRD
Old
(Last edited by DooMLoRD; 7th July 2013 at 08:59 PM.)
#1  
DooMLoRD's Avatar
Recognized Developer - OP
Thanks Meter 38,387
Posts: 13,058
Join Date: Jul 2010
Location: Noida
Exclamation [Tutorial] Kernel building instructions for Xperia SP

kernel sources for Xperia SP (C5302, C5303, C5306, M35h) {FW: 12.0.A.1.257} are available...

link to download sources:
http://dl-developer.sonymobile.com/c....1.257.tar.bz2


i will keep pushing stock kernel sources to my git tree at the following branch:
https://github.com/DooMLoRD/android_...e/sony_sources



following are the build instructions for developers who plan to work on this device....


toolchain recommended: Google GCC 4.7



Building kernel (zImage):

for Xperia SP:
import defconfig
Code:
ARCH=arm CROSS_COMPILE=~/arm-linux-androideabi-4.7/bin/arm-linux-androideabi- make viskan_huashan_defconfig


build zImage
Code:
ARCH=arm CROSS_COMPILE=~/arm-linux-androideabi-4.7/bin/arm-linux-androideabi- make  -j8

incase u get errors like:
Code:
 error : /scripts/gcc-wrapper.py
just correct the permissions of that file
Code:
chmod 755 ./scripts/gcc-wrapper.py

here is patch for compatibility with GCC 4.7 compilation


regards,

DooMLoRD
The Following 12 Users Say Thank You to DooMLoRD For This Useful Post: [ Click to Expand ]
 
DooMLoRD
Old
#2  
DooMLoRD's Avatar
Recognized Developer - OP
Thanks Meter 38,387
Posts: 13,058
Join Date: Jul 2010
Location: Noida
Instructions for building kernel.elf


first get the kernel built... once kernel is built u will get zImage and copy that zImage to the folder containing the build tools...

i have posted the build tools i use here:
https://github.com/DooMLoRD/build_to...sm8960t_viskan




Sony using the ELF format (similar to the 2012 devices)...



build kernel.elf

u can directly use the files posted at my git repo for build tools

or

use the following command:
Code:
python mkelf.py -o kernel.elf zImage@0x80208000 ramdisk.cpio.gz@0x81600000,ramdisk RPM.bin@0x00020000,rpm bootcmd@0x00000000,cmdline

the correct RPM.bin & bootcmd are posted at my git tree for build tools...




regards,

DooMLoRD
The Following 10 Users Say Thank You to DooMLoRD For This Useful Post: [ Click to Expand ]
 
noahvt
Old
(Last edited by noahvt; 24th November 2013 at 09:27 AM.)
#3  
noahvt's Avatar
Senior Member
Thanks Meter 315
Posts: 1,132
Join Date: Jan 2013
@DooMLoRD

I have to answer a lot of questions when compiling like board selection etc (have been clicking y and and enter for about 30 minutes now) is this normal?



Click image for larger version

Name:	Screenshot from 2013-11-24 10:25:17.png
Views:	225
Size:	233.0 KB
ID:	2411564
MY DEVICES:

XPERIA SP (C5303)
-CPU: 1.7ghz(DUAL) QUALCOMM SNAPDRAGON S4 PRO
-RAM: 1GB
-BOARD: MSM8960T
-GPU: Adreno 320
-ROM: [KK 4.4.3] OFFICIAL CM11 Nightly
-KERNEL: [CM11]Williams kernel V2


Asus Transformer tf300t (CARDHU)
-CPU: 1.7GHz( QUAD, OC ) TEGRA3 T30L
-RAM: 1GB
-BOARD: Cardhu
-GPU: TEGRA3
-ROM: MULTIBOOT: Xubuntu, ubuntu touch, cm11, Cromi-X, omni, Dirty Unicorns


SONY SW2
-CPU: 200MHZ(SINGLE) QUALCOMM M3
 
neXus PRIME
Old
#4  
neXus PRIME's Avatar
Recognized Contributor
Thanks Meter 3,573
Posts: 3,145
Join Date: Nov 2011
Location: Lahore, Pakistan
Hi Doomlord.
Being a fresh Xperia User, never heard about u on HTC forums. But glad to know you are helping a lot of people around here. I was wondering whether you could help me in understanding a bit about xperia phones before i dive into kernel kanging n stuff.
What i know from HTC devices
Partitions are like this:
Boot (separate partition on NAND)
Recovery (separate partition on NAND)
System like above
Data, same
Cache, same
etc

There, we used to flash boot.img to boot. boot.img contained kernel zImage+ramdisk
For recovery, we have recovery.img which contained zImage+recoveryramdisk
Then system and data etc as every other phone.

Here in Xperia, i cant understand where the recovery is. Is it inside kernel.elf?
Is it placed on a dedicated partition?
I want to know what i am messing with, before continuing.

What i plan to do is.
Build a clean TWRP from source (for myself, usage and learning.)
Build a stock based kernel from source. Add few govs/scheds and maybe Doubletap2wake etc. (but thats a little way ahead.)

Can you help me with this?
 
noahvt
Old
#5  
noahvt's Avatar
Senior Member
Thanks Meter 315
Posts: 1,132
Join Date: Jan 2013
Quote:
Originally Posted by neXus PRIME View Post
Hi Doomlord.
Being a fresh Xperia User, never heard about u on HTC forums. But glad to know you are helping a lot of people around here. I was wondering whether you could help me in understanding a bit about xperia phones before i dive into kernel kanging n stuff.
What i know from HTC devices
Partitions are like this:
Boot (separate partition on NAND)
Recovery (separate partition on NAND)
System like above
Data, same
Cache, same
etc

There, we used to flash boot.img to boot. boot.img contained kernel zImage+ramdisk
For recovery, we have recovery.img which contained zImage+recoveryramdisk
Then system and data etc as every other phone.

Here in Xperia, i cant understand where the recovery is. Is it inside kernel.elf?
Is it placed on a dedicated partition?
I want to know what i am messing with, before continuing.

What i plan to do is.
Build a clean TWRP from source (for myself, usage and learning.)
Build a stock based kernel from source. Add few govs/scheds and maybe Doubletap2wake etc. (but thats a little way ahead.)

Can you help me with this?
The recovery is inside the kernel but that's all I know



Sent from my C5303 using xda app-developers app
MY DEVICES:

XPERIA SP (C5303)
-CPU: 1.7ghz(DUAL) QUALCOMM SNAPDRAGON S4 PRO
-RAM: 1GB
-BOARD: MSM8960T
-GPU: Adreno 320
-ROM: [KK 4.4.3] OFFICIAL CM11 Nightly
-KERNEL: [CM11]Williams kernel V2


Asus Transformer tf300t (CARDHU)
-CPU: 1.7GHz( QUAD, OC ) TEGRA3 T30L
-RAM: 1GB
-BOARD: Cardhu
-GPU: TEGRA3
-ROM: MULTIBOOT: Xubuntu, ubuntu touch, cm11, Cromi-X, omni, Dirty Unicorns


SONY SW2
-CPU: 200MHZ(SINGLE) QUALCOMM M3
 
neXus PRIME
Old
#6  
neXus PRIME's Avatar
Recognized Contributor
Thanks Meter 3,573
Posts: 3,145
Join Date: Nov 2011
Location: Lahore, Pakistan
Yep. I found all I needed to know.... Fotakernel partition, elf ramdisk kernel and other stuff.

Sent from my C5303 using Tapatalk
 
DooMLoRD
Old
#7  
DooMLoRD's Avatar
Recognized Developer - OP
Thanks Meter 38,387
Posts: 13,058
Join Date: Jul 2010
Location: Noida
No NAND is used


EMMC is there in all new xperia devices

Sent from my C6902 using xda app-developers app
The Following User Says Thank You to DooMLoRD For This Useful Post: [ Click to Expand ]
 
neXus PRIME
Old
#8  
neXus PRIME's Avatar
Recognized Contributor
Thanks Meter 3,573
Posts: 3,145
Join Date: Nov 2011
Location: Lahore, Pakistan
Quote:
Originally Posted by DooMLoRD View Post
No NAND is used


EMMC is there in all new xperia devices

Sent from my C6902 using xda app-developers app
ok thanks...

one more thing, if i build a custom kernel (lets say, stock-based), without any major changes..... can i flash that kernel file without unlocking bootloader???

as i understand, only kernel ftf files can be flashed via flashtool in locked bootlaoder.... correct me if im wrong.
 
Siddhesh
Old
#9  
Siddhesh's Avatar
Senior Member
Thanks Meter 221
Posts: 516
Join Date: Sep 2012
Location: Mumbai
Quote:
Originally Posted by neXus PRIME View Post
ok thanks...

one more thing, if i build a custom kernel (lets say, stock-based), without any major changes..... can i flash that kernel file without unlocking bootloader???

as i understand, only kernel ftf files can be flashed via flashtool in locked bootlaoder.... correct me if im wrong.
No u can't

Sent from my C5302 using Tapatalk
 
noahvt
Old
#10  
noahvt's Avatar
Senior Member
Thanks Meter 315
Posts: 1,132
Join Date: Jan 2013
Quote:
Originally Posted by Siddhesh View Post
No u can't

Sent from my C5302 using Tapatalk
I compiled my kernel with a different splash screen and it flashed but I got a flashing black screen and it doesn't boot (i have UBL)
MY DEVICES:

XPERIA SP (C5303)
-CPU: 1.7ghz(DUAL) QUALCOMM SNAPDRAGON S4 PRO
-RAM: 1GB
-BOARD: MSM8960T
-GPU: Adreno 320
-ROM: [KK 4.4.3] OFFICIAL CM11 Nightly
-KERNEL: [CM11]Williams kernel V2


Asus Transformer tf300t (CARDHU)
-CPU: 1.7GHz( QUAD, OC ) TEGRA3 T30L
-RAM: 1GB
-BOARD: Cardhu
-GPU: TEGRA3
-ROM: MULTIBOOT: Xubuntu, ubuntu touch, cm11, Cromi-X, omni, Dirty Unicorns


SONY SW2
-CPU: 200MHZ(SINGLE) QUALCOMM M3

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes