[ACS][DEV][TUTORIAL] How to Build A Custom Kernel for the Samsung Epic 4G Touch
How to Build a Kernel for the Samsung Epic 4G Touch
So you want to learn how to build a kernel
? I guess you've more than likely come to the right place considering that's what the title has led you to believe, so why don't we get started?
As with all things worth doing, this is going to take a little time, and a little patience. If you don't get everything on the first try just go back and pick up where you left off. I'm 15. I started out the same way you did, all of us developers did. You can do it, it just takes practice and effort.
First off, your going to need some sort of Linux distribution installed on your hard drive or running in a virtual machine. I personally prefer Ubuntu
for it's user friendliness and easy learning curve but there are more bare distros out there you can mess around with. A mac might also work as well, but having never owned one I can't say for sure.
Setting up your build environment.
Once you have made sure you have a Linux distribution up and running (er..Mac) you can head on over to this link and download SPH-D710-Build-A-Kernel.zip
. This zip archive includes everything you are going to need, even an automatic building script I was nice enough to provide for your building pleasure.
You are going to want to extract the contents of this zip compression archive to your home folder, like so.
Breakdown of contents.
Let's take a look at what is included in the contents we just extracted, shall we?
Inside the folder labeled kernel
we have the folders source, initramfs, and toolchain. Let's break this down and explain what each is and what it means when compiling a kernel
source is included in the source folder (duh..). This includes everything that is used to compile
itself. These files are provided by Samsung after every update we get on our phones. So it's always a good idea to pay attention to when updates are released and then to check for kernel
source updates at the Open Source Samsung website.
I plan to keep this all updated as soon as the source drops for updates as well if you don't feel comfortable updating it yourself.
Moving on we have the initramfs folder. The initramfs of a kernel
is like the insides of a human. It tells the kernel
what to do, it's the brains of the whole operation. This is really where all the customization takes place and things like root and Clockworkmod Recovery are added. More on this all later in the tutorial.
What we have currently in this folder is another sub-folder dubbed stock. This included the stock initramfs that I was able to pull from the kernel
I grabbed from a stock Epic Touch. By building a kernel
with this initramfs we are building a completely stock kernel
As with every kernel
however, unless it is custom signed by Samsung then the yellow triangle will occur on boot. That is unless you use a usb jig to rid yourself of this problem.
Lastly, we have the toolchain folder. The toolchain is what is used to actually compile
using the source.
In software, a toolchain is the set of programming tools that are used to create a product.
Custom build script.
Going back to our home directory (remember: the directory we extracting everything to), we have build.sh.
Me being the nice person that I am, I have included a custom build script so you don't have to manually have to type in commands in Terminal, that is what build.sh is. Double clicking it will reveal a prompt asking you what you wish to do, since we want to build the kernel
we should probably select 'Run in Terminal'.
Once we do choose to actually click the 'Run in Terminal' option in the prompt we will be presented with...well, a Terminal that is running our custom build script. This script does alot of things without much effort, just a few button clicks, on your part.
It sets the path for the toolchain and the initramfs, something that we normally have to do manually, and it also takes the time to compile
, pull the compiled modules, copy them to the initramfs, and recompile the kernel
again. Afterwards, the compile
) is copied to the Desktop and automagically created into a .tar archive for flashing immediately via Odin.
Bam! You've created your very first [stock] kernel
Give yourself a pat on the back for being able to follow directions and be patient.
Once you've flashed your custom kernel
you can flash it on your phone head on over to Settings and then to About Phone and find some interesting information under kernel
that is sure to make you smile.
Part II coming very soon to a second post near you.