[Xperia Play Android Development] paxChristos:
Since We have such a fantastic tutorial on how to build your own CM9, I thought I'd add one for building a kernel.

Edit: updated kernel sources for jellybean

First off:

You NEED Linux. DO NOT TRY THIS ON WINDOWS, IT WON'T WORK.

Sources: https://github.com/freexperia/semc-kernel-msm7x30-ics

https://github.com/DarkforestGroup/sony-kernel-msm7x30-ics

https://github.com/DooMLoRD/Xperia-2011-Kernel-2.6.32.9

http://xdaforums.com/showthread.php?t=1556971

http://xdaforums.com/showthread.php?t=1477845

http://developer.sonymobile.com/wp/2011/05/06/how-to-build-a-linux-kernel/

DooMLoRD, KeiranFTW & Atarii.

Prepping:

1) Grab the toolchain I have here (Android NDK R5b), it's the only one I've been able to use that doesn't throw errors when compiling: http://db.tt/hE3TmJJi Doom has provided a better toolchain https://github.com/DooMLoRD/android_prebuilt_toolchains[/QUOTE] you can get it using

git clone https://github.com/DooMLoRD/android_prebuilt_toolchains.git -b master

(thanks Doom!!)

Building a kernel from fxp sources

1) Terminal for any commands, file explorer for finding stuff & gedit for changes.

2) open up terminal, mkdir (no spaces)

3) cd

4) git clone https://github.com/CyanogenMod/semc-kernel-msm-7x30 -b jellybean (no spaces)

5) cd /semc-kernel-msm-7x30-ics (if you didn't rename it)

6) (If this is after the first time, and lets say a week has past do this step, otherwise ignore) git pull (automatically updates any files)

7) First important step: Find the defconfig that fxp uses. They are located in arch/arm/config. fxp_zeus_defconfig is the name of theirs

8) copy fxp_zeus_defconfig & rename to _zeus_defconfig (for example, mine will be pax_zeus_defconfig)

9) open up your defconfig & put it into another workspace, we'll mess with it later

10) Hop onto DooMLoRD's github, his we'll use for references.

11) Adding governors: https://github.com/DooMLoRD/Xperia-...mmit/bec19001ded34077d7776639834a1229b69e5f87

A1) Well, as I look into this, fxp has a ton of governors not used... (located in /drivers/cpufreq/

A2) Check the Kconfig file to see that they're all in there (they must just not be in the defconfig file)

A3) Edit the deconfig file you created in lines 467-474 removing "#" from any you want to add (and add in any you might've added by adding the line CONFIG_CPU_FREQ_GOV_=y

A4) If you want to add more governors, check out the Commits from DooMLoRD's build to add in when needed (anytime you see a "+" that means line added, "-" means line deleted)

12) Adding IO Schedulers: https://github.com/DooMLoRD/Xperia-...mmit/0ae625f7561c559d4933284f489733bf5eb66e96

B1) Navigate to /block folder

B2) Once again, FXP has a ton of IO Schedulers added, but not used in Play kernel:

B3) Open up Kconfig.ioshced to make sure they're in there (and add any you want)

B4) Edit the defconfig file you created (lines 121-137) & fix it to your liking (same as above)

B5) If you want to add more, see Doom's commits to add 'em

13) Turning off ALS

C1) Navigate to /arch/arm/mach-msm

C2) Open up board-semc_zeus.c

C3) Search for .als_connected (it on line 1349)

C4) Change the variable from 1 to 0

14) Overclocking

D1) open up arch/arm/mach-msm/acpuclock-7x30.c

D2) Lines 96 - 144 contain the PLL2 table, which is used to set clock speeds, note FXP can go all the way up to 2ghz, they just stop it short.

15) Building the Kernel

E1) Save your defconfig file, you'll need it now.

E2) naviage to folder (in terminal)

E3) Type in "ARCH=arm CROSS_COMPILE= ../ramdisk.img

F17) cd ../

17) Putting the ramdisk & kernel together

G1) By now (hopefully) the kernel is done compiling. (time for terminal, you should still be in folder you were above)

G2) cp ~//arch/arm/boot/zImage ./

G3) mkbootimg --base 0x00200000 --kernel zImage --ramdisk ramdisk.img -o .img

18) Flashing it for testing.

H1) Keep your copy of FXP's kernel around, just in case any issues happen

H2) fastboot boot .img

H3) If it boots & works, SUCCESS!! you modified your own custom kernel!

H4) If it doesn't boot (at all, just a vibrate & blank screen for 10-20 seconds) there's a problem with the ramdisk, sometimes it's bad, sometimes is needs filler, overall, it's just a pain in the butt to figure out.

H5) If it boots & bootloops the splash screen, well, that's an issue with the ramdisk again, that possibly, your ramdisk does not match you rom. Recovery, reflash rom & try again.

Courtesy of Atarii reminding me :D

19) Adding your wifi modules (they get built when you build the kernel) into the ramdisk

I1) Let's pretend that you haven't gotten through step F16, we're gonna add the wifi modules in.

I2) The wifi modules are located in /drivers/net/wireless/

I3) Copy bcm4329.ko to ~/ramdisk/working/modules/

I4) Add in the following lines to init.semc.rc

#load bcm4329 module
insmod /modules/bcm4329.ko

I5) Now your modules will autoload on boot!

Pax