[Droid Eris Android Development] bftb0:
Here's a thumbnail sketch of the process; you will need to fill in the blanks. Not for the faint of heart - it might be several *days* of effort (maybe more) before you are building kernels. And then comes the code sleuthing...

1) Use linux - Ubuntu 10.04 LTS. 64-bit! *1

2) Set up the entire Google SDK, supporting tools, and their pre-requisites *2

3) Get a cross-compiler toolchain set up - either the Google NDK, or CodeSourcery *3

4) Get the sources for the kernel you want to patch. *4

5) Make sure you have a .config file at the top of the source tree *5

6) Patch the kernel sources as you desire *6

7) Build the kernel: make all

8) Download the wireless adapter code and build the corresponding wireless kernel module (wlan.ko) *8

9) Get the tools installed to sign .zip archives with the Android "testkey"

10) Get the Koush kernel installer (or copies of the same from Conap's kernel installers)

11) Unzip the above, and replace kernel and modules with your recently built kernel & modules; zip it back up, and sign it.

12) Back up your ROM on the phone (preferably with CWM), and flash the kernel installer zip you just signed.

13 ) Iterate steps 1-12 until convergence :P

[*1] Can be a VM (Virtual Machine) run under VirtualBox to save yourself headaches, but give it 2 GB of RAM. So, host machine for VirtualBox probably needs 4Gigs of RAM. Check into and VB release notes for gotchas if your host OS is 32 bit

[*2] e.g. Eclipse 3.6.1 (Helios) works. Don't know if it is compatible with latest Google SDK though. (You don't need eclipse for kernel work, but you may as well install it.)

[*3] iirc Conap went back and forth between Google NDK and CodSourcery; I'm not sure what he settled on finally for his kernel builds. There probably are also some (Ubuntu) developer packages which you will need to install as dependencies.

[*4] This is a mouthful - you can't mix and match any kernel with any ROM; e.g. most of the Froyo and Gingerbread ROMs will not work correctly with the Zanfur OC kernel or stock (HTC) kernel sources. If you are going to use a kernel with sources on github, you'll need to install Git (plus dependencies), and then learn a few git commands to clone the sources

[*5] You can use "make desirec_defconfig", or, even better, flash a ROM that you know that uses the kernel that matches your baseline sources, and get the /proc/config.gz file from it while it is booted up, e.g.

adb pull /proc/config.gz config.gz

mv .config .config-saved

gunzip config.gz

mv config .config

diff .config .config-saved (sanity check)

[*6] If you learned how to use git minimally, might as well commit the baseline sources to your local repository (not github) so you can keep track of your changes

[*8] e.g.

mkdir wlan; cd wlan

git clone https://android.googlesource.com/platform/system/wlan/ti.git

cd ti/sta_dk_4_0_4_32

export KERNEL_DIR=/home/user/<path-to-top-level-directory-of-your-kernel-source>

make 2>&1 | tee make-logfile.txt

[*9] e.g. Java and the testkey certificate (the latter is in the SDK me thinks)

java -jar signapk.jar testkey.x509.pem testkey.pk8 <update.zip> <update_signed.zip>

I honestly can't remember if I had to generate one or the other of the .pem or .pk8 files using openSSL, nor where the private key for "testkey" lives in the SDK. There are other alternatives to signing zip files, though.