Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Thread Closed

[ACS][DEV][TUTORIAL] How to Build A Custom Kernel for the Samsung Epic 4G Touch

OP bubby323

6th October 2011, 07:49 AM   |  #1  
OP Account currently disabled
Flag Michigan City, IN
Thanks Meter: 1,485
 
1,603 posts
Join Date:Joined: Jul 2010
Donate to Me
More
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.

Prerequisites

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?

Code:
kernel
--source
--initramfs
----stock
--toolchain

build.sh


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.

The kernel source is included in the source folder (duh..). This includes everything that is used to compile the kernel 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.

Initramfs.

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.

Stock initramfs.

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.

Toolchain.

Lastly, we have the toolchain folder. The toolchain is what is used to actually compile the kernel using the source.

Quote:

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 the kernel, pull the compiled modules, copy them to the initramfs, and recompile the kernel again. Afterwards, the compile zImage (kernel) is copied to the Desktop and automagically created into a .tar archive for flashing immediately via Odin.



Profit!

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.

Flashing.

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.
Attached Files
File Type: tar SPH-D710_Kernel_Gingerbread.tar - [Click for QR Code] (5.55 MB, 136 views)
Last edited by bubby323; 6th October 2011 at 08:13 AM.
The Following 32 Users Say Thank You to bubby323 For This Useful Post: [ View ]
6th October 2011, 07:49 AM   |  #2  
OP Account currently disabled
Flag Michigan City, IN
Thanks Meter: 1,485
 
1,603 posts
Join Date:Joined: Jul 2010
Donate to Me
More
Part II: What does the build script actually do?
Last edited by bubby323; 6th October 2011 at 07:51 AM.
The Following 5 Users Say Thank You to bubby323 For This Useful Post: [ View ]
6th October 2011, 07:49 AM   |  #3  
OP Account currently disabled
Flag Michigan City, IN
Thanks Meter: 1,485
 
1,603 posts
Join Date:Joined: Jul 2010
Donate to Me
More
Part III: Being creative within the initramfs.
Last edited by bubby323; 6th October 2011 at 07:52 AM.
The Following 7 Users Say Thank You to bubby323 For This Useful Post: [ View ]
6th October 2011, 07:54 AM   |  #4  
OP Account currently disabled
Flag Michigan City, IN
Thanks Meter: 1,485
 
1,603 posts
Join Date:Joined: Jul 2010
Donate to Me
More
Part IV: Messing around with the source.
The Following 7 Users Say Thank You to bubby323 For This Useful Post: [ View ]
6th October 2011, 07:54 AM   |  #5  
OP Account currently disabled
Flag Michigan City, IN
Thanks Meter: 1,485
 
1,603 posts
Join Date:Joined: Jul 2010
Donate to Me
More
Part V: A conclusion to a story that just began.
Last edited by bubby323; 6th October 2011 at 07:57 AM.
The Following 4 Users Say Thank You to bubby323 For This Useful Post: [ View ]
6th October 2011, 07:56 AM   |  #6  
musclehead84's Avatar
Senior Member
Flag Falling Waters, WV
Thanks Meter: 971
 
4,341 posts
Join Date:Joined: Nov 2010
More
Thanks bubby. I'm interested in learning this as well. Thanks man. Please keep this updated for us.

Sent From My Evo Killer!!!
6th October 2011, 12:08 PM   |  #7  
deano0714's Avatar
Senior Member
Thanks Meter: 356
 
1,747 posts
Join Date:Joined: Sep 2010
Donate to Me
More
Awesome

Sent from my SPH-D710 using XDA App
6th October 2011, 12:58 PM   |  #8  
Member
Thanks Meter: 0
 
31 posts
Join Date:Joined: Aug 2007
Thanks Bubby! This is exactly what I have been looking for... especially the build script. Now I don't have an excuse for being lazy, it's time to wipe off the dust from my old linux box!
6th October 2011, 02:32 PM   |  #9  
Member
Thanks Meter: 5
 
41 posts
Join Date:Joined: Feb 2011
Thank you Bubby! This is awesome, I'm pretty excited I've always wanted to play around with Android, I think this will be a great place to start! I just installed Ubuntu on my work laptop, probably a ****ty idea but wth. Looking forward to the later posts!


PS Can we get this Stickied?
Last edited by Econ212; 6th October 2011 at 02:42 PM.
6th October 2011, 02:49 PM   |  #10  
spdwiz18's Avatar
Senior Member
Flag st. charles Missouri
Thanks Meter: 161
 
398 posts
Join Date:Joined: Sep 2010
More
OMG>>>>>>>> you rock. iv been looking all over for this and could never find anything for a samsung phone. they were all htc.......

Wheres the donate button? you have a KEG coming your way. THANK YOU.

The Following 2 Users Say Thank You to spdwiz18 For This Useful Post: [ View ]
Thread Closed Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes