FORUMS
Remove All Ads from XDA

[Tutorial] Kernel building instructions for Xperia SP

13,194 posts
Thanks Meter: 39,783
 
Post Reply Email Thread
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 13 Users Say Thank You to DooMLoRD For This Useful Post: [ View ] Gift DooMLoRD Ad-Free
7th July 2013, 09:47 PM |#2  
DooMLoRD's Avatar
OP Inactive Recognized Developer
Flag Pune
Thanks Meter: 39,783
 
Donate to Me
More
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 [email protected] [email protected],ramdisk [email protected],rpm [email protected],cmdline

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




regards,

DooMLoRD
The Following 11 Users Say Thank You to DooMLoRD For This Useful Post: [ View ] Gift DooMLoRD Ad-Free
15th November 2013, 06:04 PM |#3  
noahvt's Avatar
Senior Member
Flag Antwerpen
Thanks Meter: 662
 
More
@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:	491
Size:	233.0 KB
ID:	2411564
22nd January 2014, 06:34 AM |#4  
neXus PRIME's Avatar
Senior Member
Flag Lahore, Pakistan
Thanks Meter: 4,544
 
More
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?
22nd January 2014, 07:55 AM |#5  
noahvt's Avatar
Senior Member
Flag Antwerpen
Thanks Meter: 662
 
More
Quote:
Originally Posted by neXus PRIME

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
22nd January 2014, 11:40 AM |#6  
neXus PRIME's Avatar
Senior Member
Flag Lahore, Pakistan
Thanks Meter: 4,544
 
More
Yep. I found all I needed to know.... Fotakernel partition, elf ramdisk kernel and other stuff.

Sent from my C5303 using Tapatalk
22nd January 2014, 02:20 PM |#7  
DooMLoRD's Avatar
OP Inactive Recognized Developer
Flag Pune
Thanks Meter: 39,783
 
Donate to Me
More
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: [ View ] Gift DooMLoRD Ad-Free
22nd January 2014, 02:36 PM |#8  
neXus PRIME's Avatar
Senior Member
Flag Lahore, Pakistan
Thanks Meter: 4,544
 
More
Quote:
Originally Posted by DooMLoRD

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.
22nd January 2014, 03:02 PM |#9  
Siddhesh's Avatar
Senior Member
Flag Mumbai
Thanks Meter: 221
 
More
Quote:
Originally Posted by neXus PRIME

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
15th March 2014, 11:22 AM |#10  
noahvt's Avatar
Senior Member
Flag Antwerpen
Thanks Meter: 662
 
More
Quote:
Originally Posted by Siddhesh

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)
17th August 2014, 04:29 AM |#11  
jahanzaib khan's Avatar
Member
Flag Lahore
Thanks Meter: 4
 
More
Question
hi @DooMLoRD,
when i am making the elf of the zImage i am getting this error

[email protected]:~/android/huashan files/build tools/jk_output$ sudo bash '/home/jk-cha0s/android/huashan files/build tools/jk_output/build_it.sh'
[sudo] password for jk-cha0s:
Traceback (most recent call last):
File "mkelf.py", line 182, in <module>
main(sys.argv[1:])
File "mkelf.py", line 159, in main
size = os.path.getsize(seg.file)
File "/usr/lib/python2.7/genericpath.py", line 49, in getsize
return os.stat(filename).st_size
OSError: [Errno 2] No such file or directory: 'ramdisk.cpio.gz'

where to get the ramdisk.cpio.gz ?

edit:its inside a working kernel extract from there
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes