• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

How to Odex-Deodex, Build Kernel, & Build roms

Jaay Dogg

Android Expert
Aug 27, 2011
758
207
45
Prescott, Az
www.paypal.com
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
DeodexTool_AutoDEOTool_JDmod.zip - [Click for QR Code] (7.18 MB, 604 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
REPLY
The Following 21 Users Say Thank You to superatmos For This Useful Post: [ Click to Expand ]

superatmos 7th April 2012, 08:35 PM (Last edited by superatmos; 18th August 2012 at 08:07 AM.) #3
Recognized Contributor / Recognized Developer - OP
Thanks Meter 1139

Posts: 492
Join Date: Mar 2011
Location: Bangalore
MORE INFO >

DONATE TO ME
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
REPLY
The Following 26 Users Say Thank You to superatmos For This Useful Post: [ Click to Expand ]

superatmos 7th April 2012, 08:35 PM (Last edited by superatmos; 21st November 2012 at 08:20 AM.) #4
Recognized Contributor / Recognized Developer - OP
Thanks Meter 1139

Posts: 492
Join Date: Mar 2011
Location: Bangalore
MORE INFO >

DONATE TO ME
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??



Getting the system dump from the device:



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.



Deodexing app and framework folders:




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.



Creating various mods by modifying framework and system files




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.
Lidroid 14 toggle mod
Extended power menu with/without header
CRT Off Animation & SIP Over LTE/HSPA
Swipe to remove notifications
NOTE: Let me know more mods with links so that I can add here.


Modifying build.prop and adding tweaks



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.
build.prop tweaks by TheFrankenstain
build.prop tweaks by dhlalit11

Making META-INF folder and writing an updater-script (edify scripting)




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.



Signing the ROM and making a flashable zip




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

Original Link: http://forum.xda-developers.com/showthread.php?t=1587482
 
  • Like
Reactions: Suprtigr

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones