After pouring over the web for two days, finally, I could build the platform-specific, hardware-specific kernel for my Samsung SGS4G ( Galaxy S 4G). Here is a step-by-step procedure to achieve the same. I have also put down a complete procedure down to the last detail for two reasons :
1. It was very difficult for me to find the information for this particular phone (SGS4G) and had to google, google forever!
2. Serves as a reference for myself later.
I can fairly say, that this procedure, if followed to the letter will help you make a successful build for your SGS4G.
Part I. Android Platform Development environment setup:
1. You will need a Linux OS installed for the most efficient setup of the environment. Googling can help you with this, if need be. Make sure you have the build-essentials or equivalent setup on your machine which includes all the compilers, the dependencies etc… I will be using Ubuntu 11.04 as an example, the latest released when I was writing this reference.
2. Additionally – python 2.4 or later, JDK 6 recommended ( JDK 5 for Froyo based systems) and GIT 1.5.4 or later.
a. For Java SDK 6
$ sudo add-apt-repository “deb http://archive.canonical.com/ lucid partner”
$ sudo add-apt-repository “deb-src http://archive.canonical.com/ubuntu lucid partner”
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk
b. For the build tools and other tools needed by the android system.
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \
libgl1-mesa-dev g++-multilib mingw32 tofrodos
c. Create a new file in “/etc/udev/rules.d/51-android.rules” and add the following lines.
# adb protocol on passion (Nexus One) SUBSYSTEM==”usb”, ATTR{idVendor}==”18d1″, ATTR{idProduct}==”4e12″, MODE=”0600″, OWNER=”"
# fastboot protocol on passion (Nexus One) SUBSYSTEM==”usb”, ATTR{idVendor}==”0bb4″, ATTR{idProduct}==”0fff”, MODE=”0600″, OWNER=”"
# adb protocol on crespo (Nexus S) SUBSYSTEM==”usb”, ATTR{idVendor}==”18d1″, ATTR{idProduct}==”4e22″, MODE=”0600″, OWNER=”"
# fastboot protocol on crespo (Nexus S) SUBSYSTEM==”usb”, ATTR{idVendor}==”18d1″, ATTR{idProduct}==”4e20″, MODE=”0600″, OWNER=”"
In the bin directory (create if you don’t have one and add to your PATH variable) in your home directory download the repo script from the following link.
$ curl https://android.git.kernel.org/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
Now to download the source from the android repository,
a .Create a working directory (in your home directory preferably)
$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY
b. Run the repo init script to download the code. Note that this will take quite sometime to finish.
Go and grab a cup of coffee while it downloads.
$ repo init -u git://android.git.kernel.org/platform/manifest.git -b <froyo/gingerbread>
$ repo sync
c. Import the gpg key, Execute
$ gpg –import
and add this at the prompt and then press EOF(Ctrl+D) at the end.
—–BEGIN PGP PUBLIC KEY BLOCK—– Version: GnuPG v1.4.2.2 (GNU/Linux) mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3dvOx6/t43LPPIxeJ8eX9WB+8LLuROSV lFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw7 8tR1cXb197Ob8kOfQB3A9yk2XZ4ei4ZC3i6wVdqHLRxABdncwu5hOF9KXwCgkxMD u4PVgChaAJzTYJ1EG+UYBIUEAJmfearb0qRAN7dEoff0FeXsEaUA6U90sEoVks0Z wNj96SA8BL+a1OoEUUfpMhiHyLuQSftxisJxTh+2QclzDviDyaTrkANjdYY7p2cq /HMdOY7LJlHaqtXmZxXjjtw5Uc2QG8UY8aziU3IE9nTjSwCXeJnuyvoizl9/I1S5 jU5SA/9WwIps4SC84ielIXiGWEqq6i6/sk4I9q1YemZF2XVVKnmI1F4iCMtNKsR4 MGSa1gA8s4iQbsKNWPgp7M3a51JCVCu6l/8zTpA+uUGapw4tWCp4o0dpIvDPBEa9 b/aF/ygcR8mh5hgUfpF9IpXdknOsbKCvM9lSSfRciETykZc4wrRCVGhlIEFuZHJv aWQgT3BlbiBTb3VyY2UgUHJvamVjdCA8aW5pdGlhbC1jb250cmlidXRpb25AYW5k cm9pZC5jb20+iGAEExECACAFAknnWD4CGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIX gAAKCRDorT+BmrEOeNr+AJ42Xy6tEW7r3KzrJxnRX8mij9z8tgCdFfQYiHpYngkI 2t09Ed+9Bm4gmEO5Ag0ESedYRBAIAKVW1JcMBWvV/0Bo9WiByJ9WJ5swMN36/vAl QN4mWRhfzDOk/Rosdb0csAO/l8Kz0gKQPOfObtyYjvI8JMC3rmi+LIvSUT9806Up hisyEmmHv6U8gUb/xHLIanXGxwhYzjgeuAXVCsv+EvoPIHbY4L/KvP5x+oCJIDbk C2b1TvVk9PryzmE4BPIQL/NtgR1oLWm/uWR9zRUFtBnE411aMAN3qnAHBBMZzKMX LWBGWE0znfRrnczI5p49i2YZJAjyX1P2WzmScK49CV82dzLo71MnrF6fj+Udtb5+ OgTg7Cow+8PRaTkJEW5Y2JIZpnRUq0CYxAmHYX79EMKHDSThf/8AAwUIAJPWsB/M pK+KMs/s3r6nJrnYLTfdZhtmQXimpoDMJg1zxmL8UfNUKiQZ6esoAWtDgpqt7Y7s KZ8laHRARonte394hidZzM5nb6hQvpPjt2OlPRsyqVxw4c/KsjADtAuKW9/d8phb N8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior6b8LrZrAhkqDjA vUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmUtkBszwo G1S8fXgE0Lq3cdDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQ hN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+BmrEOeCUOAJ9qmR0l EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM= =Wi5D
—–END PGP PUBLIC KEY BLOCK—–
d. Build the code
$ . build/envsetup.sh
Then to get a complete build for the emulator, with all debugging enabled.
$ lunch full-eng
$ make -j4
e. The emulator is added to your path automatically by the build process. To run the emulator, type
$ emulator
Here is the screen shot of the emulator running Gingerbread built from scratch.

Gingerbread - Built and Emulated
Next part will cover building the kernel for the actual device , in this case, a Samsung Galaxy S 4G. I am still trying to figure out some smaller details to load the build onto the device. I will post it soon as soon as I figure it all out.