New: XDA launches forum for app developers. Discuss coding, tools, marketing, and more.
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
superatmos
Old
(Last edited by superatmos; 17th April 2012 at 09:15 PM.)
#1  
Recognized Contributor / Recognized Developer - OP
Thanks Meter 1175
Posts: 493
Join Date: Mar 2011
Location: Bangalore
Cool [HOW-TO][TUTORIAL]Building Kernel from source

Hi all,

I am a developer in GT-I9100G sub-section. I made a tutorial over there for I9100G on building a kernel. Since the method is very similar, I thought of posting a tutotial here for N7000 too so that it will help many new and aspiring developers to build their own kernel for GT-N7000.

Okay. Let's learn how to build kernel for Galaxy Note N7000. There are many ways to build. I am just presenting here the way I build and make kernel.

NOTE 1: Follow the instructions exactly.
NOTE 2: Kernel is opensource. If you make any changes to it, you're expected to share your source. (Usually people share it over github :))
NOTE 3: FLASHING KERNEL IS RISKY AND DANGEROUS. BE CAREFUL. BUILD AND FLASH ON YOUR OWN RISK.

What you need to have:
  • Ubuntu 10.04 and above (I use 10.04 :))
  • ARM tool chain (Download HERE. Click on IA32 GNU/Linux TAR under Advanced Packages)
  • Samsung's opensource kernel for N7000 (Download HERE. Go to Mobile->Mobile Phone-> Select GT-N7000 and download the zip)

Setting up toolchain:
  • Extract the tar you downloaded(Suggestion: Extract to one folder where you can have everything. In my case /home/superatmos/build_kernel).
  • After extracting, you'll see a folder named arm-2010q1. Inside there will be many folders (ex. bin, lib and so on.)

Folder structure will be: /home/<your_name>/build_kernel/arm-2010q1

Setting up kernel:
  • Extract the zip you've downloaded from samsung's opensource.
  • You'll find two zips.
  • Extract GT-N7000_Kernel.tar.gz to /home/<your_name>/build_kernel/

Folder structure: /home/<your_name>/build_kernel/GT-N7000_Kernel

Setting up initramfs:

Samsung's zImage is divided into two parts: Opensource kernel (which you downloaded from samsung's website) and initramfs (which is root file system to boot up the device).
  • Since I don't have the device, I don't have initramfs either. :( (If some kernel developer for GT-N7000 can provide a sample initramfs for reference, I can attach it here and give credits to him :))
  • The initramfs(let the folder name too be initramfs) folder need to be copied to /home/<your_name>/build_kernel/

Folder structure: /home/<your_name>/build_kernel/initramfs

Now the entire setup is ready. Let's start modifying kernel configuration.

Setting up kernel config:
  • Go to /home/<your_name>/build_kernel/GT-N7000_Kernel/arch/arm/configs folder.
  • Copy c1_rev02_q1_defconfig file and paste it in kernel root folder (/home/<your_name>/build_kernel/GT-N7000_Kernel/).
  • Rename c1_rev02_q1_defconfig to .config in kernel root folder.
  • Now open Makefile which is in your kernel root folder(/home/<your_name>/build_kernel/GT-N7000_Kernel/).
  • Modify the below lines (I guess line 195 and 196).

Code:
ARCH            ?= arm
CROSS_COMPILE   ?= /home/<your_name>/build_kernel/arm-2010q1/bin/arm-none-linux-gnueabi-
  • Save and close.

Modifying kernel configuration:

Now open .config file(which you renamed). If its not seen, it might be hidden. Go to View->Show hidden files and there you go.

Do the below things:

Adding local version:

Change CONFIG_LOCALVERSION=" " to anything you like. I add this way:

CONFIG_LOCALVERSION="-N7000-superatmos"

Adding initramfs path:

You need to let kernel know the path from which it needs to take initramfs.

Change CONFIG_INITRAMFS_SOURCE=" " to ../initramfs (In this tutorial it's the path. If you had copied anywhere else, give the path properly).

Enough for now. Once you get experience, you can modify many configurations as per your liking and save. This configuration can be changed by GUI too with the command make menuconfig.

The Important part: Building the kernel:
  • Open terminal.
  • Go to path /home/<your_name>/build_kernel/GT-N7000_Kernel/
  • Type make.

THAT'S ALL. YOUR zImage is ready and is available in /home/<your_name>/build_kernel/GT-N7000_Kernel/arch/arm/boot/zImage.

Install the zImage on the device:
Go to the path where zImage is present and type the below line in command line.

Code:
tar cvf N7000_kernel.tar zImage
Flash the tar using odin.


DONE. CONGRATULATIONS. NOW YOU'VE YOUR OWN KERNEL.

Give me your feedback so that I can improve this tutorial and make modifications to the tutorial if necessary. And of course do post here about how your build went. All the best.
My ROM: SuperROM for GT-I9100G , SuperROM for GSM Galaxy Nexus
My Kernels for Samsung Galaxy S II GT-I9100G: Gingerbread, ICS
Tutorial for Deodexing, Building Kernel and Making Custom ROM for Galaxy S2 GT-I9100G, Galaxy S2 GT-I9100 and Galaxy Note GT-N7000
My tutorial published in XDA News Portal
The Following 25 Users Say Thank You to superatmos For This Useful Post: [ Click to Expand ]
 
superatmos
Old
#2  
Recognized Contributor / Recognized Developer - OP
Thanks Meter 1175
Posts: 493
Join Date: Mar 2011
Location: Bangalore
Reserved
My ROM: SuperROM for GT-I9100G , SuperROM for GSM Galaxy Nexus
My Kernels for Samsung Galaxy S II GT-I9100G: Gingerbread, ICS
Tutorial for Deodexing, Building Kernel and Making Custom ROM for Galaxy S2 GT-I9100G, Galaxy S2 GT-I9100 and Galaxy Note GT-N7000
My tutorial published in XDA News Portal
The Following User Says Thank You to superatmos For This Useful Post: [ Click to Expand ]
 
superatmos
Old
#3  
Recognized Contributor / Recognized Developer - OP
Thanks Meter 1175
Posts: 493
Join Date: Mar 2011
Location: Bangalore
Reserved
My ROM: SuperROM for GT-I9100G , SuperROM for GSM Galaxy Nexus
My Kernels for Samsung Galaxy S II GT-I9100G: Gingerbread, ICS
Tutorial for Deodexing, Building Kernel and Making Custom ROM for Galaxy S2 GT-I9100G, Galaxy S2 GT-I9100 and Galaxy Note GT-N7000
My tutorial published in XDA News Portal
 
superatmos
Old
#4  
Recognized Contributor / Recognized Developer - OP
Thanks Meter 1175
Posts: 493
Join Date: Mar 2011
Location: Bangalore
Last one
My ROM: SuperROM for GT-I9100G , SuperROM for GSM Galaxy Nexus
My Kernels for Samsung Galaxy S II GT-I9100G: Gingerbread, ICS
Tutorial for Deodexing, Building Kernel and Making Custom ROM for Galaxy S2 GT-I9100G, Galaxy S2 GT-I9100 and Galaxy Note GT-N7000
My tutorial published in XDA News Portal
The Following User Says Thank You to superatmos For This Useful Post: [ Click to Expand ]
 
muhamet
Old
#5  
muhamet's Avatar
Senior Member
Thanks Meter 71
Posts: 546
Join Date: Feb 2011
Location: Skopje
Superatmos good too see you in N7000 forum.Wil you launch Superatmos Rom for N7000

Sent from my LG-P500 using xda premium
 
M3TALLICA
Old
#6  
Senior Member
Thanks Meter 472
Posts: 1,371
Join Date: Nov 2011
Been using windows all the time. Seems its good time to learn linux and ubuntu
 
superatmos
Old
#7  
Recognized Contributor / Recognized Developer - OP
Thanks Meter 1175
Posts: 493
Join Date: Mar 2011
Location: Bangalore
Quote:
Originally Posted by muhamet View Post
Superatmos good too see you in N7000 forum.Wil you launch Superatmos Rom for N7000

Sent from my LG-P500 using xda premium
Not as of now. I don't have the device. But I have plans to extend this tutorial to deodexing, modifying initramfs, building custom rom and more.
My ROM: SuperROM for GT-I9100G , SuperROM for GSM Galaxy Nexus
My Kernels for Samsung Galaxy S II GT-I9100G: Gingerbread, ICS
Tutorial for Deodexing, Building Kernel and Making Custom ROM for Galaxy S2 GT-I9100G, Galaxy S2 GT-I9100 and Galaxy Note GT-N7000
My tutorial published in XDA News Portal
The Following 4 Users Say Thank You to superatmos For This Useful Post: [ Click to Expand ]
 
ufk
Old
#8  
Junior Member
Thanks Meter 1
Posts: 25
Join Date: Feb 2012
Default looks interesting.

i just want to make sure.. if for some reason i used odin to flash the tarred zImage and it's a broken zImage. or corrupted file or false configuration that will break the booting process. will i see be able to go to download move or cwm mode ?
what are the risks here besides the regular odin risks ?
 
chasmodo
Old
#9  
chasmodo's Avatar
Senior Member
Thanks Meter 21477
Posts: 9,419
Join Date: Dec 2011
Location: Novi Sad

 
DONATE TO ME
Quote:
Originally Posted by ufk View Post
i just want to make sure.. if for some reason i used odin to flash the tarred zImage and it's a broken zImage. or corrupted file or false configuration that will break the booting process. will i see be able to go to download move or cwm mode ?
what are the risks here besides the regular odin risks ?
The risks are considerable, to say the least. Read what happened with one b0rked kernel here:

http://forum.xda-developers.com/show....php?t=1526852

The end result: about 40-50 hard bricked devices.
 
superatmos
Old
#10  
Recognized Contributor / Recognized Developer - OP
Thanks Meter 1175
Posts: 493
Join Date: Mar 2011
Location: Bangalore
Quote:
Originally Posted by ufk View Post
i just want to make sure.. if for some reason i used odin to flash the tarred zImage and it's a broken zImage. or corrupted file or false configuration that will break the booting process. will i see be able to go to download move or cwm mode ?
what are the risks here besides the regular odin risks ?
Yes. Flashing kernels is always risky. But as per my experience, its very hard to brick the device unless you do something unusual.

so it depends on you. BUILD AND FLASH AT YOUR OWN RISK.
My ROM: SuperROM for GT-I9100G , SuperROM for GSM Galaxy Nexus
My Kernels for Samsung Galaxy S II GT-I9100G: Gingerbread, ICS
Tutorial for Deodexing, Building Kernel and Making Custom ROM for Galaxy S2 GT-I9100G, Galaxy S2 GT-I9100 and Galaxy Note GT-N7000
My tutorial published in XDA News Portal