[Android General] sk99947:
Step 1. Build Environment

A. Install Ubuntu 12.04(Not holding your hand here, if you can't do this you shouldn't be messing with kernels)

B. Required packages: git-core, gnupg, flex, bison, gperf, libsdl-dev, libesd0-dev, libwxgtk2.6-dev, build-essential, zip, curl, libncurses5-dev, zlib1g-dev, ia32-libs, lib32z1-dev, lib32ncurses5-dev, gcc-multilib, g++-multilib, and Adb.

C. Open a terminal

D. Type "mkdir android"

E. Type "cd android"

G.Type "mkdir kernel"

The above steps explained:

A. Installing a linux distro. You could really install any Linux distro(Arch = epicness :P) however Ubuntu in my eyes is the easy to use and install, and widely supported.

B. Installing needed packages. I believe are these are needed(I'm sure someone will correct if they aren't), these are just the one's I was told I needed the first time I built CyanogenMod. No I can't tell you what every single package does, it is your job to research and figure that out.

C. Ummm...duh?

D-G. Building a directory structure that will help keep us organized. The "mkdir" command creates a directory, and the "cd" command moves you into that directory. You could also combine these steps using the command "mkdir -p android/kernel", however I left it broken apart up there to enforce the typing bit of this. The more you type these commands the more familiar you will become with them.

Step 2. Your Source

A. Open your Terminal Prompt

B. Type "cd android/kernel"

C. Type "git clone git://github.com/DooMLoRD/android_prebuilt_toolchains.git toolchains"

D. Now comes the tricky part, you need to have some-type of source for your kernel. Check the following two sites for your device as appropriate. Once you have it download it is extracted/cloned into a folder in your kernel directory.

http://www.htcdev.com/

http://opensource.samsung.com/

http://developer.sonymobile.com/wpor...ads/opensource

http://www.lg.com/global/support/ope...opensource.jsp

The above steps explained: Ok all we are doing here is grabbing some tool chains and the kernel source.

A. Ok...you got this one!

B. Moving into our working directory

C. Grabbing DooMLoRD's very handy pre-built toolchains. What is a toolchain? Check this out http://en.wikipedia.org/wiki/GNU_toolchain. These toolchains are unstable, and as such they aren't completely endorsed yet. They are the versions I use though, and if you would like to use the stable version(4.5.3 as of 07/06/12) you can find links with Google.

D. I typically put my kernel in a directory like "~/android/kernel/<devicename>_<androidversion>_kernel" but that's just me.

Step 3. Modifications

This is the part people are curious about, they want to make modifications to the kernel to make it "special". Start all these from the root directory of your kernel source.

Mod 1. Applying a patch

A. Download the patch you wish to apply, in this case this one should work.

B. Save that file as "kernelPatch" in your kernel directory.

C. Open a Terminal

D. Move into the root directory of the kernel you wish to patch.

E. Type "patch -p1 < ../kernelPatch"

The above steps explained:

A. Pretty simple, I mean we need a patch. The patch itself is quite simply a diff between the original kernel source tree and the source tree containing the changes. I'll post a quick tutorial on how to create a patch in the third post. The patch above contains multiple governors to be added to your kernel.

B. Self-explanatory

C. Self-explanatory

D. Self-explanatory

E. Basically we run the patch command on our source using the patch we downloaded previously. The "patch" portion is the binary itself, the "-p1" option allows you to control the number of forward slashes to remove from file paths(You'll need to look at this option more if you are using weird directory structures or applying the patches from a odd location). The "<" operator directs the content of our "../kernelPatch" file into the command.

Mod 2. Adding a Governor Alone

A. Open "drivers/cpufreq/Kconfig"

B. Add the following lines in