[Optimus One, P500 Original Android Development] sweetnsour:
(thank you for the picture, Lt.Win)

Before I begin, I'd like to thank:

thachtunganh - for teaching me everything from downloading the source code to compiling the kernel

DJNoXD - for tips on kernel development and support for P505/P506

Turducken - for tips on kernel development

hephappy - the 2.6.35.14 kernel is based off his CM9 kernel

androidarmv6 - the 3.0.8 kernel is based off of this team's kernel

thachtunganh, DJNoXD, franciscofranco, Rashed97, williamcharles, and many other developers - making patches to this kernel possible

WidowCranky and engr_exxi - providing me with very valuable feedback

you - for testing/using this kernel. Thanks again!

Just a quick summary of this kernel (you can find more info in the changelog):

Compiled using CodeSourcery

Updated governors (interactiveX, conservative, ondemandX, powersave, SmartassH3, performance)

Google Snappy Compression for ZRAM

SLQB memory allocator

optimized touchscreen from thachtunganh

BFS/CFS cpu scheduler

Supported devices:

P500, P505, P506, P509

Supported ROMs:

All kernels are built for ICS. CM9.2 uses the 3.0.x kernel. All other ICS ROMs use the 2.6.35.xx kernel. If you are not sure, find out your current kernel version by looking under Settings > About Phone > Kernel version.

FPChaim and edinrh have tested this on GB and reported that it broke video playback, so don't flash this on GB unless you don't mind losing video playback.

The newer versions of CM10/CM10.1 will not be supported, as they require triple buffering in the kernel. It is too much of a hassle for me to make a separate build just with it enabled. This is not to say that this kernel will not work on JB; it is just your experience may not be as smooth as it could be. Please use androidarmv6's kernel for that.

Why I built this kernel:

I wanted to compile an ICS kernel using a clean base kernel for a little gaming. To do so, I've included franciscofranco's touchscreen driver from his GB kernel and implemented the BFS CPU scheduler. Also included are some performance patches.

Flashing the kernel:

Before flashing, remember to have another kernel to flash or a backup in case anything goes wrong. Flash this kernel like any other kernel. Don't forget to wipe cache and dalvik cache.

Changelog:

You can find the changelog at my Google Code or in the following two posts.

Headers that are in bold refer to new releases.

Downloads:

You can download the latest and previous releases of the kernel at:

http://code.google.com/p/sweetnsour-kernel/downloads/list

Bugs/Reporting bugs:

Cannot set data limit [B]*FIXED[/B]
WiFi battery drain [B]*In Progress[/B]
3.0.8 kernel breaks wifi on JB [B]*FIXED[/B]

If you find a bug, please report it with steps to reproduce the issue here:

http://code.google.com/p/sweetnsour-kernel/issues/list

If you want to report an issue with battery life, please post a BetterBatteryStats screenshot of kernel and partial wakelocks.

To-Do List:

determine what breaks P505/P506 compatibility
TWRP support [B]*DONE[/B]

Want to Compile Your Own Kernel?

1. Fork the repo of your choice on github. Now that you have a fork of it on your github, download the source by entering the following in Terminal:
git clone [SSH address of your fork]

2. Set PATH for the toolchain (GCC 4.4.3 will be used as an example)
a) Clone the toolchain repo, and then copy the folder to Home. Open Terminal and enter "sudo cp arm-eabi-4.4.3 /opt/arm-eabi-4.4.3"

b) Enter "gedit .bashrc" and add the following:
# others
PATH=/opt/arm-eabi-4.4.3/bin:$PATH
export PATH

Restart your computer to apply changes.

c) Go to kernel source. Open the Makefile and look for:
ARCH ?= $(SUBARCH)
CROSS_COMPILE ?= arm-eabi-
CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)

Make sure the second line is set to arm-eabi-.

3. Make kernel config
a) Look for the appropriate defconfig file under /arch/arm/configs.
In Terminal, enter "make [name-of-defconfig]". This will create a .config file in the root of your kernel source.

b) Use "make menuconfig" to enable/disable kernel features.

c) After "make menuconfig", copy the contents of .config back into the defconfig you used from /arch/arm/configs. A shortcut for this is to create a file called "def" at the root of your kernel source. Paste the following into the "def" file:
#!/bin/bash
# This command will copy your kernel config to the defconfig folder.
# Change "yourkernelname" to what name you like,
# change "androidosversion" to what android os version that you design kernel for.
cp .config arch/arm/configs/cyanogenmod_p500_defconfig

Change the directory to that of the defconfig you used.
In Terminal, cd to your kernel source and make the "def" file executable by entering:
chmod +x def

Run the file by typing "./def"

4. Compiling kernel
a) To clean up the kernel source, use "make clean" to delete any already-compiled files or "make distclean" to clean up more files including .config. At this time, use "make clean".

b) Compile the kernel using "make -jx", where x is the number of CPU cores your computer has plus one.

5. Zipping the kernel
a) Create a directory called "android" and within that folder, create a folder called "releasefolder" by entering the following in Terminal:
cd ~/
mkdir ~/android
cd ~/android
mkdir releasefolder

b) To create a zip of the kernel, you will need the AnyKernel template. Enter the following in Terminal:
git clone git@github.com:austinay/AnyKernel.git -b p500

c) Just like with the "def" file, create a file called "zip" at the root of the kernel source and paste the following into the "zip" file"
#!/bin/bash
clear
now=$(date +"%Y%m%d_%H%M")
# Copy the new modules and new zImage to Anykernel folder.
cp drivers/net/wireless/bcm4325/wireless.ko ~/android/AnyKernel/system/lib/modules
cp arch/arm/boot/zImage ~/android/AnyKernel/kernel
# Creat flashable zip file
cd ~/android/AnyKernel
zip -r name-of-flashable-zip-file-${now}.zip *
# Drop it to release folder
mv ~/android/AnyKernel/name-of-flashable-zip-file-${now}.zip ~/android/releasefolder

Change "name-of-flashable-zip-file" to the name that you want to give to the zip of your kernel.
In Terminal, enter "./zip" to create a flashable zip.

COMMANDS
git clone [ssh address] - clone a repo
git branch [branch name] - create a branch
git add [path] - stage a modified file for committing
git add . - stage all modified file for commiting
git commit -m "your commit here" - commit staged files with your commit name
git commit -a - includes both "git add ." and "git commit -m"
git push - push changes to github
git push --force - force changes to be pushed to github
git push [remote name, which is usually "origin" for a forked repo] [branch name]
git clean -f - remove untracked files
git clean -f -d - remove untracked directories

COMMITS/PATCHES
After making changes to the kernel, push these changes as commits using the appropriate commands above.

To apply a commit (from another repo) as a patch, enter the following in Terminal:
git remote add [remote name] [repo SSH address]
git fetch [remote name]
git cherry-pick [SHA1 of commit]

To roll back to a certain commit, enter the following in Terminal:
git reset --hard [SHA1 of old commit]
git push -f

To patch the 3.0.x kernel to the latest version, look here:
http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/log/?h=linux-3.0.y

To apply a patch file:
git am [name-of-file].patch

OTHERS
To pull a newly created branch from the original repo, use:
git fetch [remote-name] [remote-branch]:[new-local-branch]

Kernel source:

sweetnsour-kernel: https://github.com/austinay/sweetnsour-kernel

base kernel: https://github.com/GenetICS/lge_kernel_msm7x27