Nvidia and Robotics w/ Barrett Williams – XDA:DevCon 2014

Robotics continues to dominate our videos from this years XDA:DevCon 2014 in … more

Speed Up Deodexing with JoelDroid Batch Deodexer

Android 5.0 Lollipop brings many under-the-hood changes like changing the default compiler … more

Top 5 Apps for 2014 + Top Xposed Mod of 2014 – XDA TV

Its that time of year where you look back and remember the things that happened … more

NVIDIA SHIELD Tablet Gets Android 5.0.1, OTA Available

The NVIDIA SHIELD Tablet is the latest Android-powered device released by famed GPU … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

Exclamation [Tutorial] Kernel building instructions for Xperia SP

OP DooMLoRD

7th July 2013, 09:44 PM   |  #1  
DooMLoRD's Avatar
OP Recognized Developer
Flag Noida
Thanks Meter: 39,123
 
13,127 posts
Join Date:Joined: Jul 2010
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
Last edited by DooMLoRD; 7th July 2013 at 09:59 PM.
The Following 12 Users Say Thank You to DooMLoRD For This Useful Post: [ View ]
7th July 2013, 09:47 PM   |  #2  
DooMLoRD's Avatar
OP Recognized Developer
Flag Noida
Thanks Meter: 39,123
 
13,127 posts
Join Date:Joined: Jul 2010
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: [ View ]
15th November 2013, 06:04 PM   |  #3  
noahvt's Avatar
Senior Member
Flag Antwerpen
Thanks Meter: 385
 
1,211 posts
Join Date:Joined: Jan 2013
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:	253
Size:	233.0 KB
ID:	2411564
Last edited by noahvt; 24th November 2013 at 10:27 AM.
22nd January 2014, 06:34 AM   |  #4  
neXus PRIME's Avatar
Recognized Contributor
Flag Lahore, Pakistan
Thanks Meter: 4,216
 
3,301 posts
Join Date:Joined: Nov 2011
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: 385
 
1,211 posts
Join Date:Joined: Jan 2013
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
Recognized Contributor
Flag Lahore, Pakistan
Thanks Meter: 4,216
 
3,301 posts
Join Date:Joined: Nov 2011
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 Recognized Developer
Flag Noida
Thanks Meter: 39,123
 
13,127 posts
Join Date:Joined: Jul 2010
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 ]
22nd January 2014, 02:36 PM   |  #8  
neXus PRIME's Avatar
Recognized Contributor
Flag Lahore, Pakistan
Thanks Meter: 4,216
 
3,301 posts
Join Date:Joined: Nov 2011
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: 224
 
519 posts
Join Date:Joined: Sep 2012
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: 385
 
1,211 posts
Join Date:Joined: Jan 2013
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)

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes