Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,736,395 Members 48,180 Now Online
XDA Developers Android and Mobile Development Forum
View Poll Results: Is this thread useful and want it to be sticky?
Yes. Its very useful. Want it to be sticky thread. 332 95.13%
No. Its not useful and no need to be sticky. 17 4.87%
Voters: 349. You may not vote on this poll

[HOW-TO][TUTORIAL]ROOT, DEODEX, BUILD KERNEL, BUILD CUSTOM ROM and MORE

Tip us?
 
superatmos
Old
(Last edited by superatmos; 13th July 2012 at 11:08 AM.)
#1  
Retired Recognized Developer - OP
Thanks Meter 1202
Posts: 493
Join Date: Mar 2011
Location: Bangalore
Tutorial [HOW-TO][TUTORIAL]ROOT, DEODEX, BUILD KERNEL, BUILD CUSTOM ROM and MORE

Hi all,

In this thread, I will try to share the knowledge I have on deodexing, making custom ROMs, modifying initramfs, building kernel and much more.

Please check the below posts for each of these tutorials.

Hope this opens doors to many new ROM and Kernel developers.

NOTE: THESE TUTORIALS ARE WRITTEN FOR I9100G. WILL NOT WORK ON OTHER DEVICES. I DON'T TAKE ANY RESPONSIBILITY IF YOU MESS UP AND BRICK YOUR DEVICE OR ANYTHING ELSE. USE AT YOUR OWN RISK.
My ROM: SuperROM for GT-I9100G , SuperROM for GSM Galaxy Nexus
My Kernels for Samsung Galaxy S II GT-I9100G: Gingerbread, ICS
Tutorial for Deodexing, Building Kernel and Making Custom ROM for Galaxy S2 GT-I9100G, Galaxy S2 GT-I9100 and Galaxy Note GT-N7000
My tutorial published in XDA News Portal
The Following 56 Users Say Thank You to superatmos For This Useful Post: [ Click to Expand ]
 
superatmos
Old
(Last edited by superatmos; 28th September 2012 at 06:46 AM.)
#2  
Retired Recognized Developer - OP
Thanks Meter 1202
Posts: 493
Join Date: Mar 2011
Location: Bangalore
Arrow Deodexing Stock Rom

For GINGERBREAD ROMS:

What you need to have:
  • xUltimate v2.3.3 - you can download it HERE (Thanks and Credits to Xeudoxus for this awesome app)
  • Rooted kernel with busybox
  • JDK installed on your Windows system
  • If adb is not available in your windows PC, in xUltimate folder open "jar" folder. You'll find adb there.
Extract stock app & framework folders and Deodex:
  • Connect your device to computer.
  • Start xUltimate (double-click on Main.exe)
  • Select option 1. (Pull /system/app)
  • Once option is done, select option 2. (Pull /system/framework)
  • In the same folder, now you'll see two new folders (origi_app, origi_frame)
  • For I9100G, go to origi_app folder and delete apk and odex files of Maps, PhoneSky and VoiceSearch.
  • Select option 3 in Main menu (Deodex /system/app)
  • Once its done, select option 4 in Main menu (Deodex /system/framework)
  • DONE!!
Now you'll see two new folders done_app and done_frame.

Push deodexed app and framework to device:
  • Connect your device to PC in USB debugging mode.
  • Copy done_app and done_frame folders to root of sdcard (/sdcard).
  • Open Windows command prompt and type the below commands.

Code:
  • adb shell
  • su
  • stop
  • mount -o remount,rw /dev/block/mmcblk0p9 /system
  • rm /system/app/*.odex
  • rm /system/framework/*.odex
  • busybox cp /sdcard/done_app/* /system/app/
  • busybox cp /sdcard/done_frame/* /system/framework/
  • chmod 644 /system/app/*
  • chmod 644 /system/framework/*
  • mount -o remount,ro /dev/block/mmcblk0p9 /system
  • sync
  • reboot recovery
In Recovery, Wipe Cache and Wipe Data/Factory reset.
Reboot.

Now you've deodexed app and framework.

For ICS ROMS:

For ICS Roms, the process is quite easy. (Thanks and Credits to jaydvn.)



  • Download the attached zip file.
  • Extract it on your windows PC.
  • Copy your /system/app to _app folder
  • Copy your /system/framework to _framework folder.
  • Run AutoDEOToolMain.bat
  • Follow the instructions.
  • deodexed jars and apks will be found in deodexed_APK and deodexed_JAR.
Push deodexed app and framework to device:
  • Connect your device to PC in USB debugging mode.
  • Copy deodexed_APK and deodexed_JAR folders to root of sdcard (/sdcard).
  • Open Windows command prompt and type the below commands.

Code:
  • adb shell
  • su
  • stop
  • mount -o remount,rw /dev/block/mmcblk0p9 /system
  • rm /system/app/*.odex
  • rm /system/framework/*.odex
  • busybox cp /sdcard/deodexed_APK/* /system/app/
  • busybox cp /sdcard/deodexed_JAR/* /system/framework/
  • chmod 644 /system/app/*
  • chmod 644 /system/framework/*
  • mount -o remount,ro /dev/block/mmcblk0p9 /system
  • sync
  • reboot recovery

In Recovery, Wipe Cache and Wipe Data/Factory reset.
Reboot.

Done.

Other references:

How to deodex ICS roms by samyam2002000

Enjoy.
Attached Files
File Type: zip DeodexTool_AutoDEOTool_JDmod.zip - [Click for QR Code] (7.18 MB, 3000 views)
My ROM: SuperROM for GT-I9100G , SuperROM for GSM Galaxy Nexus
My Kernels for Samsung Galaxy S II GT-I9100G: Gingerbread, ICS
Tutorial for Deodexing, Building Kernel and Making Custom ROM for Galaxy S2 GT-I9100G, Galaxy S2 GT-I9100 and Galaxy Note GT-N7000
My tutorial published in XDA News Portal
The Following 31 Users Say Thank You to superatmos For This Useful Post: [ Click to Expand ]
 
superatmos
Old
(Last edited by superatmos; 18th August 2012 at 07:07 AM.)
#3  
Retired Recognized Developer - OP
Thanks Meter 1202
Posts: 493
Join Date: Mar 2011
Location: Bangalore
Arrow Building Kernel

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

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

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

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

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

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

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

Setting up initramfs:

Samsung's zImage is divided into two parts: Opensource kernel (which you downloaded from samsung's website) and initramfs (which is root file system to boot up the device).
  • I am providing my initramfs HERE. (You can use it as it is or modify it. But give credits to me. )
  • Extract the downloaded zip and copy it to /home/<your_name>/build_kernel/

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

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

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

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

Modifying kernel configuration:

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

Do the below things:

Adding local version:

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

CONFIG_LOCALVERSION="-I9100G-superatmos"

Adding initramfs path:

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

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

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

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

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

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

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


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

Other references:

Building Kernel by bedalus

How to compile your first Nexus Kernel by djjonastybe

Give me your feedback so that I can improve this tutorial. And post here about how your build went. All the best.
My ROM: SuperROM for GT-I9100G , SuperROM for GSM Galaxy Nexus
My Kernels for Samsung Galaxy S II GT-I9100G: Gingerbread, ICS
Tutorial for Deodexing, Building Kernel and Making Custom ROM for Galaxy S2 GT-I9100G, Galaxy S2 GT-I9100 and Galaxy Note GT-N7000
My tutorial published in XDA News Portal
The Following 33 Users Say Thank You to superatmos For This Useful Post: [ Click to Expand ]
 
superatmos
Old
(Last edited by superatmos; 21st November 2012 at 07:20 AM.)
#4  
Retired Recognized Developer - OP
Thanks Meter 1202
Posts: 493
Join Date: Mar 2011
Location: Bangalore
Arrow Making custom ROM

Let's move on to make a custom ROM.

Inputs/Feedback/Suggestions are more than welcome. Lets improve this tutorial together for the betterment of the android community.

Steps involved in making a custom ROM:
  • Getting the system dump from the device.
  • Deodexing app and framework folders.
  • Creating various mods by modifying framework and system files.
  • Modifying build.prop and adding tweaks.
  • Making META-INF folder and writing an updater-script (edify scripting).
  • Signing the ROM and making a flashable zip.
Folder Structure:
Before going forward, let's follow the below structure folder to make the tutorial more understandable.

Let our ROM name be CustomROM. The folder structure will be C:\Users\<your name>\CustomROM.

Let's move step by step. Are you ready??


<b>
Getting the system dump from the device:


</b>
  • Make sure USB debugging is ON and connect your device to the PC.
  • Open command prompt on your windows PC and go to CustomROM folder path.
  • Type adb devices. You should be able to see the device detected. (If not check environmental variables whether adb is in system path or not. If not present, add the adb path.)
  • Type the below command to get the dump of system folder.
Code:
adb pull /system system/
Now inside the folder CustomROM, you should be able to see system folder with many folders like app, etc, framework etc inside.

Done with first step.


<b>
Deodexing app and framework folders:


</b>

Look HERE how to deodex app and framework folders. Copy the app and framework folders to xUltimate folder, rename them to origi_app and origi_frame and follow the given link to deodex.

NOTE: After deodexing, merge origi_app folder with app folder under C:\Users\<your name>\CustomROM\system\app and origi_frame with framework folder under C:\Users\<your name>\CustomROM\system\framework.


<b>
Creating various mods by modifying framework and system files


</b>

Okay. This the section where your hardwork, innovation and talent comes in. You can use the mods available already, create your own mods, port various mods from other devices and so on.

Below is a list of various mods which can be ported on to I9100G. All the credits go these respective thread owners. Thanks to them.
NOTE: Let me know more mods with links so that I can add here.


<b>
Modifying build.prop and adding tweaks


</b>

Okay. This is one of those files where you name your ROM(to be visible in settings. ) and add many tweaks.

To name your ROM (to be visible in settings), change the below code.

Code:
ro.build.display.id=CustomROM v1.0
Check the below links for many other tweaks. All credits go to respective thread owners. Thanks to them.
<b>
Making META-INF folder and writing an updater-script (edify scripting)


</b>

Once you're done with all the modifications, mods and additions, its time to create META-INF folder and make the updater script. Once the user flashes the ROM zip, this is the script that runs and does everything written inside the script. PLEASE BE CAREFUL WITH THIS. TAKE REFERENCE FROM OTHER (SAME DEVICE) ROMS' UPDATER-SCRIPT. (In this case, take reference from other GT-I9100G roms.)

Check the below links for tutorial and how-to on writing edify script and making updater script. All credits go to respective owners of the threads. Thanks to them.

Edify Scripting, Making Flashable ZIPs, ZIP Signing & Key Creation
Edify Scripting Notes
How to Write an Updater-Script with Edify Code
Edify Installation Script Syntax's

NOTE: system folders path, boot/kernel partition path, modem partition path and so on are COMPLETELY DIFFERENT for DIFFERENT DEVICES. Check the partitions for your device properly, carefully and then work on updater-script. TAKE HELP OR REFERENCE FROM OTHER ROM DEVELOPERS FOR YOUR DEVICE.

Lets move on to last step. Making a signing and making a flashable zip.


<b>
Signing the ROM and making a flashable zip


</b>

Make sure, now you should be able to find two folders (META-INF and system) inside C:\Users\<your name>\CustomROM.

Check in THIS thread for test signing your ROM. It WORKS with GT-I9100G. TESTED.

or Check THIS thread to create your own signing key and certificate.


Now you're done with making a custom ROM. Hope to see more custom ROMs from many users.

For porting ROMs, refer THIS tutorial. (thanks and credits to ayushrox)

Give me your feedback so that I can improve this tutorial. And post here about how your custom ROM making went. All the best.
My ROM: SuperROM for GT-I9100G , SuperROM for GSM Galaxy Nexus
My Kernels for Samsung Galaxy S II GT-I9100G: Gingerbread, ICS
Tutorial for Deodexing, Building Kernel and Making Custom ROM for Galaxy S2 GT-I9100G, Galaxy S2 GT-I9100 and Galaxy Note GT-N7000
My tutorial published in XDA News Portal
The Following 24 Users Say Thank You to superatmos For This Useful Post: [ Click to Expand ]
 
superatmos
Old
(Last edited by superatmos; 12th February 2013 at 07:06 AM.)
#5  
Retired Recognized Developer - OP
Thanks Meter 1202
Posts: 493
Join Date: Mar 2011
Location: Bangalore
Plug Root and busybox

If you don't want to modify anything else except to have root and busybox for the stock rom, Check the below link.

How to ROOT/UNROOT your I9100G via Stock Recovery (Credits: Ryuinferno)
My ROM: SuperROM for GT-I9100G , SuperROM for GSM Galaxy Nexus
My Kernels for Samsung Galaxy S II GT-I9100G: Gingerbread, ICS
Tutorial for Deodexing, Building Kernel and Making Custom ROM for Galaxy S2 GT-I9100G, Galaxy S2 GT-I9100 and Galaxy Note GT-N7000
My tutorial published in XDA News Portal
The Following 6 Users Say Thank You to superatmos For This Useful Post: [ Click to Expand ]
 
nitinvaid
Old
#6  
nitinvaid's Avatar
Recognized Themer
Thanks Meter 4086
Posts: 4,204
Join Date: Mar 2011
Location: New Delhi

 
DONATE TO ME
GOt error wHILE DEODEXING USING XULTIMATE

galaxy sl STOCK ROMS ARE MUCH BETTER THAN g

Starting Email.odex
*****************************************
* Deodexing... *


Error occured while loading boot class path files. Aborting.
org.jf.dexlib.Code.Analysis.ClassPath$ClassNotFoun dException: Could not find sup
erclass Ljava/awt/Component;
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.loa dSuperclass(ClassPa
th.java:784)
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.<in it>(ClassPath.java:
668)
at org.jf.dexlib.Code.Analysis.ClassPath.loadClassDef (ClassPath.java:280
)
at org.jf.dexlib.Code.Analysis.ClassPath.initClassPat h(ClassPath.java:16
3)
at org.jf.dexlib.Code.Analysis.ClassPath.InitializeCl assPath(ClassPath.j
ava:131)
at org.jf.baksmali.baksmali.disassembleDexFile(baksma li.java:105)
at org.jf.baksmali.main.main(main.java:278)
Error while loading class Lgnu/activation/viewers/ImageViewer; from file .\origi
_app\Email.odex
Error while loading ClassPath class Lgnu/activation/viewers/ImageViewer;

Press any key to continue . . .

Current Device: Google Nexus 5
Secondary : Galaxy S4 GT-I9500
 
superatmos
Old
#7  
Retired Recognized Developer - OP
Thanks Meter 1202
Posts: 493
Join Date: Mar 2011
Location: Bangalore
Quote:
Originally Posted by tarunagg View Post
GOt error wHILE DEODEXING USING XULTIMATE

galaxy sl STOCK ROMS ARE MUCH BETTER THAN g

Starting Email.odex
*****************************************
* Deodexing... *


Error occured while loading boot class path files. Aborting.
org.jf.dexlib.Code.Analysis.ClassPath$ClassNotFoun dException: Could not find sup
erclass Ljava/awt/Component;
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.loa dSuperclass(ClassPa
th.java:784)
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.<in it>(ClassPath.java:
668)
at org.jf.dexlib.Code.Analysis.ClassPath.loadClassDef (ClassPath.java:280
)
at org.jf.dexlib.Code.Analysis.ClassPath.initClassPat h(ClassPath.java:16
3)
at org.jf.dexlib.Code.Analysis.ClassPath.InitializeCl assPath(ClassPath.j
ava:131)
at org.jf.baksmali.baksmali.disassembleDexFile(baksma li.java:105)
at org.jf.baksmali.main.main(main.java:278)
Error while loading class Lgnu/activation/viewers/ImageViewer; from file .\origi
_app\Email.odex
Error while loading ClassPath class Lgnu/activation/viewers/ImageViewer;

Press any key to continue . . .
Which version of xUltimate you're using? only x2.3.3 supports GT-I9100G. Please follow the steps I mentioned above and you should be able to deodex.
My ROM: SuperROM for GT-I9100G , SuperROM for GSM Galaxy Nexus
My Kernels for Samsung Galaxy S II GT-I9100G: Gingerbread, ICS
Tutorial for Deodexing, Building Kernel and Making Custom ROM for Galaxy S2 GT-I9100G, Galaxy S2 GT-I9100 and Galaxy Note GT-N7000
My tutorial published in XDA News Portal
The Following 2 Users Say Thank You to superatmos For This Useful Post: [ Click to Expand ]
 
nitinvaid
Old
#8  
nitinvaid's Avatar
Recognized Themer
Thanks Meter 4086
Posts: 4,204
Join Date: Mar 2011
Location: New Delhi

 
DONATE TO ME
ok will try that version also
Quote:
Originally Posted by superatmos View Post
Which version of xUltimate you're using? only x2.3.3 supports GT-I9100G. Please follow the steps I mentioned above and you should be able to deodex.


Sent from my GT-I9100G using XDA App

Current Device: Google Nexus 5
Secondary : Galaxy S4 GT-I9500
zylor Old
#9  
Guest
Thanks Meter
Posts: n/a
Does this script work for ICS odexed apk's?
 
superatmos
Old
#10  
Retired Recognized Developer - OP
Thanks Meter 1202
Posts: 493
Join Date: Mar 2011
Location: Bangalore
Quote:
Originally Posted by zylor View Post
Does this script work for ICS odexed apk's?
I am not sure about it since I never tested myself on ICS since its not yet released for I9100G.
My ROM: SuperROM for GT-I9100G , SuperROM for GSM Galaxy Nexus
My Kernels for Samsung Galaxy S II GT-I9100G: Gingerbread, ICS
Tutorial for Deodexing, Building Kernel and Making Custom ROM for Galaxy S2 GT-I9100G, Galaxy S2 GT-I9100 and Galaxy Note GT-N7000
My tutorial published in XDA News Portal

The Following 2 Users Say Thank You to superatmos For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes