[Guide][How-to's] Developer's work shop - NEW: Build a Kernel

Search This thread

Jamison904

Senior Member
Jun 9, 2009
5,449
15,168
Jacksonville, Florida
Developer's Work shop



How to setup a development environment for nOobs, How to make a basic ROM from Samsung's stock firmware, how to setup and use the apktool, how to compile AOKP for the d2tmo (T-Mobile S3), how to port to an unsupported device for AOSP/CM/AOKP coming....



Table of contents
  • Setting up Linux and a developers environment how to for Linux - post 2
  • Android Kitchen how to for Linux - post 3
  • Apktool how to for Linux - post 4
  • Manually decompile and recompile smali, jar's and even apks' how to for Linux - post 4
  • How to compile AOKP for d2tmo (T-mobile S3) - post 5
  • How to cherry pick - post 5 Thanks to Midnight_Rider - post 5
  • How to compile a kernel for d2tmo (T-mobile S3) - post 6




Code:
#include 
/*
* Your warranty is now void.
*
* I am not responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because the alarm app failed. Please
* do some research if you have any concerns about features included in this ROM
* before flashing it! YOU are choosing to make these modifications, and if
* you point the finger at me for messing up your device, I will laugh at you.
*/

By using these guides you agree with the above terms!










 
Last edited:

Jamison904

Senior Member
Jun 9, 2009
5,449
15,168
Jacksonville, Florida
Setting up Linux and a developers environment how to for Linux:


Ok guys here is my setup that has successfully worked for me for over 2 years. You have to have a developer environment like this to move on to the "how to" build a basic ROM. Also again this guide is for Linux ( 64 bit is a must!!!) Here goes.


First you need to figure out if you are going to use a virtual box https://www.virtualbox.org/wiki/Downloads or dual boot http://goo.gl/zK65u (which I storngly suggest.)​

Now you need to chose the distro http://en.wikipedia.org/wiki/Linux_distribution

Personally I run Ubuntu 12.04 LTS and strongly suggest you use it as well if you plan on doing extensive development. Head over to Ubuntu and download it there. Download page

Now after you have downloaded Ubuntu (64 bit!) you need to install Linux.​

Easiest way is to put in a blank DVD and click on the ISO(Ubuntu os) and burn the image on the DVD. You can also setup and burn it onto a thumb drive that is at least 4 gb. You will need to Google this if you want to go that way.​

once you have burnt the image you will need to install, reboot your computer and watch the screen (make sure the DVD or thumb drive is in.) Most computers will say either hit "ESC" or F9 or F12 to pull up boot options.​

Now select the option that say something about DVD/something,,,, this will bring up the options from within the boot disk. Select live boot. This will bring up Linux. Once it is up sign into your Wifi router because this is needed in the install.​

Click on the Icon that says install Ubuntu. Install . . . and follow prompts. Very easy setup...​

Congratulations you now have Linux installed. :cool:




Before anything you need to install right click terminal then reboot for it to effect. Do this now.

Code:
sudo apt-get install nautilus-open-terminal

Now head over to my github and download the developer setup package I have made for you guys. This way everything is in one place. I will try and keep the tools up to date as well. Download - https://github.com/jamison904/developer_setup



Once downloaded, extract. Then open the folder find andadb.sh. Right click it and go to permissions and mark this file executable. Now open termial and;
Code:
. andadb.sh


Now you will have a few options. BE CAREFUL :evil: not to do them all. Some we still will need to do manually and will cause issues if you do them :shock: here.​


**********************************************************
Android ADB Installer 2.1
Main Menu
**********************************************************
1 - Resolve dependencies ( Run this first )
2 - Install Android SDK & Android NDK
3 - Install adb & fastboot
4 - Nautilus right-click to adb push support
5 - MTP Support for Galaxy Nexus <- Do not do!
6 - Create/update the 99-android.rules file
7 - Install aapt & apktool <- Do not do! NEED TO DO MANUALLY
8 - Install git-repo <- Do not do!
9 - Help and information
0 - Exit
*********************************************************

Enter selection:



once you are done with this step you are 90% done. You can now start playing with the Android Kitchen. I will make another thread to show you how to set up and use the apktool.​



Update for java

The script above will install an outdated version of java. No worries, here is the fix.

- first you need to uninstall the current version of Java by copying and pasting this into the terminal:

Code:
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*

- Say yes and let it do it's thing.

- Now you will install the most supported version of java. Download link

Code:
sudo mkdir -p /opt/java/64/
sudo cp jdk-6u38-linux-x64.bin /opt/java/64
sudo su -
cd /opt/java/64
chmod +x jdk-6u38-linux-x64.bin
./jdk-6u38-linux-x64.bin
exit




Add your Path for Android SDK and Java

In terminal do:
Code:
gedit ~/.bashrc

Now add the following to the end of the bashrc:

Code:
# Java PATHs
export JAVA_HOME=/opt/java/64/jdk1.6.0_##
export PATH=$PATH:$JAVA_HOME/bin


Code:
#Android PATH
export PATH=$PATH:~/android/sdk
export PATH=$PATH:~/android/sdk/platform-tools
export PATH=$PATH:~/android/sdk/tools

Then save and close.

Congrats you're done.​


if you have any issues you may do this manually:

Code:
sudo apt-get install git gnupg flex bison gperf build-essential \
  zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
  libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
  libgl1-mesa-dev g++-multilib mingw32 tofrodos \
  python-markdown libxml2-utils xsltproc zlib1g-dev:i386

then

Code:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

 

Attachments

  • Developmentsetup.zip
    4.4 KB · Views: 312
Last edited:

Jamison904

Senior Member
Jun 9, 2009
5,449
15,168
Jacksonville, Florida
Android Kitchen how to for Linux:


Code:
 This is a rough draft and I will clean it up and make it look pretty later... :cool:

OK guys this is a step by step "How to"

The goal is to teach you how to take a stock firmware from Samsung and convert it into a custom ROM that anyone can download and flash through a custom recovery like ClockWorksMod (CWM.)

- First off this guide is written for Linux. I am personally using Ubuntu 12.04 at the moment. I really don't believe Android development should be done on Windows so I will not be writing a Windows version of this guide. That being said, I don't have an issue with someone else writing one and using this to convert to as long as it is posted here!

- At this point I am going to assume you are running Linux and have some basic understanding of it. Now you will need to have Java and Android SDK installed. I have written a "HOW TO" above

_____

- First you will need to download Samsung's stock firmware. You can get it from here http://www.sammobile.com/firmware/?page=3&model=SGH-T999&pcode=TMB&os=1&type=1 This is Jelly Bean for the T-Mobile S3, but you can use this site to download the stock firmware for any other Samsung devices.

- Now you need to download dsixda's Android Kitchen (be sure to thank him!) http://xdaforums.com/showthread.php?t=1939420

- Now make a folder to keep everything and so you know where everything is. I named mine "Development."

- extract dsixda's Android Kitchen into this folder.

- extract Samsung's firmware, then extract the .tar. Now move the boot.img, System.img and the cache.img to a folder called "original_update" inside the Android kitchen.

- Now rick click on menu inside the kitchen and go to properties, permissions and make it excitable. Then double click it and select run in terminal.


============================================================
Android Kitchen 0.223 - by dsixda (xda-developers.com)
============================================================

> MAIN MENU

1 - Set up working folder from ROM
2 - Add root permissions
3 - Add BusyBox
4 - Disable boot screen sounds
5 - Zipalign all *.apk files to optimize RAM usage
6 - Change wipe status of ROM
7 - Change name of ROM
8 - Show working folder information

0 - ADVANCED OPTIONS
00 - LEGACY OPTIONS (old and rarely used)
99 - Build ROM from working folder

u - Kitchen Info/Update/Donate
x - Exit


Enter option:


Now input option # 1 which goes to:

CREATE WORKING FOLDER FOR ROM
==============================

Ensure there is at least one ROM under the 'original_update' folder!

Select an option:

s - Show supported formats
x - Abort, don't create working folder

Or press Enter to continue

?

pick S to read or enter to go on...(enter!)

? s

----------------------------------------------------------------------

The format for each ROM must be one of the following:

- system.img + optional boot.img/lib.img (e.g. stock ROM or Nandroid)
- ZIP file for a custom ROM (e.g. update.zip)
- ZIP file containing *.img (e.g. stock rom.zip)
- ZIP file containing shipped ROM in SYSTEM + BOOT folder format
- Working folder made with this kitchen (e.g. WORKING_old_rom)

Other formats:

Samsung Galaxy S:
- factoryfs.rfs + optional cache.rfs/zImage
- PDA.tar.md5 + optional CSC.tar.md5/PHONE.tar.md5
- PDA.tar + optional CSC.tar/PHONE.tar
- TAR/ZIP file containing factoryfs.rfs + more
- TAR/ZIP file containing PDA.tar.md5/PDA.tar + more

Samsung Galaxy S Plus:
- system.img.ext4 + optional cache.img.ext4/boot.img
- TAR/ZIP file containing system.img.ext4 + more

Samsung Galaxy SII:
- factoryfs.img + optional cache.img/zImage
- system.img.ext4 + optional cache.img.ext4/boot.img
- TAR/ZIP file containing factoryfs.img/system.img.ext4 + more
- system.ext4.tar + optional boot.img (Nandroid backup)

Huawei:
- APP file from Huawei software update (e.g. UPDATE.APP)

----------------------------------------------------------------------

what I currently have working

Available ROMs:

(1)
(2) Deodexed_T999UVDLI8.zip
(3) Deodexed_T999UVDLI6_1.zip
(4) system.img.ext4, cache.img.ext4 and boot.img <- What you are looking for!
(5) WORKING_S3_16
(6) WORKING_S3_toggles
(7) WORKING_S3
(8) WORKING_note

Enter selection number (default=1, cancel=0, r=refresh):

then after inputting the right selection you will see:

Available ROMs:

(1)
(2) Deodexed_T999UVDLI8.zip
(3) Deodexed_T999UVDLI6_1.zip
(4) system.img.ext4, cache.img.ext4 and boot.img
(5) WORKING_S3_16
(6) WORKING_S3_toggles
(7) WORKING_S3
(8) WORKING_note

Enter selection number (default=1, cancel=0, r=refresh): 4

Found original_update/system.img.ext4
Found original_update/cache.img.ext4
Found original_update/boot.img

The new working folder will be named WORKING_112412_232858
Change the name (y/n)? (default: n):

y <- here, and name WORKING_Hello_world


Creating working folder WORKING_Hello_world...
Copying boot.img ...


Analyzing system.img.ext4 ...
Analyzing cache.img.ext4 ...

Compiling simg2img ...
simg2img successfully compiled

Converting system.img.ext4 into a format for unpacking ...

Adding an update-script ...

Mounting ext4_system.img to loopback device and then extracting files ...
[sudo] password for jamison904: <- input YOUR password and enter

____

Now it will ask if you want to see the details of your ROM

Working folder information

Android OS version : 4.1.1
Device : d2tmo
Model : SGH-T999
ROM Name : JRO03L.T999UVDLJA
Rooted (Superuser.apk + su) : NO
Rooted (unsecured boot.img) : NO
BusyBox installed : NO
BusyBox run-parts support : NO
Apps2SD (Apps to EXT) enabled : NO
/data/app enabled : NO
Custom boot animation allowed : NO
Nano text editor installed : NO
Bash shell support : NO
/system/framework is deodexed : NO
/system/app is deodexed : NO
radio.img found : NO
ROM will wipe all data : NO


Press Enter to continue


Now select # 2 to add Root! Then option "F"

ROOTING
--------------------------------------------

The following will be done for root:

- Add Superuser.apk and su
- Add necessary lines to the update-script
- Update default.prop in the ramdisk

--------------------------------------------

Which version of the Superuser package do you want
to install?

f - ChainsDD's version (Android 2.x+)
s - Old and simple version (All Android)

x - Cancel rooting (default)

?

ok... then #3 for busy box and # 7 to change the name of your ROM

The current name of the ROM is:

JRO03L.T999UVDLJA


Would you like to rename it (y/n)? (default: y): y

Please enter the new name: Hello World!

Hit option 8 again for the ROM INFO:

Working folder information

Android OS version : 4.1.1
Device : d2tmo
Model : SGH-T999
ROM Name : Hello World!
Rooted (Superuser.apk + su) : YES
Rooted (unsecured boot.img) : YES
BusyBox installed : YES
BusyBox run-parts support : NO
Apps2SD (Apps to EXT) enabled : NO
/data/app enabled : NO
Custom boot animation allowed : NO
Nano text editor installed : NO
Bash shell support : NO
/system/framework is deodexed : NO
/system/app is deodexed : NO
radio.img found : NO
ROM will wipe all data : NO


Press Enter to continue


Ok now "0" for advanced

============================================================
Android Kitchen 0.223 - by dsixda (xda-developers.com)
============================================================

> ADVANCED OPTIONS

11 - De-odex files in your ROM
12 - Tools for boot image (unpack/re-pack/etc.)
13 - Add /data/app functionality
14 - Add /etc/init.d scripts support (busybox run-parts)
15 - Unpack data.img
16 - Sign APK or ZIP file(s)
17 - Convert update-script or updater-script
18 - Plugin scripts

99 - Build ROM from working folder
0 - BACK TO MAIN MENU

Enter option:

Now select #11 to Deodex files in your ROM to make customization possible!

The process usually takes several minutes and does NOT require
you to sign any of the files afterwards.

----------------------------------------------------------------

Found 49 *.odex files in system/framework
Found 133 *.odex files in system/app

Enter a choice:

bb = Back up both folders (do first!)
v = Set Android OS version (Current API level = 15)

IMPORTANT: Ensure you set the correct API level

f = Deodex /system/framework
a = Deodex /system/app
b = Deodex both folders (recommended)
s = Deodex a single file
x = Exit

?

First set the compression level for the Android version you are working on, ie. 4.2.2 = 17

Now seclect "b" for both folders


============================================================
Android Kitchen 0.223 - by dsixda (xda-developers.com)
============================================================

> ADVANCED OPTIONS

11 - De-odex files in your ROM
12 - Tools for boot image (unpack/re-pack/etc.)
13 - Add /data/app functionality
14 - Add /etc/init.d scripts support (busybox run-parts)
15 - Unpack data.img
16 - Sign APK or ZIP file(s)
17 - Convert update-script or updater-script
18 - Plugin scripts

99 - Build ROM from working folder
0 - BACK TO MAIN MENU


Enter option:

Now do 13 - Add /data/app functionality and 14 - Add /etc/init.d scripts support (busybox run-parts)

~ More advanced tweaks and other tips coming later in next post....

Now at this point after making your tweaks and changes, you will select option # 99. After that I am normally running after my daughter so I pick option # 2 which automates the zipping, signing, and naming process



Now very import before you flash!! Make sure you compare the blocks from my installer script and the one you have from the kitchen. Make sure that yours has this information and nothing else or you will end up with a soft brick or even a hard brick with no return!!

Code:
/dev/block/mmcblk0p14 - for system
/dev/block/mmcblk0p17 - for cache
/dev/block/mmcblk0p15 - for data
/dev/block/mmcblk0p7 - for the boot.img (kernel)

Code:
ui_print(" ");
ui_print(" ");
ui_print(" ");
ui_print(" ");
ui_print(" ");
ui_print(" ");
ui_print(" ");
ui_print("**************************");
ui_print("*                        *");
ui_print("*       INFAMOUS S3      *");
ui_print("*           BY           *");
ui_print("*       JAMISON904       *");
ui_print("*                        *");
ui_print("**************************");
ui_print(" ");
ui_print(" ");
ui_print(" ");
ui_print(" ");
ui_print(" ");
ui_print(" ");
ui_print("Deleting stuff... ");
show_progress(0.999999, 99);
unmount("/system");
format("ext4", "EMMC", "/dev/block/mmcblk0p14", "0");
mount("ext4", "EMMC", "/dev/block/mmcblk0p14", "/system");
mount("ext4", "EMMC", "/dev/block/mmcblk0p17", "/cache");
delete_recursive("/cache");
delete_recursive("/data/dalvik-cache");
delete_recursive("/sdcard/.adobe");
delete_recursive("/sdcard/.adobe-digital-editions");
delete_recursive("/sdcard/.android_secure");
delete_recursive("/sdcard/bugreports");
delete_recursive("/sdcard/LOST.DIR");
delete_recursive("/sdcard/tmp");
mount("ext4", "EMMC", "/dev/block/mmcblk0p15", "/data");
package_extract_dir("data", "/data");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
delete_recursive("/data/dalvik-cache");
 
ui_print("Installing the System");
package_extract_dir("system", "/system");
set_perm(0, 1000, 0755, "/system/xbin/busybox");
run_program("/system/xbin/busybox", "--install", "-s", "/system/xbin");
symlink("/system/xbin/busybox", "/system/bin/busybox");
ui_print("Setting Symlinks");
symlink("toolbox", "/system/bin/df");
symlink("toolbox", "/system/bin/dmesg");
symlink("toolbox", "/system/bin/insmod");
symlink("toolbox", "/system/bin/log");
symlink("toolbox", "/system/bin/rmdir");
symlink("toolbox", "/system/bin/schedtop");
symlink("toolbox", "/system/bin/route");
symlink("toolbox", "/system/bin/netstat");
symlink("toolbox", "/system/bin/hd");
symlink("toolbox", "/system/bin/umount");
symlink("toolbox", "/system/bin/ifconfig");
symlink("toolbox", "/system/bin/sleep");
symlink("toolbox", "/system/bin/printenv");
symlink("toolbox", "/system/bin/smd");
symlink("toolbox", "/system/bin/sendevent");
symlink("toolbox", "/system/bin/ionice");
symlink("toolbox", "/system/bin/vmstat");
symlink("toolbox", "/system/bin/stop");
symlink("toolbox", "/system/bin/ioctl");
symlink("toolbox", "/system/bin/iftop");
symlink("toolbox", "/system/bin/rmmod");
symlink("toolbox", "/system/bin/ls");
symlink("toolbox", "/system/bin/setprop");
symlink("toolbox", "/system/bin/top");
symlink("toolbox", "/system/bin/mount");
symlink("toolbox", "/system/bin/notify");
symlink("toolbox", "/system/bin/reboot");
symlink("toolbox", "/system/bin/cat");
symlink("toolbox", "/system/bin/start");
symlink("toolbox", "/system/bin/cmp");
symlink("toolbox", "/system/bin/lsmod");
symlink("toolbox", "/system/bin/getprop");
symlink("toolbox", "/system/bin/wipe");
symlink("toolbox", "/system/bin/touch");
symlink("toolbox", "/system/bin/renice");
symlink("toolbox", "/system/bin/kill");
symlink("toolbox", "/system/bin/getevent");
symlink("toolbox", "/system/bin/rm");
symlink("toolbox", "/system/bin/nandread");
symlink("toolbox", "/system/bin/setconsole");
symlink("toolbox", "/system/bin/dd");
symlink("toolbox", "/system/bin/sync");
symlink("toolbox", "/system/bin/ps");
symlink("toolbox", "/system/bin/id");
symlink("mksh", "/system/bin/sh");
symlink("toolbox", "/system/bin/md5");
symlink("toolbox", "/system/bin/lsof");
symlink("toolbox", "/system/bin/mkdir");
symlink("toolbox", "/system/bin/mv");
symlink("toolbox", "/system/bin/watchprops");
symlink("toolbox", "/system/bin/chmod");
symlink("toolbox", "/system/bin/uptime");
symlink("toolbox", "/system/bin/newfs_msdos");
symlink("toolbox", "/system/bin/chown");
symlink("toolbox", "/system/bin/ln");
symlink("toolbox", "/system/bin/date");
symlink("Roboto-Regular.ttf", "/system/fonts/DroidSans.ttf");
symlink("Roboto-Bold.ttf", "/system/fonts/DroidSans-Bold.ttf");
ui_print("Setting Permissions");
set_perm_recursive(0, 0, 0755, 0644, "/system");
set_perm_recursive(0, 0, 0755, 0755, "/system/etc/init.d");
set_perm_recursive(0, 2000, 0755, 0755, "/system/bin");
set_perm(0, 3003, 06755, "/system/bin/ip");
set_perm(0, 3003, 02750, "/system/bin/netcfg");
set_perm(0, 3004, 02755, "/system/bin/ping");
set_perm(0, 2000, 06750, "/system/bin/run-as");
set_perm_recursive(1002, 1002, 0755, 0440, "/system/etc/bluetooth");
set_perm(0, 0, 0755, "/system/etc/bluetooth");
set_perm(1000, 1000, 0640, "/system/etc/bluetooth/auto_pairing.conf");
set_perm(3002, 3002, 0444, "/system/etc/bluetooth/blacklist.conf");
set_perm(1002, 1002, 0440, "/system/etc/dbus.conf");
set_perm(1014, 2000, 0550, "/system/etc/dhcpcd/dhcpcd-run-hooks");
set_perm(0, 2000, 0550, "/system/etc/init.goldfish.sh");
set_perm_recursive(0, 0, 0755, 0555, "/system/etc/ppp");
set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor");
set_perm_recursive(0, 0, 0755, 0644, "/system/vendor/firmware");
set_perm(0, 2000, 0755, "/system/vendor/firmware");
set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");
set_perm(0, 0, 04755, "/system/xbin/bash");
symlink("/system/xbin/bash", "/system/bin/sh");
set_perm(0, 0, 04755, "/system/xbin/nano");
set_perm(0, 0, 04755, "/system/xbin/sysrw");
set_perm(0, 0, 04755, "/system/xbin/sysro");
set_perm(0, 0, 06755, "/system/xbin/su");
set_perm(0, 0, 06755, "/system/bin/su");
symlink("/system/xbin/su", "/system/bin/su");
package_extract_dir("extra/system", "/system");

ui_print("Flashing kernel");

assert(package_extract_file("boot.img", "/tmp/boot.img"),
       write_raw_image("/tmp/boot.img", "/dev/block/mmcblk0p7"),
       delete("/tmp/boot.img"));

ui_print("");
run_program("/sbin/busybox", "cp", "/tmp/recovery.log", "/sdcard/Infamous_recovery.log");
ui_print("Finishing");
unmount("/system");
show_progress(0.000000, 0);
ui_print(" ");
ui_print(" ");
ui_print("Done. Enjoy! ~ Jamison904");



 
Last edited:

Jamison904

Senior Member
Jun 9, 2009
5,449
15,168
Jacksonville, Florida
Apktool how to for Linux:


http://xdaforums.com/showthread.php?t=1755243 First go here to iBotPeaches's Apktool thread.

Sidenote: check out the change log here and apply where needed. http://code.google.com/p/android-apktool/wiki/Changelog


- Now download the apktool here: http://android-apktool.googlecode.com/files/apktool1.5.1.tar.bz2

- Then go here and download the needed package for the OS you are running (Linux) http://code.google.com/p/android-apktool/downloads/list

Now extra both zip's to your desktop.

- Now open the terminal and navigate to the desktop. (or go to Ubuntu software center and search "right click terminal" and download it.

- No that you are in desktop in the terminal you need to give each of the three files root access.

- to do this you will need to chown -R and type the location of the file.:

Code:
chown -R

- The quickest and easiest way to type "chown -R " then the location (jamison904:jamison904) then drag and drop the file into the terminal. So it will look like this (also it will prompt you for your password.)

example:

Code:
jamison904@lapy:~/Desktop$ chown -R jamison904:jamison904 '/home/jamison904/Desktop/aapt' 
jamison904@lapy:~/Desktop$ chown -R jamison904:jamison904 '/home/jamison904/Desktop/apktool' 
jamison904@lapy:~/Desktop$ chown -R jamison904:jamison904 '/home/jamison904/Desktop/apktool.jar'

jamison904:jamison904 = your user name.

If this doesn't work for the verision of Linux you are on you should try this as well:

Code:
jamison904@lapy:~/Desktop$ chown -R  '/home/jamison904/Desktop/aapt' 
jamison904@lapy:~/Desktop$ chown -R  '/home/jamison904/Desktop/apktool' 
jamison904@lapy:~/Desktop$ chown -R  '/home/jamison904/Desktop/apktool.jar'

- Now we have to make each executable by sudo chmod +x

Code:
sudo chmod +x

It will look like this:

Code:
jamison904@lapy:~/Desktop$ sudo chmod +x '/home/jamison904/Desktop/aapt' 

[sudo] password for jamison904: 

jamison904@lapy:~/Desktop$ sudo chmod +x '/home/jamison904/Desktop/apktool' 

jamison904@lapy:~/Desktop$ sudo chmod +x '/home/jamison904/Desktop/apktool.jar'

Now to be sure right click each one and click properties then click the Permissions tab and make sure "allow executing file as program" is clicked.


- Last we have to move all three to Usr/local/bin. BUT you have to be running as root to do this...

- So to do this you will need to press Alt + F2 and type: gksu nautilus

- Now navigte to Usr/local/bin and drag and drop all three here. Now close that window.

Done with the setup. Now a quick how to use it


How to use:

- Open the terminal in the same folder as the apps you want to mod. I normally take the app an the frameworks and place them in a folder on the desktop. I name it whatever the project is. i.e. "Toggles mod"

- now you will need add the framerork-res.apk and the twframework-res.apk to the apktool.

Code:
apktool if framework-res.apk   <- enter, then
apktool if twframework-res.apk  <- enter

Now you need to decompile the apk you are working on, lets say the SystemUI.apk

Code:
apktool d SystemUI.apk   <- enter

At this point you will make your modifications. . . . then you will need to recompile the apk.

Code:
apktool b SystemUI   <- enter

Now if all goes well you will have a new modded apk. One more step and you're done.


- Last you will need to open the archive of both the orignal apk and your new modded apk.

- Grab the META-INF folder and the original AndroidManifest.xml from the original apk and drag and drop both into your new modded apk then close the archive.

- I have attached a test zip for you to use. Just place the apk or jar where it goes. ie...SystemUI.apk goes into system/app and framework-res.apk goes into system/framework. Just double click the zip and go to the folder the apk or jar goes to and drag and drop it in then just close the archive. No signing needed this way. :cool:





Manually decompile and recompile smali, jar's and even apks' how to for Linux:


First off, huge shout out and thanks to Jesusfreke!!! Without him none of this would be possible.


First head over to download section and download
Code:
baksmali-1.4.2.jar
smali-1.4.2.jar

then rename them to
Code:
baksmali.jar
smali.jar

Now make a new folder. I named mine smali. Place both into the new folder.




Next go to Ubuntu software center and download 7zip.

Lets use the android.policy.jar as an example for this part of the guide.

Take the android.policy.jar and place it into the new folder (smali)

double click on the android.policy.jar to open the archive. Then click on the class.dex and drag it and drop into the folder (smali)



Now for the fun part.

Right click and open terminal here inside the folder. (If you haven't got it yet please do. Go to Ubuntu software center and download right click terminal.)

Now you type this or copy and paste:
Code:
java -jar baksmali.jar -o classout/ classes.dex

this will decompile the class.dex to a folder named class. Make your changes then continue.



Now to recompile you will type or copy and paste:
Code:
java -Xmx512M -jar smali.jar classout/ -o new-classes.dex

This will give you the output of new-classes.dex. If you get any errors or don't get a "new-classes.dex" then you had an error. Copy what the terminal says and paste it here and I will help you figure it out. If it is long please paste it over at pastebin.com and post a link here. Trying to keep it clean in here. Thanks!


You will want to copy the android.policy.jar and the new-classes.dex to a new folder inside the folder you have been working. I name this folder Test1. This way you don't overwrite the stock ones. Plus makes it easiser to keep track of what worked and what did not.


Now all you need to to is double click on the android.policy.jar to open the archive again. Now since you are in the Test1 folder rename new-classes.dex to
classes.dex. Last just drag classes.dex to the archive and drop it. It will add the new classes.dex to the archive. Once it is done close the archive and test to see if your chages worked.

I have attached a test zip for you to use. Just place the apk or jar where it goes. ie...SystemUI.apk goes into system/app and framework-res.apk goes into system/framework. Just double click the zip and go to the folder the apk or jar goes to and drag and drop it in then just close the archive. No signing needed this way. :cool:
 

Attachments

  • Test.zip
    149.6 KB · Views: 31
Last edited:

Jamison904

Senior Member
Jun 9, 2009
5,449
15,168
Jacksonville, Florida
How to compile AOKP for d2tmo (T-mobile S3)





This is a quick walk through to get you started compiling AOKP MR1 4.2.2 from source. I have made it super easy for you and anyone who can read will be able to do it. Again this is for Linux ( 64 bit is a must!!!!.) You will also need at least 50 gigs of free space. ( I would go as far as saying 100 gig but you can get by with 50.)

First you need to download my repo tool Download link

Once you have it download extract to your working folder. Then right click and open terminal here. Then:
Code:
chmod +x Repo_Sync.sh

This will make the script executable.





Now in the terminal you will do:

Code:
. Repo_Sync.sh

This will pull up the main menu.

##########################################################
# Jamison904 Tools #
#========================================================#
# 1 - Install Java-6 #
# 2 - Install Required Packages #
# 3 - Sync AoCP Jellybean #
# 4 - Sync CM9 #
# 5 - Sync AOSP Jellybean #
# 6 - Sync LiquidSmooth JB #
# 7 - sync CNA Jellybean #
# 8 - Sync CM10 #
# 9 - Sync AOKP #
# 10 - Sync AOKP Jellybean #
# 11 - Sync Baked AOSP #
# 12 - Slim 4.2 #
##########################################################
# x - Exit #
##########################################################

Enter option:





DO NOT DO OPTION 1. This is older and will undo the version on Java you installed from above and is no longer the supported version of Java.

Now pick option # 2. This will install the required packages you will need to build.




Now pick number 10 - Sync AOKP Jellybean. This will make a folder called AOKP and will initiate the repo and download the source ( you can move this folder later.) Follow the on screen prompts and input your name ( Real name ) and a real email address. At this point go have a beer and wash the wife's car. This will take a while depending on your internet speed.






Now you will need to add the local manifest so it knows where to get the source for the kernel. Do a "Ctrl and h" to show hidden folders. Now open the . repo folder. Then do a right click and add new document. Rename the new document to local_manifest.xml then copy and paste the code below and then save it.


Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="github"
fetch="https://github.com/" />
<!-- Kernels -->
<project path="kernel/samsung/d2" name="AOKP/kernel_samsung_d2" remote="aokp" revision="jb-mr1" />
</manifest>






Now that you have the local manifest in the . repo folder you will need to download the kernel source.
Do:
Code:
repo sync



Almost there.... once it finishes it is time to try your first build.

To start the build type in this command:

Code:
. build/envsetup.sh && brunch d2tmo -j5

The . build/envsetup.sh part sets up the environment to build. The && part tells the terminal to also do this. The brunch d2tmo tells it to build for the T-mobile S3. Last the -j5 tells it how many jobs to do at once. The higher the number the more jobs it will do. Be careful though because you can do too many jobs for your computer and will bog out and will even cause a build to fail if you run out of memory. Rule of thumb here is one for each core you have then add one. I have a quad core so I do -j5. If you have a dual core do -j3 and if you are not sure you can leave it off completely. (.build/envsetup.sh && brunch d2tmo)




This is where is gets fun. The first build will take a few hours. If you get any errors copy as much of the termial as you can and make a pastebin (www.pastebin.com) and link it here for us to help you with. PLEASE DO NOT PASTE THE WHOLE THING HERE!!! Thanks.




Now if you get a screen with AOKP in a few colors then you have a successful build. Time to backup your phone and test out your work. The Finished zip will be in the out folder. AOKP/out/target/product/d2tmo to be exact. You will want to grab the aokp_d2tmo_unofficial_Mar-25-13.zip this is the one you should flash.





Almost done. Once you have a successful build you will want to install and activate ccache. This will cut your build time in half or more!!!

First you need to install it.
Code:
sudo apt-get install ccache

Put the following in your .bashrc by doing:
Code:
gedit ~/.bashrc

now add
Code:
export USE_CCACHE=1
save then close.

Now to set it you will need to
Code:
ccache -M 50

The 50 stands for 50gigs!!! The recommended size is 50-100GB but the size you use is up to you.



Cherry pick how to coming. . . .









Check out the awesome how to by my bro Midnight_Rider Link to his write-up. Check it out and be sure to thank him!!!!
 
Last edited:

Jamison904

Senior Member
Jun 9, 2009
5,449
15,168
Jacksonville, Florida
How to compile a kernel for d2tmo (T-mobile S3)




First off let me start with saying this, half assing a kernel or not following all the steps exactly will brick your device!. You have been warned. I personally was every hesitant to even try to make my own kernels because of the brick factor. After researching for weeks and reading like crazy I felt like I had enough knowledge to attempt to build my own kernel. After talking with my buddy TDJ he told me that when it comes to kernels you just have to get learn by hands on. Of course he was right. So be careful and if something doesn't seem right,do not flash it. Also the kernel_test.zip attached is for TMO/ATT S3. I haven't checked to see if the boot block is the same for all of the US S3's. I'll check and update this. Until then only use for TMO/ATT S3.

Code:
#include 
/*
* Your warranty is now void.
*
* I am not responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because the alarm app failed. Please
* do some research if you have any concerns about features included in this ROM
* before flashing it! YOU are choosing to make these modifications, and if
* you point the finger at me for messing up your device, I will laugh at you.
*/

[COLOR="Red"]By using this how to you agree with the above terms![/COLOR]

Now with that out of the way lets have some fun! This how to is for the T999 TW kernel. This guide will work for all S3 devices with minimal changes. Also the basics here will work for all devices. Also at this point the guide is only build a stock kernel without changes. That will come in another update. I will need to show you git and how to use it before you can make changes. Also if you make and changes and you share the kernel with others you have to post your source!! So you will need to know how to use github or bithub. These too will come later.



First you will need to download the source for the kernel. You will need to go to http://opensource.samsung.com/ and find the source for your device. Search for t999 and grab the one named SGH-T999_JB_TMB_Opensource.zip. Or you can grab it from my Goo account here. . . . .


Now you need to extract the zip. Then extract Kernel.tar.gz. Now make a folder in your home directory if you have not already called android. Then inside android make another director called kernel. Last make a folder for you kernel, you can name it whatever. For this how to lets just call it T999_TW_kernel. Now move everything from the extracted Kernel.tar.gz to this folder. This is your kernel working folder.


Next you will need to choose the toolchain you plan on using. There are many great ones out there. Just Google "kernel tool chain" to see the many different ones. The Android NDK comes with a bunch and most are 100% stable. Since I also suport AOKP for many devices, I just use the one they use. I have uploaded it to my github for you guys to download and use. Go to https://github.com/jamison904/arm-eabi-4.6 and click on zip to download it.

toolchain_download_zps0a5b5d34.png



Now you will need to set your path and set the cross compile in your make file inside your kernel working folder.

toolchain_path_zps02b13b60.png


We are going to setup your toolchain path now. Extract the downloaded toolchain from my github and make a folder inside the android folder called toolchain. Now move the extracted tool chain here. Open up the make file in the kernel folder and set your path like below. (of course change Jamison904 to whatever yours is named.) save and close.

Code:
ARCH		?= arm
CROSS_COMPILE  = /home/jamison904/android/toolchain/arm-eabi-4.6/bin/arm-eabi-


your_kernel_path_zpsba07a510.png




Name your kernel! Open the make folder and make the change then save and close.

name_kernel_zps5610da70.png




Now open terminal here inside the kernel build folder. You need set it up. You need to:

Code:
make clean && make mrproper





Ok time to pull the defconfig from your phone (This is for a TW Kernel so you need to be running a TW ROM. You also will need to be running a stock kernel for this to work right...) You will need to connect your phone to your computer with adb debugging turned on. Then open the terminal from your desktop and:

Code:
adb pull /proc/config.gz

then

Code:
gunzip config.gz

This will give you a file called config. You will want to rename this file to t999_defconfig. After that you will need to move this file to /home/jamison904 (your user name)/android/kernel/T999_TW_kernel/arch/arm/configs. Drop it here.




Now it is time to attempt to build. You will need to do:

Code:
make xconfig

This will bring up a nice user friendly UI to help you set up the build.



xconfig1_zpsb0e66db4.png



xconfig2_zps337faad7.png




Now you need to click on the folder. Navigate to arch/arm/config and click on your T999_defconfig.
xconfig3_zpscb3c6a48.png




This shows you where to find the schedulers. You can change the default scheduler here. Also can turn them on and off, as well if you want to build them in or make them build as a module.
xconfig4_zpsb9451799.png




This shows you where to find the governors. You can change the default governor here. Also can turn them on and off, as well if you want to build them in or make them build as a module.
xconfig5_zps1827e8ef.png





Now lets see if you set it up correctly.... lol. You will do:

Code:
make

build_zpsa3526892.png

Later after you know that it will build you can seed it up by doing make -j5. This will make with 5 jobs at once. This is way faster but very hard to trouble shoot and find your errors. If it stops without finishing you will need to make clean && make mrproper then do the xconfig again and save and close then "make" .... This will only make with one job at a time thus you have an error and it will stop and you will be able to read the error. Copy and paste to pastebin.com and post the link here and I will help you figure it out. :cool:





If you get this, congratulations you have made your first kernel... time to package it up and test.


Kernel_done_zpsb1783124.png










Finding the zimage (kernel itself.) Navigate to arch/arm/boot and grab the zimage.

Find_zimage1_zps089773ec.png



find_zimage2_zpsd73bde0e.png



find_zimage3_zpse39c6f45.png



find_zimage4_zpse8d810bf.png




Now to find the modules. Do a ctrl f in the root of your kernel build folder and screach for .ko. Make sure to include the . before ko. Then copy and paste these into a folder to hold them for the zip.


find_modules_zpsae12a7fc.png



find_modules2_zpsef12e054.png




Now you need to unpackage a boot.img and replace the zimage then repackage it up. The easiest way to do this is with the Android kitchen. Takes less then a minute. If you have been following my guides here you will already have it setup and have working knowledge of the kitchen. If not, stop here and go catch up, i'll wait....;) Ok moving on.





I made a folder called WORKING_Kernel to keep these away from real working folders just in case I forget. Don't need to update my S2 ROM with a S3 kernel. Anyways...

bootimage1_zps33b0bb5d.png



Place a stock boot.img into the folder
bootimage2_zpsfaab82c8.png



Now start up the kitchen and press 0. Then option 12 for boot.img.
bootimage3_zpsf59ce127.png



Then press w. This will unpack the boot.img.
bootimage4_zps2e4dd41d.png



bootimage5_zps60231c36.png



The end result will be a folder called "BOOT-EXTRACTED"
bootimage6_zps9c45fb06.png




Open it and you will see the ram-disk and the Zimage (kernel). Delete the Zimage here!
bootimage7_zps7f68d1d4.png



Grab your new Zimage and copy and paste it in to the "boot-extracted"
bootimage8_zpsd5b50db7.png



bootimage9_zps9243b450.png




Now to repackage it. Back over in the Kitchen press "b" to build
bootimage10_zps2f87951e.png



bootimage11_zpsb87bf7b3.png



Your new kernel is in the boot.img
bootimage12_zpse7cdcbe6.png






Now to flash the kernel. I have made you guys an empty flashable zip attached below. This way no one breaks their device trying to flash their kernel. If you do brick you didn't read the directions as this zip is dummy proof so to speak. ;)



Now double click on the kernel_test.zip and drag and drop your new boot.img into the archive.

zip1_zpsd7c7021c.png



zip2_zps75f21a05.png




Now navigate to system/lib/modules and press Ctrl A to select all of the modules then drag and drop these here.
zip4_zps2e2b739c.png


zip5_zpsb54c4863.png


zip6_zps4875672a.png






Done. Copy and paste the zip to your SDcard and reboot into recovery and pry.... lol. You will be good if you followed the directions. Enjoy your own build stock TW kernel! Again remember not to public share your kernel unless you have uploaded "your exact source" and can provide a public link to it. You have been warned! Next updates will include how to work git, commits, and github as well as some more advanced kernel tweaks and code. Also how Cherry-pick :cool:
done_zpsacfb0b02.png



For more advanced kernel work you will need meld to work conflicts. Open terminal and:

Code:
sudo apt-get install meld

Now when you get a conflict from cherry picking you will do

Code:
git status

this will show you the conflicting files. Then to work them you will need to

Code:
git mergetool

For more info on how to use it go to http://meldmerge.org/ ... have fun!

 

Attachments

  • kernel_test.zip
    149.9 KB · Views: 37
Last edited:

gypsy214

Senior Member
Jan 24, 2011
2,197
528
Dallas, Tx
Awesome man. A million+ thanks. by the way you couldnt make it any simpler. It is very understandable. A have a little bit of knowledge but this clear up all my questions.
 
  • Like
Reactions: Jamison904

aaldiar

Senior Member
Sep 21, 2010
788
717
Hardcore man, I was just thinking of attempting making my own ROM sets my way. installed Linux Mint and working on getting this going.
 

famandeggs

Senior Member
Oct 31, 2010
149
65
Las Vegas, NV
Re: [Guide][How-to's]Rom's, Smali, code. Links to all S3 MODs and Tweaks!

Indeed, there is a wealth of information scattered all over. It's nice to have everything neatly organized and in a clear concise format, that's easy to understand :) thx for this Jamison, will be looking forward to the additional information you add to this!
 
Last edited:

ticojpunk

Senior Member
Aug 29, 2011
608
236
New City, NY
Re: [Guide][How-to's]Rom's, Smali, code. Links to all S3 MODs and Tweaks!

This thread is inspiring me to finally get another Linux box running... and finally get to work building my own ROMs instead of bugging developers for simple stuff I know I could probably do myself.

Great thread!

Sent from my Frosty-powered SGH-T999 via Tapatalk 2
 

Jamison904

Senior Member
Jun 9, 2009
5,449
15,168
Jacksonville, Florida
Thanks bro! And thanks guys! This stuff isn't hard at all, you just have to know where to find your answers. When I was learning all this the hard way I always thought, "man it would be nice if someone put a basic all in one guide." Well that is my plans here. Also I will do my best to help with any issues and/or error you might encounter as well as I am sure Jovy wouldn't mind helping you guys out as well. Dude is a stand up guy! :cool: That is why I love the Android community, everyone help each other!
 

myowin

Senior Member
Apr 4, 2010
250
211
Thanks bro! And thanks guys! This stuff isn't hard at all, you just have to know where to find your answers. When I was learning all this the hard way I always thought, "man it would be nice if someone put a basic all in one guide." Well that is my plans here. Also I will do my best to help with any issues and/or error you might encounter as well as I am sure Jovy wouldn't mind helping you guys out as well. Dude is a stand up guy! :cool: That is why I love the Android community, everyone help each other!

And let me help you what I can.. Confirmation # 25913992HP008102C
I am a family man like you. I am sure you are good or better than me on balancing between work and life. Kudos my friend. :good:
 

Jamison904

Senior Member
Jun 9, 2009
5,449
15,168
Jacksonville, Florida
Re: [Guide][How-to's]Rom's, Smali, code. Links to all S3 MODs and Tweaks!

Bro thank you! Really helps and I really appreciate it! Paypal is going to think something is up with all these donations from you buddy lol! You rock man.

Yeah I try to keep a good balance. I have been doing OK, just haven't been sleeping lately. Have a lot planned here and hope this turns into a one stop developers how to and help thread, also this way we can all work towards a common goal: To make these awesome devices into the super phones they are and how Samsung should of released them.

Sent from my dark hole called an office.
 
  • Like
Reactions: myowin

mgbotoe

Senior Member
Is there a compile list somewhere with different mods? I have been searching for a while on this forum and can't seem to locate...
I am not looking into building a rom for the public just wanted to tweak a bit to make something descent for myself...I love doing this kind of things, more of a hubby...something to do my spare time .
 

Top Liked Posts

  • There are no posts matching your filters.
  • 37
    Developer's Work shop



    How to setup a development environment for nOobs, How to make a basic ROM from Samsung's stock firmware, how to setup and use the apktool, how to compile AOKP for the d2tmo (T-Mobile S3), how to port to an unsupported device for AOSP/CM/AOKP coming....



    Table of contents
    • Setting up Linux and a developers environment how to for Linux - post 2
    • Android Kitchen how to for Linux - post 3
    • Apktool how to for Linux - post 4
    • Manually decompile and recompile smali, jar's and even apks' how to for Linux - post 4
    • How to compile AOKP for d2tmo (T-mobile S3) - post 5
    • How to cherry pick - post 5 Thanks to Midnight_Rider - post 5
    • How to compile a kernel for d2tmo (T-mobile S3) - post 6




    Code:
    #include 
    /*
    * Your warranty is now void.
    *
    * I am not responsible for bricked devices, dead SD cards,
    * thermonuclear war, or you getting fired because the alarm app failed. Please
    * do some research if you have any concerns about features included in this ROM
    * before flashing it! YOU are choosing to make these modifications, and if
    * you point the finger at me for messing up your device, I will laugh at you.
    */
    
    By using these guides you agree with the above terms!










    22
    Setting up Linux and a developers environment how to for Linux:


    Ok guys here is my setup that has successfully worked for me for over 2 years. You have to have a developer environment like this to move on to the "how to" build a basic ROM. Also again this guide is for Linux ( 64 bit is a must!!!) Here goes.


    First you need to figure out if you are going to use a virtual box https://www.virtualbox.org/wiki/Downloads or dual boot http://goo.gl/zK65u (which I storngly suggest.)​

    Now you need to chose the distro http://en.wikipedia.org/wiki/Linux_distribution

    Personally I run Ubuntu 12.04 LTS and strongly suggest you use it as well if you plan on doing extensive development. Head over to Ubuntu and download it there. Download page

    Now after you have downloaded Ubuntu (64 bit!) you need to install Linux.​

    Easiest way is to put in a blank DVD and click on the ISO(Ubuntu os) and burn the image on the DVD. You can also setup and burn it onto a thumb drive that is at least 4 gb. You will need to Google this if you want to go that way.​

    once you have burnt the image you will need to install, reboot your computer and watch the screen (make sure the DVD or thumb drive is in.) Most computers will say either hit "ESC" or F9 or F12 to pull up boot options.​

    Now select the option that say something about DVD/something,,,, this will bring up the options from within the boot disk. Select live boot. This will bring up Linux. Once it is up sign into your Wifi router because this is needed in the install.​

    Click on the Icon that says install Ubuntu. Install . . . and follow prompts. Very easy setup...​

    Congratulations you now have Linux installed. :cool:




    Before anything you need to install right click terminal then reboot for it to effect. Do this now.

    Code:
    sudo apt-get install nautilus-open-terminal

    Now head over to my github and download the developer setup package I have made for you guys. This way everything is in one place. I will try and keep the tools up to date as well. Download - https://github.com/jamison904/developer_setup



    Once downloaded, extract. Then open the folder find andadb.sh. Right click it and go to permissions and mark this file executable. Now open termial and;
    Code:
    . andadb.sh


    Now you will have a few options. BE CAREFUL :evil: not to do them all. Some we still will need to do manually and will cause issues if you do them :shock: here.​


    **********************************************************
    Android ADB Installer 2.1
    Main Menu
    **********************************************************
    1 - Resolve dependencies ( Run this first )
    2 - Install Android SDK & Android NDK
    3 - Install adb & fastboot
    4 - Nautilus right-click to adb push support
    5 - MTP Support for Galaxy Nexus <- Do not do!
    6 - Create/update the 99-android.rules file
    7 - Install aapt & apktool <- Do not do! NEED TO DO MANUALLY
    8 - Install git-repo <- Do not do!
    9 - Help and information
    0 - Exit
    *********************************************************

    Enter selection:



    once you are done with this step you are 90% done. You can now start playing with the Android Kitchen. I will make another thread to show you how to set up and use the apktool.​



    Update for java

    The script above will install an outdated version of java. No worries, here is the fix.

    - first you need to uninstall the current version of Java by copying and pasting this into the terminal:

    Code:
    sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*

    - Say yes and let it do it's thing.

    - Now you will install the most supported version of java. Download link

    Code:
    sudo mkdir -p /opt/java/64/
    sudo cp jdk-6u38-linux-x64.bin /opt/java/64
    sudo su -
    cd /opt/java/64
    chmod +x jdk-6u38-linux-x64.bin
    ./jdk-6u38-linux-x64.bin
    exit




    Add your Path for Android SDK and Java

    In terminal do:
    Code:
    gedit ~/.bashrc

    Now add the following to the end of the bashrc:

    Code:
    # Java PATHs
    export JAVA_HOME=/opt/java/64/jdk1.6.0_##
    export PATH=$PATH:$JAVA_HOME/bin


    Code:
    #Android PATH
    export PATH=$PATH:~/android/sdk
    export PATH=$PATH:~/android/sdk/platform-tools
    export PATH=$PATH:~/android/sdk/tools

    Then save and close.

    Congrats you're done.​


    if you have any issues you may do this manually:

    Code:
    sudo apt-get install git gnupg flex bison gperf build-essential \
      zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
      libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
      libgl1-mesa-dev g++-multilib mingw32 tofrodos \
      python-markdown libxml2-utils xsltproc zlib1g-dev:i386

    then

    Code:
    sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

    21
    Android Kitchen how to for Linux:


    Code:
     This is a rough draft and I will clean it up and make it look pretty later... :cool:

    OK guys this is a step by step "How to"

    The goal is to teach you how to take a stock firmware from Samsung and convert it into a custom ROM that anyone can download and flash through a custom recovery like ClockWorksMod (CWM.)

    - First off this guide is written for Linux. I am personally using Ubuntu 12.04 at the moment. I really don't believe Android development should be done on Windows so I will not be writing a Windows version of this guide. That being said, I don't have an issue with someone else writing one and using this to convert to as long as it is posted here!

    - At this point I am going to assume you are running Linux and have some basic understanding of it. Now you will need to have Java and Android SDK installed. I have written a "HOW TO" above

    _____

    - First you will need to download Samsung's stock firmware. You can get it from here http://www.sammobile.com/firmware/?page=3&model=SGH-T999&pcode=TMB&os=1&type=1 This is Jelly Bean for the T-Mobile S3, but you can use this site to download the stock firmware for any other Samsung devices.

    - Now you need to download dsixda's Android Kitchen (be sure to thank him!) http://xdaforums.com/showthread.php?t=1939420

    - Now make a folder to keep everything and so you know where everything is. I named mine "Development."

    - extract dsixda's Android Kitchen into this folder.

    - extract Samsung's firmware, then extract the .tar. Now move the boot.img, System.img and the cache.img to a folder called "original_update" inside the Android kitchen.

    - Now rick click on menu inside the kitchen and go to properties, permissions and make it excitable. Then double click it and select run in terminal.


    ============================================================
    Android Kitchen 0.223 - by dsixda (xda-developers.com)
    ============================================================

    > MAIN MENU

    1 - Set up working folder from ROM
    2 - Add root permissions
    3 - Add BusyBox
    4 - Disable boot screen sounds
    5 - Zipalign all *.apk files to optimize RAM usage
    6 - Change wipe status of ROM
    7 - Change name of ROM
    8 - Show working folder information

    0 - ADVANCED OPTIONS
    00 - LEGACY OPTIONS (old and rarely used)
    99 - Build ROM from working folder

    u - Kitchen Info/Update/Donate
    x - Exit


    Enter option:


    Now input option # 1 which goes to:

    CREATE WORKING FOLDER FOR ROM
    ==============================

    Ensure there is at least one ROM under the 'original_update' folder!

    Select an option:

    s - Show supported formats
    x - Abort, don't create working folder

    Or press Enter to continue

    ?

    pick S to read or enter to go on...(enter!)

    ? s

    ----------------------------------------------------------------------

    The format for each ROM must be one of the following:

    - system.img + optional boot.img/lib.img (e.g. stock ROM or Nandroid)
    - ZIP file for a custom ROM (e.g. update.zip)
    - ZIP file containing *.img (e.g. stock rom.zip)
    - ZIP file containing shipped ROM in SYSTEM + BOOT folder format
    - Working folder made with this kitchen (e.g. WORKING_old_rom)

    Other formats:

    Samsung Galaxy S:
    - factoryfs.rfs + optional cache.rfs/zImage
    - PDA.tar.md5 + optional CSC.tar.md5/PHONE.tar.md5
    - PDA.tar + optional CSC.tar/PHONE.tar
    - TAR/ZIP file containing factoryfs.rfs + more
    - TAR/ZIP file containing PDA.tar.md5/PDA.tar + more

    Samsung Galaxy S Plus:
    - system.img.ext4 + optional cache.img.ext4/boot.img
    - TAR/ZIP file containing system.img.ext4 + more

    Samsung Galaxy SII:
    - factoryfs.img + optional cache.img/zImage
    - system.img.ext4 + optional cache.img.ext4/boot.img
    - TAR/ZIP file containing factoryfs.img/system.img.ext4 + more
    - system.ext4.tar + optional boot.img (Nandroid backup)

    Huawei:
    - APP file from Huawei software update (e.g. UPDATE.APP)

    ----------------------------------------------------------------------

    what I currently have working

    Available ROMs:

    (1)
    (2) Deodexed_T999UVDLI8.zip
    (3) Deodexed_T999UVDLI6_1.zip
    (4) system.img.ext4, cache.img.ext4 and boot.img <- What you are looking for!
    (5) WORKING_S3_16
    (6) WORKING_S3_toggles
    (7) WORKING_S3
    (8) WORKING_note

    Enter selection number (default=1, cancel=0, r=refresh):

    then after inputting the right selection you will see:

    Available ROMs:

    (1)
    (2) Deodexed_T999UVDLI8.zip
    (3) Deodexed_T999UVDLI6_1.zip
    (4) system.img.ext4, cache.img.ext4 and boot.img
    (5) WORKING_S3_16
    (6) WORKING_S3_toggles
    (7) WORKING_S3
    (8) WORKING_note

    Enter selection number (default=1, cancel=0, r=refresh): 4

    Found original_update/system.img.ext4
    Found original_update/cache.img.ext4
    Found original_update/boot.img

    The new working folder will be named WORKING_112412_232858
    Change the name (y/n)? (default: n):

    y <- here, and name WORKING_Hello_world


    Creating working folder WORKING_Hello_world...
    Copying boot.img ...


    Analyzing system.img.ext4 ...
    Analyzing cache.img.ext4 ...

    Compiling simg2img ...
    simg2img successfully compiled

    Converting system.img.ext4 into a format for unpacking ...

    Adding an update-script ...

    Mounting ext4_system.img to loopback device and then extracting files ...
    [sudo] password for jamison904: <- input YOUR password and enter

    ____

    Now it will ask if you want to see the details of your ROM

    Working folder information

    Android OS version : 4.1.1
    Device : d2tmo
    Model : SGH-T999
    ROM Name : JRO03L.T999UVDLJA
    Rooted (Superuser.apk + su) : NO
    Rooted (unsecured boot.img) : NO
    BusyBox installed : NO
    BusyBox run-parts support : NO
    Apps2SD (Apps to EXT) enabled : NO
    /data/app enabled : NO
    Custom boot animation allowed : NO
    Nano text editor installed : NO
    Bash shell support : NO
    /system/framework is deodexed : NO
    /system/app is deodexed : NO
    radio.img found : NO
    ROM will wipe all data : NO


    Press Enter to continue


    Now select # 2 to add Root! Then option "F"

    ROOTING
    --------------------------------------------

    The following will be done for root:

    - Add Superuser.apk and su
    - Add necessary lines to the update-script
    - Update default.prop in the ramdisk

    --------------------------------------------

    Which version of the Superuser package do you want
    to install?

    f - ChainsDD's version (Android 2.x+)
    s - Old and simple version (All Android)

    x - Cancel rooting (default)

    ?

    ok... then #3 for busy box and # 7 to change the name of your ROM

    The current name of the ROM is:

    JRO03L.T999UVDLJA


    Would you like to rename it (y/n)? (default: y): y

    Please enter the new name: Hello World!

    Hit option 8 again for the ROM INFO:

    Working folder information

    Android OS version : 4.1.1
    Device : d2tmo
    Model : SGH-T999
    ROM Name : Hello World!
    Rooted (Superuser.apk + su) : YES
    Rooted (unsecured boot.img) : YES
    BusyBox installed : YES
    BusyBox run-parts support : NO
    Apps2SD (Apps to EXT) enabled : NO
    /data/app enabled : NO
    Custom boot animation allowed : NO
    Nano text editor installed : NO
    Bash shell support : NO
    /system/framework is deodexed : NO
    /system/app is deodexed : NO
    radio.img found : NO
    ROM will wipe all data : NO


    Press Enter to continue


    Ok now "0" for advanced

    ============================================================
    Android Kitchen 0.223 - by dsixda (xda-developers.com)
    ============================================================

    > ADVANCED OPTIONS

    11 - De-odex files in your ROM
    12 - Tools for boot image (unpack/re-pack/etc.)
    13 - Add /data/app functionality
    14 - Add /etc/init.d scripts support (busybox run-parts)
    15 - Unpack data.img
    16 - Sign APK or ZIP file(s)
    17 - Convert update-script or updater-script
    18 - Plugin scripts

    99 - Build ROM from working folder
    0 - BACK TO MAIN MENU

    Enter option:

    Now select #11 to Deodex files in your ROM to make customization possible!

    The process usually takes several minutes and does NOT require
    you to sign any of the files afterwards.

    ----------------------------------------------------------------

    Found 49 *.odex files in system/framework
    Found 133 *.odex files in system/app

    Enter a choice:

    bb = Back up both folders (do first!)
    v = Set Android OS version (Current API level = 15)

    IMPORTANT: Ensure you set the correct API level

    f = Deodex /system/framework
    a = Deodex /system/app
    b = Deodex both folders (recommended)
    s = Deodex a single file
    x = Exit

    ?

    First set the compression level for the Android version you are working on, ie. 4.2.2 = 17

    Now seclect "b" for both folders


    ============================================================
    Android Kitchen 0.223 - by dsixda (xda-developers.com)
    ============================================================

    > ADVANCED OPTIONS

    11 - De-odex files in your ROM
    12 - Tools for boot image (unpack/re-pack/etc.)
    13 - Add /data/app functionality
    14 - Add /etc/init.d scripts support (busybox run-parts)
    15 - Unpack data.img
    16 - Sign APK or ZIP file(s)
    17 - Convert update-script or updater-script
    18 - Plugin scripts

    99 - Build ROM from working folder
    0 - BACK TO MAIN MENU


    Enter option:

    Now do 13 - Add /data/app functionality and 14 - Add /etc/init.d scripts support (busybox run-parts)

    ~ More advanced tweaks and other tips coming later in next post....

    Now at this point after making your tweaks and changes, you will select option # 99. After that I am normally running after my daughter so I pick option # 2 which automates the zipping, signing, and naming process



    Now very import before you flash!! Make sure you compare the blocks from my installer script and the one you have from the kitchen. Make sure that yours has this information and nothing else or you will end up with a soft brick or even a hard brick with no return!!

    Code:
    /dev/block/mmcblk0p14 - for system
    /dev/block/mmcblk0p17 - for cache
    /dev/block/mmcblk0p15 - for data
    /dev/block/mmcblk0p7 - for the boot.img (kernel)

    Code:
    ui_print(" ");
    ui_print(" ");
    ui_print(" ");
    ui_print(" ");
    ui_print(" ");
    ui_print(" ");
    ui_print(" ");
    ui_print("**************************");
    ui_print("*                        *");
    ui_print("*       INFAMOUS S3      *");
    ui_print("*           BY           *");
    ui_print("*       JAMISON904       *");
    ui_print("*                        *");
    ui_print("**************************");
    ui_print(" ");
    ui_print(" ");
    ui_print(" ");
    ui_print(" ");
    ui_print(" ");
    ui_print(" ");
    ui_print("Deleting stuff... ");
    show_progress(0.999999, 99);
    unmount("/system");
    format("ext4", "EMMC", "/dev/block/mmcblk0p14", "0");
    mount("ext4", "EMMC", "/dev/block/mmcblk0p14", "/system");
    mount("ext4", "EMMC", "/dev/block/mmcblk0p17", "/cache");
    delete_recursive("/cache");
    delete_recursive("/data/dalvik-cache");
    delete_recursive("/sdcard/.adobe");
    delete_recursive("/sdcard/.adobe-digital-editions");
    delete_recursive("/sdcard/.android_secure");
    delete_recursive("/sdcard/bugreports");
    delete_recursive("/sdcard/LOST.DIR");
    delete_recursive("/sdcard/tmp");
    mount("ext4", "EMMC", "/dev/block/mmcblk0p15", "/data");
    package_extract_dir("data", "/data");
    set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
    delete_recursive("/data/dalvik-cache");
     
    ui_print("Installing the System");
    package_extract_dir("system", "/system");
    set_perm(0, 1000, 0755, "/system/xbin/busybox");
    run_program("/system/xbin/busybox", "--install", "-s", "/system/xbin");
    symlink("/system/xbin/busybox", "/system/bin/busybox");
    ui_print("Setting Symlinks");
    symlink("toolbox", "/system/bin/df");
    symlink("toolbox", "/system/bin/dmesg");
    symlink("toolbox", "/system/bin/insmod");
    symlink("toolbox", "/system/bin/log");
    symlink("toolbox", "/system/bin/rmdir");
    symlink("toolbox", "/system/bin/schedtop");
    symlink("toolbox", "/system/bin/route");
    symlink("toolbox", "/system/bin/netstat");
    symlink("toolbox", "/system/bin/hd");
    symlink("toolbox", "/system/bin/umount");
    symlink("toolbox", "/system/bin/ifconfig");
    symlink("toolbox", "/system/bin/sleep");
    symlink("toolbox", "/system/bin/printenv");
    symlink("toolbox", "/system/bin/smd");
    symlink("toolbox", "/system/bin/sendevent");
    symlink("toolbox", "/system/bin/ionice");
    symlink("toolbox", "/system/bin/vmstat");
    symlink("toolbox", "/system/bin/stop");
    symlink("toolbox", "/system/bin/ioctl");
    symlink("toolbox", "/system/bin/iftop");
    symlink("toolbox", "/system/bin/rmmod");
    symlink("toolbox", "/system/bin/ls");
    symlink("toolbox", "/system/bin/setprop");
    symlink("toolbox", "/system/bin/top");
    symlink("toolbox", "/system/bin/mount");
    symlink("toolbox", "/system/bin/notify");
    symlink("toolbox", "/system/bin/reboot");
    symlink("toolbox", "/system/bin/cat");
    symlink("toolbox", "/system/bin/start");
    symlink("toolbox", "/system/bin/cmp");
    symlink("toolbox", "/system/bin/lsmod");
    symlink("toolbox", "/system/bin/getprop");
    symlink("toolbox", "/system/bin/wipe");
    symlink("toolbox", "/system/bin/touch");
    symlink("toolbox", "/system/bin/renice");
    symlink("toolbox", "/system/bin/kill");
    symlink("toolbox", "/system/bin/getevent");
    symlink("toolbox", "/system/bin/rm");
    symlink("toolbox", "/system/bin/nandread");
    symlink("toolbox", "/system/bin/setconsole");
    symlink("toolbox", "/system/bin/dd");
    symlink("toolbox", "/system/bin/sync");
    symlink("toolbox", "/system/bin/ps");
    symlink("toolbox", "/system/bin/id");
    symlink("mksh", "/system/bin/sh");
    symlink("toolbox", "/system/bin/md5");
    symlink("toolbox", "/system/bin/lsof");
    symlink("toolbox", "/system/bin/mkdir");
    symlink("toolbox", "/system/bin/mv");
    symlink("toolbox", "/system/bin/watchprops");
    symlink("toolbox", "/system/bin/chmod");
    symlink("toolbox", "/system/bin/uptime");
    symlink("toolbox", "/system/bin/newfs_msdos");
    symlink("toolbox", "/system/bin/chown");
    symlink("toolbox", "/system/bin/ln");
    symlink("toolbox", "/system/bin/date");
    symlink("Roboto-Regular.ttf", "/system/fonts/DroidSans.ttf");
    symlink("Roboto-Bold.ttf", "/system/fonts/DroidSans-Bold.ttf");
    ui_print("Setting Permissions");
    set_perm_recursive(0, 0, 0755, 0644, "/system");
    set_perm_recursive(0, 0, 0755, 0755, "/system/etc/init.d");
    set_perm_recursive(0, 2000, 0755, 0755, "/system/bin");
    set_perm(0, 3003, 06755, "/system/bin/ip");
    set_perm(0, 3003, 02750, "/system/bin/netcfg");
    set_perm(0, 3004, 02755, "/system/bin/ping");
    set_perm(0, 2000, 06750, "/system/bin/run-as");
    set_perm_recursive(1002, 1002, 0755, 0440, "/system/etc/bluetooth");
    set_perm(0, 0, 0755, "/system/etc/bluetooth");
    set_perm(1000, 1000, 0640, "/system/etc/bluetooth/auto_pairing.conf");
    set_perm(3002, 3002, 0444, "/system/etc/bluetooth/blacklist.conf");
    set_perm(1002, 1002, 0440, "/system/etc/dbus.conf");
    set_perm(1014, 2000, 0550, "/system/etc/dhcpcd/dhcpcd-run-hooks");
    set_perm(0, 2000, 0550, "/system/etc/init.goldfish.sh");
    set_perm_recursive(0, 0, 0755, 0555, "/system/etc/ppp");
    set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor");
    set_perm_recursive(0, 0, 0755, 0644, "/system/vendor/firmware");
    set_perm(0, 2000, 0755, "/system/vendor/firmware");
    set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");
    set_perm(0, 0, 04755, "/system/xbin/bash");
    symlink("/system/xbin/bash", "/system/bin/sh");
    set_perm(0, 0, 04755, "/system/xbin/nano");
    set_perm(0, 0, 04755, "/system/xbin/sysrw");
    set_perm(0, 0, 04755, "/system/xbin/sysro");
    set_perm(0, 0, 06755, "/system/xbin/su");
    set_perm(0, 0, 06755, "/system/bin/su");
    symlink("/system/xbin/su", "/system/bin/su");
    package_extract_dir("extra/system", "/system");
    
    ui_print("Flashing kernel");
    
    assert(package_extract_file("boot.img", "/tmp/boot.img"),
           write_raw_image("/tmp/boot.img", "/dev/block/mmcblk0p7"),
           delete("/tmp/boot.img"));
    
    ui_print("");
    run_program("/sbin/busybox", "cp", "/tmp/recovery.log", "/sdcard/Infamous_recovery.log");
    ui_print("Finishing");
    unmount("/system");
    show_progress(0.000000, 0);
    ui_print(" ");
    ui_print(" ");
    ui_print("Done. Enjoy! ~ Jamison904");



    14
    Apktool how to for Linux:


    http://xdaforums.com/showthread.php?t=1755243 First go here to iBotPeaches's Apktool thread.

    Sidenote: check out the change log here and apply where needed. http://code.google.com/p/android-apktool/wiki/Changelog


    - Now download the apktool here: http://android-apktool.googlecode.com/files/apktool1.5.1.tar.bz2

    - Then go here and download the needed package for the OS you are running (Linux) http://code.google.com/p/android-apktool/downloads/list

    Now extra both zip's to your desktop.

    - Now open the terminal and navigate to the desktop. (or go to Ubuntu software center and search "right click terminal" and download it.

    - No that you are in desktop in the terminal you need to give each of the three files root access.

    - to do this you will need to chown -R and type the location of the file.:

    Code:
    chown -R

    - The quickest and easiest way to type "chown -R " then the location (jamison904:jamison904) then drag and drop the file into the terminal. So it will look like this (also it will prompt you for your password.)

    example:

    Code:
    jamison904@lapy:~/Desktop$ chown -R jamison904:jamison904 '/home/jamison904/Desktop/aapt' 
    jamison904@lapy:~/Desktop$ chown -R jamison904:jamison904 '/home/jamison904/Desktop/apktool' 
    jamison904@lapy:~/Desktop$ chown -R jamison904:jamison904 '/home/jamison904/Desktop/apktool.jar'

    jamison904:jamison904 = your user name.

    If this doesn't work for the verision of Linux you are on you should try this as well:

    Code:
    jamison904@lapy:~/Desktop$ chown -R  '/home/jamison904/Desktop/aapt' 
    jamison904@lapy:~/Desktop$ chown -R  '/home/jamison904/Desktop/apktool' 
    jamison904@lapy:~/Desktop$ chown -R  '/home/jamison904/Desktop/apktool.jar'

    - Now we have to make each executable by sudo chmod +x

    Code:
    sudo chmod +x

    It will look like this:

    Code:
    jamison904@lapy:~/Desktop$ sudo chmod +x '/home/jamison904/Desktop/aapt' 
    
    [sudo] password for jamison904: 
    
    jamison904@lapy:~/Desktop$ sudo chmod +x '/home/jamison904/Desktop/apktool' 
    
    jamison904@lapy:~/Desktop$ sudo chmod +x '/home/jamison904/Desktop/apktool.jar'

    Now to be sure right click each one and click properties then click the Permissions tab and make sure "allow executing file as program" is clicked.


    - Last we have to move all three to Usr/local/bin. BUT you have to be running as root to do this...

    - So to do this you will need to press Alt + F2 and type: gksu nautilus

    - Now navigte to Usr/local/bin and drag and drop all three here. Now close that window.

    Done with the setup. Now a quick how to use it


    How to use:

    - Open the terminal in the same folder as the apps you want to mod. I normally take the app an the frameworks and place them in a folder on the desktop. I name it whatever the project is. i.e. "Toggles mod"

    - now you will need add the framerork-res.apk and the twframework-res.apk to the apktool.

    Code:
    apktool if framework-res.apk   <- enter, then
    apktool if twframework-res.apk  <- enter

    Now you need to decompile the apk you are working on, lets say the SystemUI.apk

    Code:
    apktool d SystemUI.apk   <- enter

    At this point you will make your modifications. . . . then you will need to recompile the apk.

    Code:
    apktool b SystemUI   <- enter

    Now if all goes well you will have a new modded apk. One more step and you're done.


    - Last you will need to open the archive of both the orignal apk and your new modded apk.

    - Grab the META-INF folder and the original AndroidManifest.xml from the original apk and drag and drop both into your new modded apk then close the archive.

    - I have attached a test zip for you to use. Just place the apk or jar where it goes. ie...SystemUI.apk goes into system/app and framework-res.apk goes into system/framework. Just double click the zip and go to the folder the apk or jar goes to and drag and drop it in then just close the archive. No signing needed this way. :cool:





    Manually decompile and recompile smali, jar's and even apks' how to for Linux:


    First off, huge shout out and thanks to Jesusfreke!!! Without him none of this would be possible.


    First head over to download section and download
    Code:
    baksmali-1.4.2.jar
    smali-1.4.2.jar

    then rename them to
    Code:
    baksmali.jar
    smali.jar

    Now make a new folder. I named mine smali. Place both into the new folder.




    Next go to Ubuntu software center and download 7zip.

    Lets use the android.policy.jar as an example for this part of the guide.

    Take the android.policy.jar and place it into the new folder (smali)

    double click on the android.policy.jar to open the archive. Then click on the class.dex and drag it and drop into the folder (smali)



    Now for the fun part.

    Right click and open terminal here inside the folder. (If you haven't got it yet please do. Go to Ubuntu software center and download right click terminal.)

    Now you type this or copy and paste:
    Code:
    java -jar baksmali.jar -o classout/ classes.dex

    this will decompile the class.dex to a folder named class. Make your changes then continue.



    Now to recompile you will type or copy and paste:
    Code:
    java -Xmx512M -jar smali.jar classout/ -o new-classes.dex

    This will give you the output of new-classes.dex. If you get any errors or don't get a "new-classes.dex" then you had an error. Copy what the terminal says and paste it here and I will help you figure it out. If it is long please paste it over at pastebin.com and post a link here. Trying to keep it clean in here. Thanks!


    You will want to copy the android.policy.jar and the new-classes.dex to a new folder inside the folder you have been working. I name this folder Test1. This way you don't overwrite the stock ones. Plus makes it easiser to keep track of what worked and what did not.


    Now all you need to to is double click on the android.policy.jar to open the archive again. Now since you are in the Test1 folder rename new-classes.dex to
    classes.dex. Last just drag classes.dex to the archive and drop it. It will add the new classes.dex to the archive. Once it is done close the archive and test to see if your chages worked.

    I have attached a test zip for you to use. Just place the apk or jar where it goes. ie...SystemUI.apk goes into system/app and framework-res.apk goes into system/framework. Just double click the zip and go to the folder the apk or jar goes to and drag and drop it in then just close the archive. No signing needed this way. :cool:
    13
    How to compile a kernel for d2tmo (T-mobile S3)




    First off let me start with saying this, half assing a kernel or not following all the steps exactly will brick your device!. You have been warned. I personally was every hesitant to even try to make my own kernels because of the brick factor. After researching for weeks and reading like crazy I felt like I had enough knowledge to attempt to build my own kernel. After talking with my buddy TDJ he told me that when it comes to kernels you just have to get learn by hands on. Of course he was right. So be careful and if something doesn't seem right,do not flash it. Also the kernel_test.zip attached is for TMO/ATT S3. I haven't checked to see if the boot block is the same for all of the US S3's. I'll check and update this. Until then only use for TMO/ATT S3.

    Code:
    #include 
    /*
    * Your warranty is now void.
    *
    * I am not responsible for bricked devices, dead SD cards,
    * thermonuclear war, or you getting fired because the alarm app failed. Please
    * do some research if you have any concerns about features included in this ROM
    * before flashing it! YOU are choosing to make these modifications, and if
    * you point the finger at me for messing up your device, I will laugh at you.
    */
    
    [COLOR="Red"]By using this how to you agree with the above terms![/COLOR]

    Now with that out of the way lets have some fun! This how to is for the T999 TW kernel. This guide will work for all S3 devices with minimal changes. Also the basics here will work for all devices. Also at this point the guide is only build a stock kernel without changes. That will come in another update. I will need to show you git and how to use it before you can make changes. Also if you make and changes and you share the kernel with others you have to post your source!! So you will need to know how to use github or bithub. These too will come later.



    First you will need to download the source for the kernel. You will need to go to http://opensource.samsung.com/ and find the source for your device. Search for t999 and grab the one named SGH-T999_JB_TMB_Opensource.zip. Or you can grab it from my Goo account here. . . . .


    Now you need to extract the zip. Then extract Kernel.tar.gz. Now make a folder in your home directory if you have not already called android. Then inside android make another director called kernel. Last make a folder for you kernel, you can name it whatever. For this how to lets just call it T999_TW_kernel. Now move everything from the extracted Kernel.tar.gz to this folder. This is your kernel working folder.


    Next you will need to choose the toolchain you plan on using. There are many great ones out there. Just Google "kernel tool chain" to see the many different ones. The Android NDK comes with a bunch and most are 100% stable. Since I also suport AOKP for many devices, I just use the one they use. I have uploaded it to my github for you guys to download and use. Go to https://github.com/jamison904/arm-eabi-4.6 and click on zip to download it.

    toolchain_download_zps0a5b5d34.png



    Now you will need to set your path and set the cross compile in your make file inside your kernel working folder.

    toolchain_path_zps02b13b60.png


    We are going to setup your toolchain path now. Extract the downloaded toolchain from my github and make a folder inside the android folder called toolchain. Now move the extracted tool chain here. Open up the make file in the kernel folder and set your path like below. (of course change Jamison904 to whatever yours is named.) save and close.

    Code:
    ARCH		?= arm
    CROSS_COMPILE  = /home/jamison904/android/toolchain/arm-eabi-4.6/bin/arm-eabi-


    your_kernel_path_zpsba07a510.png




    Name your kernel! Open the make folder and make the change then save and close.

    name_kernel_zps5610da70.png




    Now open terminal here inside the kernel build folder. You need set it up. You need to:

    Code:
    make clean && make mrproper





    Ok time to pull the defconfig from your phone (This is for a TW Kernel so you need to be running a TW ROM. You also will need to be running a stock kernel for this to work right...) You will need to connect your phone to your computer with adb debugging turned on. Then open the terminal from your desktop and:

    Code:
    adb pull /proc/config.gz

    then

    Code:
    gunzip config.gz

    This will give you a file called config. You will want to rename this file to t999_defconfig. After that you will need to move this file to /home/jamison904 (your user name)/android/kernel/T999_TW_kernel/arch/arm/configs. Drop it here.




    Now it is time to attempt to build. You will need to do:

    Code:
    make xconfig

    This will bring up a nice user friendly UI to help you set up the build.



    xconfig1_zpsb0e66db4.png



    xconfig2_zps337faad7.png




    Now you need to click on the folder. Navigate to arch/arm/config and click on your T999_defconfig.
    xconfig3_zpscb3c6a48.png




    This shows you where to find the schedulers. You can change the default scheduler here. Also can turn them on and off, as well if you want to build them in or make them build as a module.
    xconfig4_zpsb9451799.png




    This shows you where to find the governors. You can change the default governor here. Also can turn them on and off, as well if you want to build them in or make them build as a module.
    xconfig5_zps1827e8ef.png





    Now lets see if you set it up correctly.... lol. You will do:

    Code:
    make

    build_zpsa3526892.png

    Later after you know that it will build you can seed it up by doing make -j5. This will make with 5 jobs at once. This is way faster but very hard to trouble shoot and find your errors. If it stops without finishing you will need to make clean && make mrproper then do the xconfig again and save and close then "make" .... This will only make with one job at a time thus you have an error and it will stop and you will be able to read the error. Copy and paste to pastebin.com and post the link here and I will help you figure it out. :cool:





    If you get this, congratulations you have made your first kernel... time to package it up and test.


    Kernel_done_zpsb1783124.png










    Finding the zimage (kernel itself.) Navigate to arch/arm/boot and grab the zimage.

    Find_zimage1_zps089773ec.png



    find_zimage2_zpsd73bde0e.png



    find_zimage3_zpse39c6f45.png



    find_zimage4_zpse8d810bf.png




    Now to find the modules. Do a ctrl f in the root of your kernel build folder and screach for .ko. Make sure to include the . before ko. Then copy and paste these into a folder to hold them for the zip.


    find_modules_zpsae12a7fc.png



    find_modules2_zpsef12e054.png




    Now you need to unpackage a boot.img and replace the zimage then repackage it up. The easiest way to do this is with the Android kitchen. Takes less then a minute. If you have been following my guides here you will already have it setup and have working knowledge of the kitchen. If not, stop here and go catch up, i'll wait....;) Ok moving on.





    I made a folder called WORKING_Kernel to keep these away from real working folders just in case I forget. Don't need to update my S2 ROM with a S3 kernel. Anyways...

    bootimage1_zps33b0bb5d.png



    Place a stock boot.img into the folder
    bootimage2_zpsfaab82c8.png



    Now start up the kitchen and press 0. Then option 12 for boot.img.
    bootimage3_zpsf59ce127.png



    Then press w. This will unpack the boot.img.
    bootimage4_zps2e4dd41d.png



    bootimage5_zps60231c36.png



    The end result will be a folder called "BOOT-EXTRACTED"
    bootimage6_zps9c45fb06.png




    Open it and you will see the ram-disk and the Zimage (kernel). Delete the Zimage here!
    bootimage7_zps7f68d1d4.png



    Grab your new Zimage and copy and paste it in to the "boot-extracted"
    bootimage8_zpsd5b50db7.png



    bootimage9_zps9243b450.png




    Now to repackage it. Back over in the Kitchen press "b" to build
    bootimage10_zps2f87951e.png



    bootimage11_zpsb87bf7b3.png



    Your new kernel is in the boot.img
    bootimage12_zpse7cdcbe6.png






    Now to flash the kernel. I have made you guys an empty flashable zip attached below. This way no one breaks their device trying to flash their kernel. If you do brick you didn't read the directions as this zip is dummy proof so to speak. ;)



    Now double click on the kernel_test.zip and drag and drop your new boot.img into the archive.

    zip1_zpsd7c7021c.png



    zip2_zps75f21a05.png




    Now navigate to system/lib/modules and press Ctrl A to select all of the modules then drag and drop these here.
    zip4_zps2e2b739c.png


    zip5_zpsb54c4863.png


    zip6_zps4875672a.png






    Done. Copy and paste the zip to your SDcard and reboot into recovery and pry.... lol. You will be good if you followed the directions. Enjoy your own build stock TW kernel! Again remember not to public share your kernel unless you have uploaded "your exact source" and can provide a public link to it. You have been warned! Next updates will include how to work git, commits, and github as well as some more advanced kernel tweaks and code. Also how Cherry-pick :cool:
    done_zpsacfb0b02.png



    For more advanced kernel work you will need meld to work conflicts. Open terminal and:

    Code:
    sudo apt-get install meld

    Now when you get a conflict from cherry picking you will do

    Code:
    git status

    this will show you the conflicting files. Then to work them you will need to

    Code:
    git mergetool

    For more info on how to use it go to http://meldmerge.org/ ... have fun!