[Nexus S Android Development] djjonastybe:
If you see mistakes please contact me. If you think something can be shorter, easier, feel free to suggest.

I have spent a lot of time figuring this out. Not to mention making this guide.

If this guide helped you feel free to donate.

There is more to come, using different toolchains, important files, adding overclocking etc.

Coming soon

- Links to useful mods: deep idle, live oc, BLN, ...

- How to compile a custom kernel: eg air kernel

- A list of useful files and folders in the downloaded kernel source

Setting up the environment & building the kernel for the first time

Ubuntu 10.04 64-Bit (recommended)

Ubuntu 12.04 64-Bit

Note that you cannot compile AOSP ROMs with Ubuntu 12.04. Ubuntu 12.04 is fine for kernels.

If you want to use virtualization software, do not use Virtualbox. You can run into networking issues and so on. I suggest using VMWare Player instead, which is available for free on http://www.vmware.com

Installing latest updates & reboot.

Now we will download and install the latest Java 6 JDK from here. Look for Java 6 SE Update 33 or a later update version. Don't download Java 7 JDK. I am downloading the file below for this guide.

This guide assumes you have downloaded the file in the folder

Now reboot is optional but welcome. Let's play safe.

Install all required packages to play with Android.

Ubuntu 10.04

Ubuntu 12.04

Configure USB ports.

This file should get the contents:

Don't forget to replace the red marked text with your username from Ubuntu.

When building a kernel, you only need to start from here. Pick the appropriate branch from the git manually. I used the one below as an example. What I did was visiting the git repository each time and picked the appropriate branch.

https://android.googlesource.com/device/samsung/crespo

Again pick the right branch from https://android.googlesource.com/kernel/samsung.git

Ensure the toolchain is in your path.

Default, Easy solution

$(pwd) is a variable holding the current working directory.

Bandwidth-friendly solution

You can also download the toolchain to another directory. Bit first write down the directory you are working at.

Instead of specifying the location of the toolchain with a relative path, we must specify the absolute path here.

Now we go back to where we were working.

I hope you understand why I mentioned the bandwidth-friendly solution. With little insight you could have come up with it yourself.

Now let's build the kernel

[*]Now you need to put it in a flashable zip.

Possible issues, things to avoid, FAQ

- Avoid downloading the kernel sources to directories which might require root/superuser access. This is one of the reasons I downloaded all sources to '~/Documents'. This will save a lot of time messing with chmod or chown commands.

- What is 'herring', shouldn't this be crespo? No, actually not. Herring is the board name, while crespo is the codename of the Nexus S. Something you might want to remember when building kernels.

Interesting files and locations

<kernel_directory>/samsung/arch/arm/mach-s5pv210/cpu-freq.c

Overclocking

Voltages

Links to mods, source code, ...

I am making the patch files currently

Ezekeel's work https://github.com/Ezekeel/GLaDOS-nexus-s-ics

BLN

BLX

Custom Voltage

Deep Idle

Live OC

Touchwake

USB OTG

Voodoo

Samsung IDLE2 port for S5PV210 (Improved Deep Idle patch)