# [Guide] Compiling Samsung Kernels



## Captainkrtek (Oct 23, 2011)

*Use the Source!*

By now most Samsung devices have their Kernel sources released, you can look for yours by going to http://opensource.samsung.com/ then under the Mobile tab, click Mobile Phones. You will then be presented with a large table full of device models and links. For this demo I will be using the Verizon Samsung Fascinate ED01 Source "SCH-I500_VZW_Froyo.zip". Click the link and choose to Agree to the Legalese you're presented with, your download should start immediatly after. While that is downloading, let's go over the ideal environment for Kernel development:

Multi-Core CPU for fast compiling
Linux OS, either installed or running in a Virtual Machine
Familiarity with a terminal
General understanding of what a Kernel is and what it does
A phone to test on.
Aside from those general needs, be patient, learning new things takes time and you may run into issues. By now your source is almost done downloading and now to get all setup...

*Getting down to business*

Now that the source is downloaded we need to get busy in a terminal, go ahead and extract the source to your home directory (/home/username) then open a terminal. For this demonstration I will be using Ubuntu 11.04 Natty Narwahl. With the terminal open, navigate to the directory where you extracted the two tar.gz files.

[email protected]:~$ cd /home/krtek/
[email protected]:~$ tar -xvf SCH-I500_VZR_Froyo_Kernel.tar.gz
You will now see it spit out all the files it has extracted, we can now go to working with the kernel source. For this demo we will just be compiling a stock kernel, to modify your kernel by adding such features as overclocking you can go look at other developers source and compare kernels with yours and theirs and find the diffs for certain files (Remember to always give credit!). Next we will take a look at the structure of the kernel and how to compile it simply.

[email protected]:~$ cd /home/krtek/Kernel/
[email protected]:~/Kernel$ ls
Below is the output of ls

arch COPYING crypto drivers fs init Kbuild lib Makefile net REPORTING-BUGS scripts sound test.txxt usr block CREDITS Documentation firmware include ipc kernel MAINTAINERS mm README samples security test.txt tools virt

Let's go over some of the main folders/files listed here and what they do:

arch - all of the architecture dependent code
crypto - the API for the crytography features
drivers - The code for hardware drivers
fs - All of the code for the filesystems in support in Linux
include - The Kernel header files are located here
init - This directory performs the bootstrapping function along with initialization of the OS
ipc - Interprocess Communication Support code
kernel - Kernel space code
lib - Helper functions for the kernel
mm - Memory management
net - Code for the network protocols and functions
sound - Sound support
And within each of these common directories are many sub-directories, the Linux kernel, as of March 14th, 2011, contains 14,294,439 lines of code in the 2.6.38 release [1].

Now that we know what all of this is, let's get our cross compiler setup and compile a kernel. In your terminal do:

[email protected]:~/Kernel$ sudo mkdir /opt/toolchain
[email protected]:~/Kernel$ cd /opt/toolchain
[email protected]:/opt/toolchian$ sudo wget http://smp-on-qemu.googlecode.com/f...-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
[email protected]:/opt/toolchain$ sudo tar -xjf arm-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
[email protected]:/opt/toolchain$ ls
arm-2009q3 arm-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2

arm-2009q3 is our toolchain that we will be using for compiling the kernel. Now onto that process!

*Compiling the Kernel*

Now that the toolchain is setup and our source is setup we must navigate back to where we were working:

[email protected]:/opt/toolchain$ cd /home/krtek/Kernel
[email protected]:~/Kernel$ make arch=arm atlas_03_defconfig
[email protected]:~/Kernel$ make ARCH=arm HOSTCFLAGS="-g -O3" -j8 CROSS_COMPILE=/opt/toolchain/arm-2009q3/bin/arm-none-linux-gnueabi-
Then go break out some coffee, when you return it should be done. It can take a long time if you're on a single or even dual core machine. If all went well it should spit out

Kernel: arch/arm/boot/zImage is ready

If not then check over all the command and make sure you have all the prerequisites fulfilled.

*Acknowledgments*

Huge thanks to Mark Dietz (Username: imnuts) for helping with troubleshooting a few issues and for teaching me a while ago.

1 - http://www.h-online.com/open/features/What-s-new-in-Linux-2-6-38-1205467.html?page=6


----------



## collierclark (Dec 2, 2011)

Hsomnus said:


> Tried changing to model to GALAXY NEXUS and saved then rebooted. But it reverts to AOKP AXIOM GNEX as soon as you close the file...even when it said "saved"...tried multiple times
> 
> Sent from my AOKP AXI0M GNEX using Tapatalk


wonder if we could add axiom to the games file. Any ideas where we could try that?

Sent from my AOKP AXI0M GNEX using Tapatalk


----------



## collierclark (Dec 2, 2011)

Hsomnus said:


> Tried changing to model to GALAXY NEXUS and saved then rebooted. But it reverts to AOKP AXIOM GNEX as soon as you close the file...even when it said "saved"...tried multiple times
> 
> Sent from my AOKP AXI0M GNEX using Tapatalk


wonder if we could add axiom into the games file. Could anyone direct me to the file I would need to try this in?

Sent from my AOKP AXI0M GNEX using Tapatalk


----------

