30 Oct 2011

Building Android (Kernel) from source & Repo

By Unknown | At 3:28 pm | Label : , , , , , , , , , , , , , , | 3 Comments
Building kernel tools :
git
ARM Compiler Toolchain
Kernel Source Code
Python
Valgrin
Java

*git     : $ sudo apt-get install git
*java    : $ apt-get install java, 

then choose either of 'em, then type command again like this :
$ sudo apt-get install *java-version
*valgrind : $ sudo apt-get install valgrind
*python  : $ sudo apt-get install python

*ARM toolchain :
Do a web search on code.google.com
or
u can use this (For Gioers)


*Kernel source code :
download from github.com
(For Gioers, u can download on here (Hyriand source code) or here
or my source code


U can download kernel source code by typing this command on terminal :
$ git clone https://github.com/iksteen/android_kernel_samsung_galaxygio

----SKIP THIS STEP IF YOU JUST WANNA BUILD KERNEL-----

And, u need to repo first.
U can type these commands to do :

$ mkdir ~/bin
$ PATH=~/bin:$PATH

$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY

$ repo init -u https://android.googlesource.com/platform/manifest -b gingerbread

[for GB]

$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
[for ICS]

*Choose your name & e-mail, and colour.
after u're done,

type this command :

$ repo sync -j2 ( for bandwidth min 10kbps max 20kbps )
$ repo sync -j4 ( for bandwidth min 20kbps max 40kbps )
$ repo sync -j8 ( for badnwitdh min 40kbps max 60kbps )
$ repo sync -j16 ( for bandwidth min 60kbps max 80kbps )
$ repo sync -j32 & -j64 ( for fast bandwidth )


or u can use this command :
  
$ mkdir -p ~/bin 
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo 

$ mkdir android-repo 
$ cd android-repo 
$ repo init -u https://android.googlesource.com/platform/manifest --mirror
 
And, type command for sync like above.
up to you to choose either of 'em. 

Wait till done.

---------------------------------------------------------------------------------
JUST CONTINUE DIRECTLY TO THIS BELOW STEP
---------------------------------------------------------------------------------
And, u do next steps (For Gioers):
$ mkdir android
$ mkdir sources
$ mkdir .Galaxy_Gio_Sources 


And if ya have downloaded all tools that they're needed,
u can do these steps :

Hold ctrl+H on your home.
Move your kernel source code to folder u created that it named .Galaxy_Gio_Sources

And, copas your ARM toolchain to source code folder.
Before do to the next step, u find the following lines on "Makefile" in source code folder :

#ARCH         ?=   $(SUBARCH)
CROSS_COMPILE     =

change them to

#ARCH        ?= arm
CROSS_COMPILE   = ./arm-2009q3/bin/arm-none-linux-gnueabi-

After that,

type these commands :

$ cd android
$ cd sources 



Then, type command on terminal :
$ ln -s /home/*name of your desktop/.Galaxy_Gio_Sources/android_kernel_samsung_galaxygio

U can grab config.gz on your HH with root explorer.
location >> proc/*config.gz
copas to sdcard.
Move to /android/sources/android_kernel_samsung_galaxygio/arch/arm/configs

Then, type these commands on terminal :
$ cd ~/android/sources/android_kernel_samsung_galaxygio/arch/arm/configs
$ gunzip config.gz

and rename it to be gio_rev03_defconfig
or

copy boot.img or zImage that u want to extract its config to root folder kernel sourse tree.
then, type this command from kernel source tree :
$ ./scripts/extract-ikconfig boot.img > gio_rev03_defconfig

this command means that it extracts config from boot.img to gio_rev03_defconfig file


Command before do compile :
$ export CCOMPILER=~/arm-2009q3/bin/arm-none-linux-gnueabi- or
$ export CCOMPILER=/home/*name of your desktop/arm-2009q3/bin/arm-none-linux-gnueabi-


next,
$ make ARCH=arm CROSS_COMPILE=$CCOMPILER gio_rev03_defconfig
then,
$ make ARCH=arm CROSS_COMPILE=$CCOMPILER


or directly w/o use export commands. Like these :

$ cd android
$ cd sources
$ cd android_kernel_samsung_galaxygio

$ cd arm-2009q3
$ chmod ugo+rwx bin

$ cd ..

then,
$ make
ARCH=arm CROSS_COMPILE=$CCOMPILER gio_rev03_defconfig
$ make ARCH=arm CROSS_COMPILE=~/android/sources/android_kernel_samsung_galaxygio/arm-2009q3/bin/arm-none-linux-gnueabi-

[Example}


compiled kernel location > arch/arm/boot/*zimage

And, if u wanna know how to repack your kernel image (zImage), go check to this thread!
just change a kernel image (boot.img-kernel) with your kernel image (zImage).
wanna clean?
try this command
:

$ make ARCH=arm CROSS_COMPILE=~/android/sources/cm-kernel/CodeSourcery/Sourcery_G++/bin/arm-none-eabi- clean
and you'll get log like these

  CLEAN   arch/arm/boot/compressed
  CLEAN   arch/arm/boot
  CLEAN   /home/delano/android/sources/cm-kernel
  CLEAN   arch/arm/kernel
  CLEAN   drivers/char
  CLEAN   kernel
  CLEAN   lib
  CLEAN   usr
  CLEAN   .tmp_versions
  CLEAN   vmlinux System.map .tmp_kallsyms1.o .tmp_kallsyms1.S .tmp_kallsyms2.o .tmp_kallsyms2.S .tmp_vmlinux1 .tmp_vmlinux2 .tmp_System.map


Thx to
Hyriand
Andika Edo Prabowo
Waqas
tj_styles
and
Yanuar Harry for their support

◄ Newer Post Older Post ►
 

www.technomonde.blogspot.com. © 2012. Delano's Blog. Powered by blogger.Theme Mod by Delanoister