[Samsung Galaxy Nexus] 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.

I DO NOT RESPOND TO PRIVATE MESSAGES. EVERYTHING YOU NEED IS IN HERE.

If this guide helped you feel free to donate.

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

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

Ubuntu 12.04 64-Bit

Linux Mint 13 64-Bit

Compiling Jelly Bean AOSP ROMs with these 2 is possible WITHOUT ADDITIONAL WORK.

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 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 or Linux Mint.

When building a kernel, you only need to start from here. Pick the appropriate branch from the git manually. My example below shows how to download the required files to build a Jelly Bean kernel. What I did was visiting the git repository each time and picked the appropriate branch.

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

Again pick the right branch from https://android.googlesource.com/kernel/omap.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 'tuna', shouldn't this be maguro? No, actually not. Tuna is the board name, while maguro is the codename of the Nexus. 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, ...

Only do these when you are in the omap directory

Getting access to Ezekeel's work

If you want to change the text marked in red make sure to change the other one as well. You can think of this as a nickname for the remote repository.

Example of cherry-picking CUSTOM VOLTAGE

1. Go here: https://github.com/Ezekeel/GLaDOS-nexus-prime/commits/customvoltage_JB

2. Copy the SHA of the commit

3.

template

When encountering conflicts, you are on your own. I figured most of this out on my own. So if I can do it you can too.

Getting access to Francisco Franco's work

Getting access to http://www.kernel.org