How do I start developing android ROMs? - Android Software/Hacking General [Developers Only]

Is there a tutorial?
First of all... Deodexing and zipaligning is something I want to be able to do myself...
I followed these commands:
http://forum.xda-developers.com/showthread.php?t=765270
With some slight edits being yaffs2 as the filesystem for S5660 for example...
But after editing my ROM has forcecloses all the way... Can someone help me with this?
Second... How do I export my ROM to a flashable file for use in odin
Third my inspiration!
So I have to know these things:
- deodexing and zipaligning properly
- how do I export image for use in ODIN.
- What software do and will I need?

Related

building deodexed firmware for theming

Hi, i am interested to build a deodexed firmware for the G3 so we have a base for theming. for this i used xultimate to deodex the files which went well without problems. but when i try to cp the files to system it starts to thow error messages that there is no more space left. after this the system was frozen and did not reboot anymore. so i guess i have to mount the factoryfs.rfs file from the firmware i use (xxjk1 for now) to do everything in there. since i am to very used to linux console i have no idea how to do this, but i know some people (gsam101 and precurse) use this method to build their own firmwares, so maybe one of them can help me here.
for people interested i include the deodexed files here also: http://archiv.to/GET/FILE2C25F1FCDED48
FadeFx said:
Hi, i am interested to build a deodexed firmware for the G3 so we have a base for theming. for this i used xultimate to deodex the files which went well without problems. but when i try to cp the files to system it starts to thow error messages that there is no more space left. after this the system was frozen and did not reboot anymore. so i guess i have to mount the factoryfs.rfs file from the firmware i use (xxjk1 for now) to do everything in there. since i am to very used to linux console i have no idea how to do this, but i know some people (gsam101 and precurse) use this method to build their own firmwares, so maybe one of them can help me here.
for people interested i include the deodexed files here also: http://archiv.to/GET/FILE2C25F1FCDED48
Click to expand...
Click to collapse
You can do this:
1. rm /system/app/*.odex
2. cp /sdcard/done_app/* /system/app/
3. cp /sdcard/done_frame/* /system/framework/
4. rm /system/framework/*.odex
It's succeeded for me.
ah, ok... so you got a deodexd rom already?
FadeFx said:
ah, ok... so you got a deodexd rom already?
Click to expand...
Click to collapse
yes, but i can't mod the framework (for example: battery mod)
did you try metamorph or ninjamorph?
FadeFx said:
did you try metamorph or ninjamorph?
Click to expand...
Click to collapse
none of them
i tried the uot kitchen
can i do battery indicator in statusbar with meta or ninja morph?
Metamorph can exchange images inside the apk, not sure what ninjamorph can do more. If you need to do something else for the battery mod you'd still have to do it manually
FadeFx said:
Hi, i am interested to build a deodexed firmware for the G3 so we have a base for theming. for this i used xultimate to deodex the files which went well without problems. but when i try to cp the files to system it starts to thow error messages that there is no more space left. after this the system was frozen and did not reboot anymore. so i guess i have to mount the factoryfs.rfs file from the firmware i use (xxjk1 for now) to do everything in there. since i am to very used to linux console i have no idea how to do this, but i know some people (gsam101 and precurse) use this method to build their own firmwares, so maybe one of them can help me here.
for people interested i include the deodexed files here also: http://archiv.to/GET/FILE2C25F1FCDED48
Click to expand...
Click to collapse
Hi - I see in your signature that you have JPY @ Galaxy S.
Please which JP? had becomed the official 2.2 for Galaxy S. ?
Because now we have JPF and it looks like the versions and its issues are the same @ galaxy 3. thx
I don't think that the problems are related to the problems on sgs since the hardware is completely different. The first official froyo for the sgs was jp6 i think, but i am not entirely sure since first time i used kies to update was jpy and i did it using the registry hack.
try to use apktools to decode resources,
i have test 1.31 and Issue 100 ver is work decode
1.32 is not work
http://code.google.com/p/android-apktool/
is 5800 only can 100%-90%-80%,some phone is 1% move
maybe edit smali can work 1% move..

[Resolved] [CLOSE THREAD] [Q] Android 2.2.1 with ODEX ROM

Hi,
I have a phone that have Android 2.2.1 with ODEX Rom.
The phone GPS has a problem, it reports the speed in knots instead m/s.
I have the solution to solve this GPS problem but I need to edit one of the classes inside the framework.odex (class location).
This is my problem:
How can I decompile the odex file and, after I make my changes, compile it again in odex format?
Hope someone can help me with this.
http://tinyurl.com/5ru2hrl
also
http://goo.gl/xB9rK
Hi,
I just found how to decompile odex files with baksmali.
But, it is possible generate the new odex file with dexopt-wrapper or something like that without use the phone?
I dont have root access in my phone because of that I must do it in my computer and use the update.zip to update my phone.
I try z4root but I think is not working with my phone.
Android 2.2.1 with ODEX ROM (Solved)
Problem solved.
I fallow this tutorial and it works just fine.
Just one thing, when I decompile the .odex file with the Baksmali I had to use the BOOTCLASSPATH.
To Baksmali and dexopt-wrapper we need to know the BOOTCLASSPATH.
In adb just type: adb shell echo $BOOTCLASSPATH

[HOW-TO] Re-Odex a ROM

I made a tutorial for other devices here http://forum.xda-developers.com/showthread.php?t=1500475
Why this tutorial?
I wanted a good odexed rom, but there isn't any here. So I tried to make my own odexed rom, but it wasn't so good. So I read something about re-odexing and tried it out. I modified it a little bit and I don't know all about re-odexing, so if someone know something better, pls post it here in the thread for everyone. Im working also on this thread, so I'll try to make few things like a flashable update.zip who executes the script. English is also not my mother language, but I hope you'll understand me
What is a odexed and a deodexed rom?
When you look at a stock rom in the folder /system/app, you will see files with the ending .odex and the apks doesn't contains classes.dex files. When you look at a deodexed rom, you'll see that there are no .odex files and the apks contains classes.dex files. Basically every apk contains a classes.dex files. Then the dalvik virtual machine generates a dalvik cache based of the classes.dex file. When you load a app, it will be loaded from the the dalvik cache, not from the apk. Samsung built the odexed rom using a tool called dexopt-wrapper. This tool generates .odex files based from the classes.dex, that means it does the same job like the dalvik vm. The .odex files were pushed in the /system. The files are the replacement for the dalvik cache. Like I wrote above, apps are loading from the dalvik cache, not from apk or classes.dex file, so classes.dex are not needed anymore, so they are deleted in odexed roms. Deodexing using xUltimate means regenerating a classes.dex based from the .odex file, merging it into the apk and deleting .odex.
What are the advantages and disadvantages from a deodexed rom?
Advantages:
-All needed things are in one apk, so modding/theming is (better) possible
-Needs less space on /system
Disavantages:
-Needs more space on /data, you have on some roms only 110/170 mb free(because a deodexed rom needs a dalvik cache for system apps and frameworks
-Is not so stable than a odexed rom(because some moves dalvik cache to a low end sdext)
-Slower on first boot(because a odexed rom has already execute ready .odex files, a deodexed rom needs to generate dalvik cache)
Why should I re-odex?
I wanted this, because I use ~100 apps and I have a slow sd card, so moving /data/app and /data/dalvik cache to sdext made my system unstables, which was needed to run ~100 apps on a deodexed rom. But when I tried it on a odexed rom, I had only to move /data/app to sdext. So I used long time Stock rooted JPU. But the system was not so fast than on any other custom rom and I hated the stock theme. So If you want more space on /data and you don't want to try out new themes, you should probably try re-odexing.
What do I need to re-odex?
-A full NANDroid Backup
-More than 30 mb free space on /system
-ADB drivers for Option 1
-Titanium Backup Pro for Option 2
How can I re-odex a Rom?
There are 2 Options to do it, but only the first does a full re-odex.
Before doing anything make sure that you have a full NANDroid Backup because you'll propably get into a bootloop.
Option 1 using dexopt-wrapper:
I used first the script from puppet13th, but I got into a bootloop. So I corrected the $BOOTCLASSPATH and corrected permissions, but I got also into a bootloop. I compared the re-odexed Kyrillos Rom v9.3 framework with the framework from JPU. The difference was that Kyrillos Rom v9.3 Framework files android.policy.jar and services.jar doesnt contained the Meta-Inf.
Step 1: Check jars
Pull all your framework .jars using this adb command to your computer
Code:
adb pull /system/framework
and open them in WinRar or sth and check that they contains the Meta-Inf folder. If some file doesnt contain a Meta-Inf folder, I attached all jars from Stock JPU, so you can add the Meta-Inf folder from them. When you are done with adding Meta-Inf Folder to one file, you can push it to the system using this adb command(services.jar is only for example, use your filename):
Code:
adb push services.jar /system/framework
Some users told me that you can re-odex the rom without being in CWM, so you can may skip Step 2, but you could get into a bootloop without Step 2, but you can try it out, there is no risk with a NANDroid backup
Step 2(optional): Reboot your phone into cwm recovery and get adb access there
I never got adb access in windows, but i got always access with linux. If you also don't get access on Linux, you should try to reboot your phone and to select then recovery in the extended power menu, this gaves me always adb access.
Step 3: run reodex script
I attached a script, which push a script and needed binaries over adb to the phone. Then it executes the pushed script, which creates odex files and removes classes.dex from apks or jars and rezipaligns apks and deletes the dalvik cache.
For windows users: double click on odex.cmd
For linux users: open a terminal and navigate to the folder which contains the unzipped attachment and run
Code:
chmod +x reodex.sh
./reodex.sh
After its finished, simply reboot and enjoy your fully re-odexed rom.
Step 4 (optional) convert /data:
I dont know if there is a better option, but after a re-odex with Option 1, my phone didnt showed the right free space on /data. So I converted /data to a other filesystem and back and then it showed the right free space.
Option 2 using Titanium Backup Pro:
You need to have Titanium Backup pro for re-odexing.
Step 1:
Select Menu -> More -> integrate sys dalvik into rom and wait until its finished. Then you should have more space on /data. I had when I tried it before 105 and after 135 mb free space on /data and 0kb free space after it on /system, so its not all.
You can also undo it. Its good when you want to try out a new theme, so you can undo and redo it using TB Pro.
Simply select Menu -> More -> Undo sys dalvik integration
and you're done.
Option 1 vs. Option 2
-Option 1 does a full re-odex, you have full free space on /data(Option 2 does only re-odex the apps, not the framework)
-Option 1 deletes classes.dex from apks and jars(against Option 2), so you have more space free on /system
-You can undo Option 2 fast, so theming/modding is also possible by undo, theme and redo it(against Option 1)
For other Phones:
If someone has a other phone, theres a chance for getting re-odex working, but I think that you should not hope that it works. You can try to put in the right $BOOTCLASSPATH. You can find the valid $BOOTCLASSPATH in /init.rc. Then replace the following characters with the $BOOTCLASSPATH in the script in the folder odex(beginning from Line 8):
Code:
BOOTCLASSPATH=replace_this_with_your_bootclasspath
cd /system/framework
for filename replace_this_with_your_bootclasspath
In the line
Code:
for filename replace_this_with_your_bootclasspath
you must replace the ":" character between framework files with a space.
For theme developers:
I dont know if it works that you use the re-odexed theme on a stock odexed theme. If it is so, you dont have to re-odex and deodex your phone, you can simply push the dexopt-wrapper binary to a folder, chmod 755 it and use it to make odex files from the needed apks and jars(all apks inside /system/framework has no odex files, so dont odex them) like this:
Code:
dexopt-wrapper /system/app/Phone.apk /mnt/sdcard/Phone.odex /system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar
You can change argument 1-2, but not argument 3(its the BOOTCLASSPATH)Then you could copy all needed main apks or jars to sdcard and remove classes.dex. Then only do Step 1 from Option 1 and you should have a theme for odexed rom.
Download Links
XDA gaves me only 500 Errors when uploading was done, so I uploaded it to min.us
Framework jars from JPU
Re-Odex Script for Windows
Re-Odex Script for Linux
Credits
puppet13th for making orginal script
If I helped you, dont be shy, just press the Thanks Button under this post.
www.kingsrom.com/f8-how-to-theme-guideslinkstutorials
Oh year I didnt see any tutorial before, but his is only for Froyo sense or Gingerbread aosp, so it wont work on galaxy 3 and I also wrote my tutorial so that noobs can understand it(I hope so).
I could also post a system.img of a re-odexed Kyrillos Rom v9.3 and other Roms, but I dont know if Im allowed to do that.
TearsDontFalls said:
Oh year I didnt see any tutorial before, but his is only for Froyo sense or Gingerbread aosp, so it wont work on galaxy 3 and I also wrote my tutorial so that noobs can understand it(I hope so).
I could also post a system.img of a re-odexed Kyrillos Rom v9.3 and other Roms, but I dont know if Im allowed to do that.
Click to expand...
Click to collapse
So the re-odexed kyrillos rom v9.3 is working faster than the original kyrillos rom v9.3??
Its not generally faster, but much faster for me because I have ~100 apps and when I run these apps on kyrillos v9.3 deodexed, i must move app and dalvik-cache to sdext which made my phone laggy. With a odexed kyrillos v9.3, i have much more space free on /data, so i only must move app to sdext which is much.
I wrote also the advantages and disadvantages from a deodexed and odexed rom in my tutorial.
TearsDontFalls said:
Its not generally faster, but much faster for me because I have ~100 apps and when I run these apps on kyrillos v9.3 deodexed, i must move app and dalvik-cache to sdext which made my phone laggy. With a odexed kyrillos v9.3, i have much more space free on /data, so i only must move app to sdext which is much.
I wrote also the advantages and disadvantages from a deodexed and odexed rom in my tutorial.
Click to expand...
Click to collapse
So, in a re-odexed rom the HD2SD is not working ?
You use again froyo data2SD ?
dante_100 said:
So, in a re-odexed rom the HD2SD is not working ?
You use again froyo data2SD ?
Click to expand...
Click to collapse
As far as I understand, it works but only for data/app.
correct me if I'm wrong
Sorry, my english is not the yellow from the egg(you must not understand this).
Im using on my re-odexed rom also Hybrid Data 2 SD, I can move also move /data/dalvik-cache and any other folder to sdext, its only not needed, because I had after the re-odexing much more free space on /data, so I did moved dalvik cache back to the NAND from the sdext, before re-odexing I moved dalvik cache to sdext, becaue it was needed for running ~100 apps.
short form:Only Theming is impossible with a re-odexed rom
Hope you'll understand this now.
Edit: Can someone help me for creating a update.zip for re-odexing. It must only copy the dir odex to /data/local/tmp/odex , chmod 755 them all and execute the shell script /data/local/tmp/odex/odex
Sooo
if i get ADB access using windows i can skip step 2 in option1 right?
chandradithya said:
Sooo
if i get ADB access using windows i can skip step 2 in option1 right?
Click to expand...
Click to collapse
No. You need to reboot in cwm and try to get adb access from there. Windows adb in recovery never worked for me, you need linux to get adb access from cwm mode
Sent from my i9003 powered by Poseidon's Rom + UC kernel
Right, I tried to make a update.zip which execute the script, but i had no success, it would be great if somebody can help me.
bscraze said:
No. You need to reboot in cwm and try to get adb access from there. Windows adb in recovery never worked for me, you need linux to get adb access from cwm mode
Sent from my i9003 powered by Poseidon's Rom + UC kernel
Click to expand...
Click to collapse
ADB actually works for me, just ran cmd.exe using admin privileges and i ran the odex script it worked, odexed ALL my system files, cleared my /data/dalvik-cache/
But like TearsDontFalls said it doesn't show the free memory correctly,
Im running g3mod and im yet to try the option4 that asks you to switch file systems
And the /g3mod.log says,
st17: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY
While the other partitions are all clean,
How did you got adb access in windows? Sure you was in cwm recovery while re-odexing?
Finally, someone post a guide on this. And it works! Though titanium backup never worked for me. And is it necessary to run the script on cmw? Cause I didn't done it on cmw.
Sent from my GT-I5800 using XDA App
I didn't expect that it works on a running system, but it can be so, so I'll update the guide after Christmas.
TearsDontFalls said:
How did you got adb access in windows? Sure you was in cwm recovery while re-odexing?
Click to expand...
Click to collapse
It worked perfectly for me,
I tried going to the G3 kernels recovery, ADB just wouldnt connect,
so i turned it on, Ran the script when it was in standby mode , then it gave an error at first,
Which i rectified by making the /system read or write using root explorer,
I think i ran the script using admin privileges.
Dont remember..
And g3mod.log showed me this
Code:
Checking mmcblk0p2
/dev/block/mmcblk0p2: clean, 11/125488 files, 15840/500173 blocks
Checking stl6
/dev/block/stl6: clean, 1302/13600 files, 46914/54400 blocks
Checking stl7
/dev/block/stl7 contains a file system with errors, check forced.
/dev/block/stl7: Inodes that were part of a corrupted orphan linked list found.
/dev/block/stl7: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
(i.e., without -a or -p options)
Checking stl8
/dev/block/stl8: clean, 12/2176 files, 143/8704 blocks
Data2SD Disabled
Multi-OS Data Disabled
System detected: FROYO
System booted with Samsung Froyo kernel mode
Compcache disabled
No problems right now, But cant stop wondering why it says it is inconsistent.
I don't know why it is so, but it also doesn't show the right free space, so convert it to a other file system and then convert it back.
UNBELIEVABLE!
Finally, the first method worked for me.
Working great on HTC Amaze 4G
Thanks
heyjoe66 said:
UNBELIEVABLE!
Finally, the first method worked for me.
Working great on HTC Amaze 4G
Thanks
Click to expand...
Click to collapse
Thanks for your report. So it seems to be working on other devices, so I'll create a thread in android development.
Thanks works on sense 3.5, but I had to change Bootclasspath from the boot.img and add missing files below in odex script.
great guide
edit: now searching on how to re odex a single file.

[Q] deodexing and checking

Hi All,
I'm currently trying to deodex my rom to fully customize it. I have HTC One SU with chinese firmware and want to add more languages, for example and patch some smali files.
I already deodexed framework and it seems working good, but stucked on /system/app
Deodexing works without any errors and smoothly
But some apps working well, some completely not. After replacing some apks I see errors on screen and in logcat. After reboot system stucks on boot animation and I have to restore from last backup.
So I expect, classes.dex after odexing by the system should be completely the same as original classes.odex
talking on programming language: Original classes.odex == system_odexed(custom_deodex(Original classes.odex ))
is it should be like that? is statement correct?
or everytime I odexing or deodexing files, result of back step will not always equal to original source?
Question 2: which framework I should use to deodex system/app ? ODEX or DEX?
Falseclock said:
Hi All,
I'm currently trying to deodex my rom to fully customize it. I have HTC One SU with chinese firmware and want to add more languages, for example and patch some smali files.
I already deodexed framework and it seems working good, but stucked on /system/app
Deodexing works without any errors and smoothly
But some apps working well, some completely not. After replacing some apks I see errors on screen and in logcat. After reboot system stucks on boot animation and I have to restore from last backup.
So I expect, classes.dex after odexing by the system should be completely the same as original classes.odex
talking on programming language: Original classes.odex == system_odexed(custom_deodex(Original classes.odex ))
is it should be like that? is statement correct?
or everytime I odexing or deodexing files, result of back step will not always equal to original source?
Click to expand...
Click to collapse
What API did you deodex them with?
Sent from my HTC One S using xda app-developers app
troby86 said:
What API did you deodex them with?
Click to expand...
Click to collapse
manually )) This is perfectly works for framework jars
just 4 commands (simplified here and of course I have my automatic script)
java -Xmx1024m -jar baksmali.jar -c <<BOOT_PATH_HERE>> -x classes.odex
java -Xmx1024m -jar smali.jar out -o classes.dex
7z.exe a -tzip my_programm.apk classes.dex
zipalign -v 4 my_programm.apk zip_my_programm.apk
Question 2: which framework I should use to deodex system/app ? ODEX or DEX?
Falseclock said:
Hi All,
I'm currently trying to deodex my rom to fully customize it. I have HTC One SU with chinese firmware and want to add more languages, for example and patch some smali files.
I already deodexed framework and it seems working good, but stucked on /system/app
Deodexing works without any errors and smoothly
But some apps working well, some completely not. After replacing some apks I see errors on screen and in logcat. After reboot system stucks on boot animation and I have to restore from last backup.
So I expect, classes.dex after odexing by the system should be completely the same as original classes.odex
talking on programming language: Original classes.odex == system_odexed(custom_deodex(Original classes.odex ))
is it should be like that? is statement correct?
or everytime I odexing or deodexing files, result of back step will not always equal to original source?
Question 2: which framework I should use to deodex system/app ? ODEX or DEX?
Click to expand...
Click to collapse
Use this it will work like a charm for that..just don't forget to check updater-script after.. If it won't flash after the kitchen the spacing is wrong in the script..
http://forum.xda-developers.com/showthread.php?t=633246
Sent from my HTC One S using xda premium
Iw would like to deodexing my stock rom but the Android-Kitchen doesn't find my TWRP Back-Up gives a another way to deodex my Sense Stock Rom?
xUltima doesn't work.

How to extract .dat from Custom Rom Lollipop

I like modify all my ROMs, and in Android 5.0, the /system is on a system.dat and I don't know how to extract it, please help me
Up ?
I am up to this too. Before this .dat thing was very easy to de-bloat the ROM before installing it.
A different approach is to have a flashable zip with an updater- script that deletes apps / files and adds / changes etc. Its a bit more work at the beginning but it will save you editing every ROM zip you download as it'll only take a second to flash it.
rootSU said:
A different approach is to have a flashable zip with an updater- script that deletes apps / files and adds / changes etc. Its a bit more work at the beginning but it will save you editing every ROM zip you download as it'll only take a second to flash it.
Click to expand...
Click to collapse
Can you provide/point us a simple tutorial for making a simple flashable script that removes apps?
Thanks.
01 Vlatce said:
Can you provide/point us a simple tutorial for making a simple flashable script that removes apps?
Thanks.
Click to expand...
Click to collapse
I uploaded mine in this thread:
http://forum.xda-developers.com/google-nexus-5/help/editing-build-prop-via-flashable-zip-t2949308
Please note, it deletes some stuff, adds anything in the /system folder of the zip to your /system partition and also runs a bash shell script (.sh) to modify the build prop. If you look in the updater-script, you should be able to figure it out from there.
rootSU said:
I uploaded mine in this thread:
http://forum.xda-developers.com/google-nexus-5/help/editing-build-prop-via-flashable-zip-t2949308
Please note, it deletes some stuff, adds anything in the /system folder of the zip to your /system partition and also runs a bash shell script (.sh) to modify the build prop. If you look in the updater-script, you should be able to figure it out from there.
Click to expand...
Click to collapse
Already figured it out. Thank you!
you can also get an ext4 fs editor (the .dat is actually an ext4 image), such as ext4_unpacker and so on
http://forum.xda-developers.com/showthread.php?p=57633970

Categories

Resources