# [HOW-TO] Build kernel from source



## jdkoreclipse (Jun 16, 2011)

Credits: adwinp (for the toolchain) adrynalyne ( for making a tbolt tutorial where i found this toolchain)

Prerequisites: Linux, having git installed

- If git isnt installed, you must run this command in your terminal:

```
<br />
sudo apt-get install git<br />
```
- Grab the latest source from google (run in terminal):

```
<br />
git clone [URL=https://android.googlesource.com/kernel/omap.git]https://android.googlesource.com/kernel/omap.git[/URL] && git checkout origin/android-omap-tuna-3.0<br />
```
- Download the toolchain from HERE and extract to a safe place. For me, its in the ~/android folder

- In your terminal, in the top of your source, run this command:

```
<br />
git fetch [URL=git://github.com/jdkernel/android-omap-tuna_3.0.git]git://github.com/jdkernel/android-omap-tuna_3.0.git[/URL] && git cherry-pick  4404cadd65fbb8d19ead31c655bdbf0b33db886b<br />
```
---------- Now is the time you would make edits to your source, if you want to ------------

- Now, you are going to run this to make the defconfig:

```
<br />
make tuna_defconfig<br />
```
- OPTIONAL: make edits to your config:

```
<br />
make menuconfig<br />
```
NOTE: A GUI will pop up, just enable/disable what you want in your kernel, then exit

- Make the build. If you followed the tutorial and extracted your toolchain to ~/android, your command will look like this:

```
<br />
make -j9 ARCH=arm CROSS_COMPILE=~/android/4.4.4/bin/arm-none-eabi-<br />
```
And thats it! You have successfully compiled your kernel.

NOTE: your terminal will tell you where your kernel and modules will be located.
Note2: If you want to make your kernel flashable, just download one of my kernels, open up the zip, delete the system folder, replace my zimage with the one you compiled, and you are done.


----------



## blaineevans (Jul 11, 2011)

+1 on this.


----------



## dadsterflip (Jul 16, 2011)

this is awesome...


----------

