HELP NEEDED: Trying to make my own custom ROM! - Hero, G2 Touch Android Development

Hi,
So, I'm trying to make my own custom ROM. Nothing too fancy, just a couple of simple and easy modifications to fit my needs but there's somethings I don't know how they work nor I understand them and I need some help. The only thing I was able to achieve as of yet was to remove some apps (I only tried to remove "Learn More" and QuickOffice to be honest-- but it worked). I just removed the .apk and .odex file directly from the .zip file, signed it and flashed it as usual. It worked fine.
Now, a few questions...
1) I also tried to add a few apps, just like in MoDaCo Custom ROM (MCR), to the /data/app folder instead of /system/app. Actually, I just copied all of .apk files from MCR /data/app into my own (with same folder structure of course). But they didn't get installed... I know I'm missing something and I can almost bet it has something to do with the /META-INF/com/google/android/update-script file. I tried countless times to search for some guide, how-to or just a piece of documentation about this file but I can't find anything. I don't want to just change it and see if it works and then screw things up. Can anyone give me some hints about understanding this file? It has to do with the fact that my /data/apps weren't installed, right?
2) I don't use the Gmail app, just the HTC Mail one. Is it safe to delete Gmail.apk and GmailProvider.apk? I believe Gmail.apk will be fine, but the provider one, I guess it's used by the data synchronization thing. Maybe it's ok if I don't sync my mail (that's what I want actually) but maybe there's something else that I'm missing and the system will not work properly, somehow, without the GmailProvider.apk or is it safe to remove it?
3) When we first install a new ROM, starting clean, there's an introductory guide allowing to setup some things initially. One of those is the language. There is a bunch of languages, specially like English (A), English (B), English © where the letters represent other languages. I don't need all that, I only need English (Portugal). Is there anyway I could remove the ones I don't want from the ROM or I would need to dig into the Android source for that?
3.1) How about adding my own language? Is there a way I could do that to my ROM?
NOTE: Funny thing, the Android system is localized on my country's language when I first start the device but as soon as I change it to English, I cannot change it back to Portuguese cause that option doesn't exist. How come the device is in Portuguese when I first start it up after flashing a new ROM? This also happens every time I swap the SIM card, but I can never select Portuguese language by myself. Why?
4) I noticed that after flashing my custom ROM, after booting the device for the first time, the mobile network was active. This is not good... For now I have 1 month free of mobile networking but that won't last forever. I don't want to waste money every time I'm trying a new ROM. Is there anyway to disable this thing from automatically starting up connected when I first boot?
For now that's it...

1. You need to edit "META-INF/com/google/android/update-script"

That's what I said... :/ But I also said:
I tried countless times to search for some guide, how-to or just a piece of documentation about this file but I can't find anything. I don't want to just change it and see if it works and then screw things up. Can anyone give me some hints about understanding this file?
Click to expand...
Click to collapse
If anyone knows anything helpful of course...

Nazgulled said:
That's what I said... :/ But I also said:
If anyone knows anything helpful of course...
Click to expand...
Click to collapse
I am also interested in a guide or walk through for making a ROM for the Hero.

1) I also tried to add a few apps, just like in MoDaCo Custom ROM (MCR), to the /data/app folder instead of /system/app. Actually, I just copied all of .apk files from MCR /data/app into my own (with same folder structure of course). But they didn't get installed... I know I'm missing something and I can almost bet it has something to do with the /META-INF/com/google/android/update-script file. I tried countless times to search for some guide, how-to or just a piece of documentation about this file but I can't find anything. I don't want to just change it and see if it works and then screw things up. Can anyone give me some hints about understanding this file? It has to do with the fact that my /data/apps weren't installed, right?
Click to expand...
Click to collapse
You're missing copy_dir PACKAGE:data DATA:, so you're really not writing /data/app even if it's on the package. If you read through the update-script, you'll see that it starts by formating BOOT: and SYSTEM: and later on writes the contents of /system to SYSTEM: (with copy_dir) and writes the raw boot.img to BOOT: (with write_raw_image).
Add the line to the very end of the permissions settings (but before format and write boot, most likely, before the show_progress line). You also need to set a specific permission after writing anything to /data/app from an update-script, otherwise your market won't be able to install anything (as you'll have changed the permissions for /data/app through the update-script).
In all, your update script will look like this (assuming a regular update-script, not the mcr 2.9 one):
Code:
...
symlink toolbox SYSTEM:bin/xxxxyyyy
...
set_perm 0 0 04755 SYSTEM:bin/su
copy_dir PACKAGE:data DATA:
set_perm 1000 1000 0771 DATA:app
show_progress 0.1 10
show_progress 0.2 0
write_raw_image PACKAGE:boot.img BOOT:
show_progress 0.2 10
2) I don't use the Gmail app, just the HTC Mail one. Is it safe to delete Gmail.apk and GmailProvider.apk? I believe Gmail.apk will be fine, but the provider one, I guess it's used by the data synchronization thing. Maybe it's ok if I don't sync my mail (that's what I want actually) but maybe there's something else that I'm missing and the system will not work properly, somehow, without the GmailProvider.apk or is it safe to remove it?
Click to expand...
Click to collapse
It's safe to remove both, though the provider doesn't do much without the app, so it's also safe to leave it there.
3) When we first install a new ROM, starting clean, there's an introductory guide allowing to setup some things initially. One of those is the language. There is a bunch of languages, specially like English (A), English (B), English © where the letters represent other languages. I don't need all that, I only need English (Portugal). Is there anyway I could remove the ones I don't want from the ROM or I would need to dig into the Android source for that?
Click to expand...
Click to collapse
Hero roms take their settings from xml files in /system/customize. You'll see a bunch of xmls in there. Some are references to other xmls to be used (mns_map and cid_map), some are default settings (default.xml, COMMON.xml) and some are carrier specific settings (/CID/HTC_*.xml and /MNS/Lan_*.xml). The files are very redundant, and it's hard to tell which one is being used when, though, as a rule, you should understand that Hero loads a default from the /customize folder and then looks at mns_map and cid_map for the file to use inside /CID and /MNS. I'm not yet aware how it chooses the file, but, if you narrow down it's choices, then you can control which ones it uses and modify the settings there. If you crack open the xmls, you'll immediately see the languages defined in there (en_US, en_GB, etc), so removing languages is a matter of deleting the lang/region and adding your own (en_PL?). Again, there's so many xmls in there that it's hard to know which one to use, so either make your own and delete the rest, or edit them all. I'll give you the batch that I use in my /customize, reading through them should help you understand what's going on with those xmls.
3.1) How about adding my own language? Is there a way I could do that to my ROM?
NOTE: Funny thing, the Android system is localized on my country's language when I first start the device but as soon as I change it to English, I cannot change it back to Portuguese cause that option doesn't exist. How come the device is in Portuguese when I first start it up after flashing a new ROM? This also happens every time I swap the SIM card, but I can never select Portuguese language by myself. Why?
Click to expand...
Click to collapse
Look above, it's because the language is obtained from the carrier and used during first boot, but it's not defined in an xml, so it's unavailable, make it available by adding it to the list.
4) I noticed that after flashing my custom ROM, after booting the device for the first time, the mobile network was active. This is not good... For now I have 1 month free of mobile networking but that won't last forever. I don't want to waste money every time I'm trying a new ROM. Is there anyway to disable this thing from automatically starting up connected when I first boot?
Click to expand...
Click to collapse
This I'm not sure about. You could try emptying your /system/etc/apns-conf.xml so that it won't be able to register to any data service (just leave the <apns version="x"> </apns> tags, remove everything in between).
Good luck.

jubeh said:
You're missing copy_dir PACKAGE:data DATA:, so you're really not writing /data/app even if it's on the package. If you read through the update-script, you'll see that it starts by formating BOOT: and SYSTEM: and later on writes the contents of /system to SYSTEM: (with copy_dir) and writes the raw boot.img to BOOT: (with write_raw_image).
Add the line to the very end of the permissions settings (but before format and write boot, most likely, before the show_progress line). You also need to set a specific permission after writing anything to /data/app from an update-script, otherwise your market won't be able to install anything (as you'll have changed the permissions for /data/app through the update-script).
Click to expand...
Click to collapse
That's what I thought but I'm still missing one thing...
The generic HTC "update.zip" has format: DATA for the last line of the update script, which I suppose will delete everything becuse the copy_dir command was executed before.
Should I not use the format data option? Won't that leave traces of a previous installation if I want to start clean? What's the recommendations or suggestions?
jubeh said:
It's safe to remove both, though the provider doesn't do much without the app, so it's also safe to leave it there.
Click to expand...
Click to collapse
What will happen to the data-sync when i tries to sync the data and finds the provider for gmail is not there? Will it simply be ignored? Will there be any errors changing any of the options (specially the gmail one) on the data synchronization settings?
jubeh said:
Hero roms take their settings from xml files in /system/customize. You'll see a bunch of xmls in there. Some are references to other xmls to be used (mns_map and cid_map), some are default settings (default.xml, COMMON.xml) and some are carrier specific settings (/CID/HTC_*.xml and /MNS/Lan_*.xml). The files are very redundant, and it's hard to tell which one is being used when, though, as a rule, you should understand that Hero loads a default from the /customize folder and then looks at mns_map and cid_map for the file to use inside /CID and /MNS. I'm not yet aware how it chooses the file, but, if you narrow down it's choices, then you can control which ones it uses and modify the settings there. If you crack open the xmls, you'll immediately see the languages defined in there (en_US, en_GB, etc), so removing languages is a matter of deleting the lang/region and adding your own (en_PL?). Again, there's so many xmls in there that it's hard to know which one to use, so either make your own and delete the rest, or edit them all. I'll give you the batch that I use in my /customize, reading through them should help you understand what's going on with those xmls.
Click to expand...
Click to collapse
I'm familiar with XML files and have no problems editing them but this whole thing was a little confused specially because there are no documentation and like you said, it's hard to tell which one is which.
I know you kinda suggested that but I'm no seeing how to do it (maybe with the file you attached?) but, how could I start clean, only have default XML files and nothing else, no carrier specific stuff, no bulk, just plain default settings that I can tweak to my own liking.
Any hints on how to do that, or it's hard to tell and you don't know how to do it either?
jubeh said:
This I'm not sure about. You could try emptying your /system/etc/apns-conf.xml so that it won't be able to register to any data service (just leave the <apns version="x"> </apns> tags, remove everything in between).
Click to expand...
Click to collapse
Unfortunately, this did not work

The generic HTC "update.zip" has format: DATA for the last line of the update script, which I suppose will delete everything becuse the copy_dir command was executed before.
Should I not use the format data option? Won't that leave traces of a previous installation if I want to start clean? What's the recommendations or suggestions?
Click to expand...
Click to collapse
I've never understood why the default update script does that, but yeah, format DATA: will erase userdata available. It might not be such a bad thing if you hadn't written anything to it before. For a wipe before install, move format DATA: (and, optionally, also add format CACHE: ) right after format SYSTEM: and before you start writing anything to disk. It should give you a clean install without having to wipe from the recovery menu.
What will happen to the data-sync when i tries to sync the data and finds the provider for gmail is not there? Will it simply be ignored? Will there be any errors changing any of the options (specially the gmail one) on the data synchronization settings?
Click to expand...
Click to collapse
I've not tried it yet. Worst case scenario, you'll get the current problem we have with eclair builds (sync will just keep running and eat out battery because it's looking for a service). That's why I'd suggest leaving gmail provider there, it's just a broadcast service, but without an app to receive the data, it'll do nothing. If your concern is data usage due to sync, then you should turn off gmail sync in settings, that way only calendar and contacts are synchronized (although you'll still be using data).
I'm familiar with XML files and have no problems editing them but this whole thing was a little confused specially because there are no documentation and like you said, it's hard to tell which one is which.
I know you kinda suggested that but I'm no seeing how to do it (maybe with the file you attached?) but, how could I start clean, only have default XML files and nothing else, no carrier specific stuff, no bulk, just plain default settings that I can tweak to my own liking.
Any hints on how to do that, or it's hard to tell and you don't know how to do it either?
Click to expand...
Click to collapse
The files I attached are pretty generic. It's meant to replace your /customize folder, not add to it, with the exception being /resources inside /customize, that one I use a lighter version (no footprints) but I didn't include it in the archive for size. I have no carrier stuff there, just settings for language (I think I made it all en_US, replace or add what you need) and layouts for the different scenes, some mail app behaviors (added back the Yahoo! mail and AOL mail options, I think), some footprint, stock, and weather information. Again, it's meant to replace your /customize directory and the smaller amount of files makes it way easier to edit.
Unfortunately, this did not work
Click to expand...
Click to collapse
Blame the xmls in /customize for that. I mentioned earlier I don't exactly know how the system picks which xmls to use, I think it looks at your carrier, which is then assigned a number (for example, let's assume T-Mobile is given number 238, so xmls with 238 on them will be loaded). Problem is inside those xmls are also apn settings (which I've removed from the files I provided so that the system looks instead for apn settings in apns-conf.xml in /etc).
You could flash your system erasing the whole /customize directory (and removing all mentions of it and it's sub-directories from the update-script so that install doesn't fail). Doing that will give you ALL languages available to the rom, but you'll also lose all your pre-loaded settings (like scenes, weather locations, footprints, stocks) and HTC Setup will take an ungodly amount of time to start (about 4-5 minutes after it's done dexopting) while it builds it's own default settings. It's another route you could take, though. Experiment and you'll eventually hit what you want/need.

OK, I guess I'll have to waste some time testing all this stuff, but I suppose I'll leave that to some other day and do more basic things for now.
But just to be sure, if I use your "customization" I'm basically starting from scratch (clean, defaults) and I can use the "old" customization stuff to understand how am I supposed to configured everything and adapt the clean customization folder to my needs. Right?
jubeh said:
You could flash your system erasing the whole /customize directory (and removing all mentions of it and it's sub-directories from the update-script so that install doesn't fail). Doing that will give you ALL languages available to the rom, but you'll also lose all your pre-loaded settings (like scenes, weather locations, footprints, stocks) and HTC Setup will take an ungodly amount of time to start (about 4-5 minutes after it's done dexopting) while it builds it's own default settings. It's another route you could take, though. Experiment and you'll eventually hit what you want/need.
Click to expand...
Click to collapse
This gave me an idea, dunno if it could work...
What if I did that, erase everything inside customize, let the system build its own default settings and then access that directory (through ADB maybe?) and see what the system has created. It should be much more cleaned, without all those carrier XMLs and stuff. Then I could start from there, what do you think?
I have a few more questions about the update-script if you don't mind, but I'm very tired to write them and discuss them now. I'll leave them for another day if you don't mind coming back here and help me out some more.
Thanks for all your help so far

I should probably have mentioned, some of the stuff on those xmls is pretty straightforward (setting language, region, weather, footprints, etc), but a lot of it (setting up default shortcuts, default widgets, system settings) requires working knowledge of android, or at least of how activities are handled and how xmls come into play and how android references the different activities in a package.
On a different note, the xmls are read-only configuration files, actually, anything in system is read-only data (program data, configuration data, resource data), so if you don't have a customize directory the system won't recreate it. What the system does do during normal boot (factory) is to take those carrier-specific settings and apply them to a file(s) in /data where configuration settings are ultimately written/re-written and accessed at will. The xmls are just a database of the settings that will ultimately get picked. When you don't have a /customize directory the system writes the settings straight to -rw enabled /data partition based on things like your current carrier, carrier provided information for locale, etc.
I don't think you can take what's written to /data and use it on a default install package, well, you could, but it's much easier (and a more correct approach) to learn how those xmls in /customize work.

jubeh said:
(...)but it's much easier (and a more correct approach) to learn how those xmls in /customize work.
Click to expand...
Click to collapse
I wouldn't mind doing that if there was some kind of documentation... As it is right now, it's too confusing and there are too many XMLs to begin with...
jubeh said:
I've not tried it yet. Worst case scenario, you'll get the current problem we have with eclair builds (sync will just keep running and eat out battery because it's looking for a service). That's why I'd suggest leaving gmail provider there, it's just a broadcast service, but without an app to receive the data, it'll do nothing. If your concern is data usage due to sync, then you should turn off gmail sync in settings, that way only calendar and contacts are synchronized (although you'll still be using data).
Click to expand...
Click to collapse
But if I leave the gmail provider there and do not turn off gmail sync in settings, my e-mail will still be synced right? There's just no Gmail app to view them but they are still going to be downloaded, correct?

Ok, I finally got a change to test the Gmail/GmailProvider thing and it didn't look like there any problems like trying to sync and draining the battery. Actually, if auto-sync was enabled, there was always a message saying the mail was never synced and no matter how many times you check/uncheck it, it wouldn't sync. If auto-sync was disabled, you could press the gmail button many times but nothing happened, no sync at all (of course).
I think this behavior is fine and I can safely delete the Gmail and provider from the phone without worrying that something will go wrong
Ok, now my other questions that I said I was going to post later...
As we talked about, you suggested to add a format data and cache right after a format to system. Comparing that to the MoDaCo ROM (and other ROMs too) it's common for them to, instead of formatting data, they do this:
Code:
delete DATA:app
delete DATA:init.sh
delete DATA:local
delete DATA:dalvik-cache
copy_dir PACKAGE:data DATA:
set_perm 1000 1000 0771 DATA:app
Why are they doing this? If they are not formatting, it means there's something inside data that they want to keep. Have any idea what and why?
The other question I had about the update-script is that the following two lines are found in the original HTC update but not on MoDaCo's:
Code:
symlink dumpstate SYSTEM:bin/bugreport
symlink dumpstate SYSTEM:bin/dumpcrash
Are they relevant somehow? Should I just ignore and leave them there or remove them just as MCR did, for some reason?
There's a file named build.prop inside the system folder. I've already searched countless times and can't find any proper documentation about this file... It seems it can hold various default properties for the system and it would be nice to know what I can configure there. Maybe I could workaround problem #4 (top of the topic) in this file? Maybe some file in the Android source has comments about the possible properties on this file? Do you have any idea?
One last thing...
I've read about odex and dex files but found it a little confusing... All I know is that original HTC updates come mostly with .apk files and a corresponding .odex file. But most (if not all) custom ROM's, do not have the .odex file but have a classes.dex inside the apk. What's the real difference between the two? And why custom ROMs prefer to have the .dex file instead of the .odex, is it better somehow for some reason? If so, what should I do to "change" the .odex files into classes.dex ones and put them inside the .apk files?

As we talked about, you suggested to add a format data and cache right after a format to system. Comparing that to the MoDaCo ROM (and other ROMs too) it's common for them to, instead of formatting data, they do this:
Code:
delete DATA:app
delete DATA:init.sh
delete DATA:local
delete DATA:dalvik-cache
copy_dir PACKAGE:data DATA:
set_perm 1000 1000 0771 DATA:app
Why are they doing this? If they are not formatting, it means there's something inside data that they want to keep. Have any idea what and why?
Click to expand...
Click to collapse
Yeah, I mentioned on the earlier post that doing "format DATA:" and "format CACHE:" would be the equivalent of running "Wipe data/factory reset" from the recovery menu since you mentioned about making a build that installs fresh. Paul's (MoDaCo) roms are no-wipe, so they preserve that program data and instead format all other directories inside /data that might be problematic during an upgrade; his roms use apps2sd, so he assumes that the user's downloaded apps are in mmcblk0p2 (the memory card's ext partition), so by formatting /data/app, he's only erasing the apps he included in his update package, if the user doesn't use a2sd, well, this erases their downloaded apps (one of the reasons I dislike the current a2sd implementation, it's not suited for all situations). Then he deletes data/init.sh, which is basically a script he includes in /data that runs during a rom's boot and starts things like a2sd, compcache, linux-swap, and other custom rom's "advanced" features. DATA:local is also app storage (I believe) and functions much like in windows' /users/x/application data/local, it can be problematic if not done between builds. Last, he erases /data/dalvik-cache, this is where the temporary application code resides (the extracted classes.dex from inside an apk) for rapid execution (for apks that haven't been pre-odexed). If you wish to make your rom no-wipe, add those lines instead of "format DATA:", but I'd remove "delete DATA:app" since it's a bit problematic for people who don't use a2sd.
The other question I had about the update-script is that the following two lines are found in the original HTC update but not on MoDaCo's:
Code:
symlink dumpstate SYSTEM:bin/bugreport
symlink dumpstate SYSTEM:bin/dumpcrash
Are they relevant somehow? Should I just ignore and leave them there or remove them just as MCR did, for some reason?
Click to expand...
Click to collapse
dumpstate is a debugging tool that android uses, but I don't know exactly where or how (I think it's an HTC-specific log for their HTCLog.apk). It contains two tools, dumpcrash and bugreport, much like toolbox is a binary that contains all the tools you see symlinked to it in update-script (bin, df, cp, mv, ls, insmod, etc.). It's not a problem at all if you remove it, but it's not a problem either to leave it there. Whenever something is symlinked, though (if it's something you added, for example, busybox tools), you have to make sure that the binary or a link to it or a previous symlink to it doesn't exist, otherwise your update-script will fail (like symlinking toolbox's insmod and then busybox's insmod, or busybox's ping if a ping binary already exists in the target symlink directory (for example /system/bin)).
There's a file named build.prop inside the system folder. I've already searched countless times and can't find any proper documentation about this file... It seems it can hold various default properties for the system and it would be nice to know what I can configure there. Maybe I could workaround problem #4 (top of the topic) in this file? Maybe some file in the Android source has comments about the possible properties on this file? Do you have any idea?
Click to expand...
Click to collapse
I guess that could work if you modify network type (there's a property somewhere in there about HSXPA, I think), but like you said, there's no documentation so it calls for some experimenting.
Those properties are also overrides, so, for example, if your rom doesn't do adb root (because ro.secure is set to 1 in init.rc), you can add ro.secure=0 in build.prop to enable adb root again.
Most properties are self explanatory, and pretty much, if you can't tell what it is, you probably shouldn't change it (for example, build.fingerprint allows you to change what kind of apps Market presents to you).
I'd say, don't mess around too much with the first batch (default build properties), with the exception of build.fingerprint.
One last thing...
I've read about odex and dex files but found it a little confusing... All I know is that original HTC updates come mostly with .apk files and a corresponding .odex file. But most (if not all) custom ROM's, do not have the .odex file but have a classes.dex inside the apk. What's the real difference between the two? And why custom ROMs prefer to have the .dex file instead of the .odex, is it better somehow for some reason? If so, what should I do to "change" the .odex files into classes.dex ones and put them inside the .apk files?
Click to expand...
Click to collapse
The classes.dex files is the dalvik bytecode for the application. It contains everything inside /appnamespace/src and /appnamespace/R if you're working from the source. It's basically all the java code already compiled for the dalvik virtual machine.
Dalvik doesn't do jit, so the classes.dex have to be extracted (if they're not already) and run through the virtual machine in a process called dexopt that produces code that can be much more rapidly excecuted by the dvm (dalvik virtual machine). The extracted code is then placed in /data/dalvik-cache (mentioned earlier) as [email protected]@[email protected]. All this pre-cached code eats away at your space in your /data partition (where you store your system data, like your email, messages, browser cache, and downloaded applications) and can be quite a big chunk of space gone (framework classes specially, since all jars inside /system/framework are nothing but java code, about 20MB for all framework code).
The solution to prevent usage of /data storage on an initial build is to have the code pre-extracted. This is done at compile-time running the created system through an emulator and then creating the odex files, which is almost exactly the same as the *@classes.dex found inside /data/dalvik-cache except that it's much better aligned to the device's memory configuration and offers (marginally) better excecution, plus when the package manager first encounters the apk, it's first step is to check if an .odex of it is available, if it is, then it skips checking and dexopting a classes.dex inside it and proceeds to the next package.
Odex files increase the space in your /system partition (it was already read-only, so it's not like you're missing out on something) so those 20 MB of framework that would have been tossed into your userdata partition are now out of the way into the useless (in an available-storage sense) /system partition so you have more free space for your apps.
There's a tool that can create odex files for apks that don't have them, it's called dexopt-wrapper and it has to be run from a running phone. However, this tool won't strip the (now unnecessary) classes.dex from inside an apk, so it has to be done manually. Removing the classes.dex once you've created an odex is a good idea merely on the basis of space savings. However, once a classes.dex has been odexed, it's very hard (used to be impossible) to turn it back to a classes.dex and place it inside an apk.
Usually, us rom cooks preffer the classes.dex inside the apk because odexes create conflicts when you try to mix and match apps between builds. Since the odex files are tied to the framework where they were created, adding an apk with it's odex to another framework (even one that's only ever-so-slightly different) will be very problematic (the odex code is no longer protected or verified, so the rom won't even boot because it will fail verification for all available packages).
The tool for reverting odex files is called deodexerant by jesus freke. It requires working knowledge of how the system goes through the dexopting process so you can run it in the proper order.
Another thing to know is that even if your /system is pre-odexed, your downloaded apps will still be run through the package manager and have their classes.dex dexopted and placed in /data/dalvik-cache.
Oh, and never, ever put odexes anywhere but /system/framework or /system/app (or /data/app_s if you use a2sd). The package manager currently can't handle odexes in /data/app or /data/app_private (the other two locations where it looks for packages other than /system/app).
In the end, whether to use/have odexes comes down to personal choice (and available space). There's two hero builds, those based in 2.73.405.61 and 2.73.405.66, that have not been pre-odexed, so they're perfect for experimenting, mix/matching, etc...

jubeh said:
Yeah, I mentioned on the earlier post that doing "format DATA:" and "format CACHE:" would be the equivalent of running "Wipe data/factory reset" from the recovery menu since you mentioned about making a build that installs fresh. Paul's (MoDaCo) roms are no-wipe, so they preserve that program data and instead format all other directories inside /data that might be problematic during an upgrade; his roms use apps2sd, so he assumes that the user's downloaded apps are in mmcblk0p2 (the memory card's ext partition), so by formatting /data/app, he's only erasing the apps he included in his update package, if the user doesn't use a2sd, well, this erases their downloaded apps (one of the reasons I dislike the current a2sd implementation, it's not suited for all situations). Then he deletes data/init.sh, which is basically a script he includes in /data that runs during a rom's boot and starts things like a2sd, compcache, linux-swap, and other custom rom's "advanced" features. DATA:local is also app storage (I believe) and functions much like in windows' /users/x/application data/local, it can be problematic if not done between builds. Last, he erases /data/dalvik-cache, this is where the temporary application code resides (the extracted classes.dex from inside an apk) for rapid execution (for apks that haven't been pre-odexed). If you wish to make your rom no-wipe, add those lines instead of "format DATA:", but I'd remove "delete DATA:app" since it's a bit problematic for people who don't use a2sd.
Click to expand...
Click to collapse
So, to make it clear, I could:
Option A) Add format DATA and format CACHE to my ROM and this would make my ROM to automatically wipe everything and start clean.
Option B) I could not add anything (no formats and no deletes) and warn the users to explicitly perform a wipe before flashing.
Option C) Add delete DATA:local and DATA:dalvik-cache and have a no-wipe ROM where the apps would be preserved from the last ROM, right?
Ok, I don't use a2sd and for now have no intention in doing so. My best guess is to start with option A for now and maybe opt by using some app to backup everything and restore everything back after flashing a wipe ROM. Or I could go with option C and everything could work fine but there's a chance I could run into some issues in the long run.
jubeh said:
The classes.dex files is the dalvik bytecode for the application. It contains everything inside /appnamespace/src and /appnamespace/R if you're working from the source. It's basically all the java code already compiled for the dalvik virtual machine.
Dalvik doesn't do jit, so the classes.dex have to be extracted (if they're not already) and run through the virtual machine in a process called dexopt that produces code that can be much more rapidly excecuted by the dvm (dalvik virtual machine). The extracted code is then placed in /data/dalvik-cache (mentioned earlier) as [email protected]@[email protected]. All this pre-cached code eats away at your space in your /data partition (where you store your system data, like your email, messages, browser cache, and downloaded applications) and can be quite a big chunk of space gone (framework classes specially, since all jars inside /system/framework are nothing but java code, about 20MB for all framework code).
The solution to prevent usage of /data storage on an initial build is to have the code pre-extracted. This is done at compile-time running the created system through an emulator and then creating the odex files, which is almost exactly the same as the *@classes.dex found inside /data/dalvik-cache except that it's much better aligned to the device's memory configuration and offers (marginally) better excecution, plus when the package manager first encounters the apk, it's first step is to check if an .odex of it is available, if it is, then it skips checking and dexopting a classes.dex inside it and proceeds to the next package.
Odex files increase the space in your /system partition (it was already read-only, so it's not like you're missing out on something) so those 20 MB of framework that would have been tossed into your userdata partition are now out of the way into the useless (in an available-storage sense) /system partition so you have more free space for your apps.
There's a tool that can create odex files for apks that don't have them, it's called dexopt-wrapper and it has to be run from a running phone. However, this tool won't strip the (now unnecessary) classes.dex from inside an apk, so it has to be done manually. Removing the classes.dex once you've created an odex is a good idea merely on the basis of space savings. However, once a classes.dex has been odexed, it's very hard (used to be impossible) to turn it back to a classes.dex and place it inside an apk.
Usually, us rom cooks preffer the classes.dex inside the apk because odexes create conflicts when you try to mix and match apps between builds. Since the odex files are tied to the framework where they were created, adding an apk with it's odex to another framework (even one that's only ever-so-slightly different) will be very problematic (the odex code is no longer protected or verified, so the rom won't even boot because it will fail verification for all available packages).
The tool for reverting odex files is called deodexerant by jesus freke. It requires working knowledge of how the system goes through the dexopting process so you can run it in the proper order.
Another thing to know is that even if your /system is pre-odexed, your downloaded apps will still be run through the package manager and have their classes.dex dexopted and placed in /data/dalvik-cache.
Oh, and never, ever put odexes anywhere but /system/framework or /system/app (or /data/app_s if you use a2sd). The package manager currently can't handle odexes in /data/app or /data/app_private (the other two locations where it looks for packages other than /system/app).
In the end, whether to use/have odexes comes down to personal choice (and available space). There's two hero builds, those based in 2.73.405.61 and 2.73.405.66, that have not been pre-odexed, so they're perfect for experimenting, mix/matching, etc...
Click to expand...
Click to collapse
Well, I'm currently basing my ROM on 2.73.405.38 as the .66 one has "test" on the name and it feels like a beta version, which I'd rather not use. The .38 version uses .odex files for most of the packages (only a few has classes.dex inside) and I guess I'll leave them like that. If future ROMs, like that .66 one, comes with classes.dex vs .odex files, well, then I'll just leave it like that...
That looks like a very important thing in Android apps and at the same time something that I should be very knowledgeable about before messing with it, so I'll just stay put
Thanks once again for taking your time with such complete answers

So, to make it clear, I could:
Option A) Add format DATA and format CACHE to my ROM and this would make my ROM to automatically wipe everything and start clean.
Option B) I could not add anything (no formats and no deletes) and warn the users to explicitly perform a wipe before flashing.
Option C) Add delete DATA:local and DATA:dalvik-cache and have a no-wipe ROM where the apps would be preserved from the last ROM, right?
Ok, I don't use a2sd and for now have no intention in doing so. My best guess is to start with option A for now and maybe opt by using some app to backup everything and restore everything back after flashing a wipe ROM. Or I could go with option C and everything could work fine but there's a chance I could run into some issues in the long run.
Click to expand...
Click to collapse
Sounds like you got it.
Well, I'm currently basing my ROM on 2.73.405.38 as the .66 one has "test" on the name and it feels like a beta version, which I'd rather not use. The .38 version uses .odex files for most of the packages (only a few has classes.dex inside) and I guess I'll leave them like that. If future ROMs, like that .66 one, comes with classes.dex vs .odex files, well, then I'll just leave it like that...
That looks like a very important thing in Android apps and at the same time something that I should be very knowledgeable about before messing with it, so I'll just stay put
Click to expand...
Click to collapse
Test only refers to the build being signed with test-keys instead of release-keys. In my testing, it makes no difference whatsoever for a rooted user, and there's many theories floating around about signatures, I haven't researched signatures a whole lot because test-keys have worked fine enough for me, so I'm not so sure, but they seem to be working fine for all.
The reason those releases are un-odexed (and signed with test-keys) is because of the problem with odexes I mentioned earlier. When HTC is testing their rom packages and they need to make, say, a framework change, all the apps with odexes would fail as the framework has changed, so, for testing purposes, it's best to leave the apks and jars in the build full (with classes.dex inside). Once you know your build is solid and you won't be changing much, it's safer to odex the whole thing (sort of like me, I'm waiting for the final release of eclair for ADP1 so I can put out a Dream rom odexed and fully working).
Thanks once again for taking your time with such complete answers
Click to expand...
Click to collapse
No problem, I get bored at work

So, version .66 is not beta or anything? I know MoDaCo has his latest ROM based on that and you're saying they are only different in the signing key, still, it's somewhat a "leaked" build, not quite "official".
But hey, if others are using it without any issues, maybe I should be using it too

On second thought...
1) I can't find a pre-rooted .66 version and I don't know how to root it :/
2) There's lots of files in system/xbin that I don't see referenced anywhere (not even in the update-script) and I don't know what should I do with them.
I'm finding it much more confusing to base my ROM on .66 than on .38...

It is a beta, of sorts, but between it and the final shipping product there's not much difference. It's just much, much easier to work with it.
1.) The simplest form of root is to change ro.sercure to 0 in default.prop in the boot ramdisk. Adding a su binary/Superuser.apk is optional, those you can pull from one of paul's builds.
2.) The system/xbin is added to the boot classpath in the boot ramdisk in init.rc. The only mention of it in in update-script is the permissions for the whole folder and then just a couple permissions for some tools, not all of them.

Related

[HOWTO] Install Latest WaveSecure in ROM

I found that [email protected]'s ROM had a good idea of adding WaveSecure to the system partition (preventing listing in the My Downloads part of market, and preventing uninstallation through normal means), but his version is slightly out of date now (latest version is 3.0.0.43)
As a result, I set about finding a means to install WaveSecure to ROM myself. Here are my findings for anyone interested in doing the same.
Install the latest version from the market (3.0.0.43 at this time). Now use adb pull to get it off the device onto your pc
Code:
adb pull /data/app/com.wsandroid.apk D:\com.wsandroid.apk
Now open Market back up from the menu, go to My Downloads, and choose Wavesecure Mobile Security Beta and uninstall it for just now (to get it off the data/A2SD location that normal apps are stored in) - thanks, my-space!
Then push the saved apk to the system partition after a remount (to make it read/write)
Code:
adb remount
Code:
adb push D:\com.wsandroid.apk /system/app/com.wsandroid.apk
Then set it all up as usual (will appear in apps list immediately)
and remount system as read only again
Code:
adb remount
And that seems to be it so far. Remember to change the D:\com.wsandroid.apk path to whatever you actually used.
Let me know if anyone finds any problems with this, but I've done it and, fingers crossed, it's worked OK for me.
Obviously, this is only for root users, and there are no guarantees for this.
Couple of questions that might need looked into -
- Do settings carry across after a wipe (as Paul claims Modaco's version does. I've never tried it so can't confirm)
- Is there any disadvantage to using this method? (I guess this is all Modaco's update.zip does, but I don't know)
you forgot to metion to uninstall wavesecure before it is pushed back into system....
my_space said:
you forgot to metion to uninstall wavesecure before it is pushed back into system....
Click to expand...
Click to collapse
Oops! Knew I'd forget something, as I always seem prone to do. Well spotted, and OP corrected.
Thanks
No worries I got a bit confused when i pushed it back onto the phone and was still in my downloads...
I've rooted my phone already but whenever i try to use the command adb remount I get "remount failed: operation not permitted". Suggestions?
I see more and more often, redundant threads.
What How-to will you post next time? How to change backlight settings?
You're pointlessly spamming the board.
I can't say i agree with the 'pointlessly spamming the board' comment, but i would have thought this would at least be better in the applications and themes subforum rather than in development.
Don't forget that an awful lot of android users (and more recently all HTC devices) are more and more 'newbs' and need stuff like this.
While this is good and provides info that people like that need (and myself cos i'm crap at adb and stuff like that so wouldn't have had a clue how to do this previously), maybe the development forum is not the best place for it....
I'm guessing one won't be notified via Market if there's an update available if you push an app to /system/app/, right?
usb0 said:
I'm guessing one won't be notified via Market if there's an update available if you push an app to /system/app/, right?
Click to expand...
Click to collapse
You won't be notified, correct
If anybody doesn't already know, WaveSecure have started hosting update.zip files. This means it's now easy to update your "baked-in" version of WaveSecure without much messing around.
https://www.wavesecure.com/installations/update.zip
Download the file, save it to your SD card, reboot into the recovery console and choose the option to apply an update.zip file.
Voila! Your version of WaveSecure will be updated to the very latest version
DJBenson said:
[...]
Click to expand...
Click to collapse
That's really awesome! Thanks for the tip!
Just a question of curiosity: If I push an app to /system/app/ and then issue the rm-command to remove its apk, won't there be lying a bunch of files associated with the program and with absolutely no function, since the app itself is removed? How do I know the name of these files and where they are located for removal?
I'm a bit confused by that question. My understanding (which may be incorrect but from what I've seen of the "guts of a ROM" appears to be the case) is that the applications reside in the apk files, they are not extracted. If you list the content of any of the app folders (/system/app, /data/app or /data/app-private) then all you get is a bunch of apk files (and some odex files). So when you 'push' an apk to the phone, that application is then "installed", when you rm/remove an application, you do so by removing the apk.
if you remove the apk you have left something in /data/dalvik-cache. wiping the dalvik-cache every now and then helps reclaiming that space, though it is not much.
the app settings and data are stored in /data/data, you could delete the files manually by checking their names (no idea if/what convention the names follow), imho not worth the trouble as it is only a few kb.
odex files aren't created if you don't do in a PITA process manually. don't worry about them, don't touch them, then you're good. odex files are only for system apps.
I bought a used phone and it had WaveSecure already installed. I couldn't find it in the applications list to uninstall, so I did a factory reset on the phone. The application was still there and it still didn't show up in the applications list.
I have the Superuser Permissions application, so someone must have rooted it.
Is there any way to uninstall this?
motomeup said:
I bought a used phone and it had WaveSecure already installed. I couldn't find it in the applications list to uninstall, so I did a factory reset on the phone. The application was still there and it still didn't show up in the applications list.
I have the Superuser Permissions application, so someone must have rooted it.
Is there any way to uninstall this?
Click to expand...
Click to collapse
""Just (re)flash a ROM................""
I just noticed that WaveSecure now points to this post for instructions to install as system application, and I am not sure that the update.zip maintained with them is up-to-date.
However, you can now select to download the .apk directly to your PC thus eliminating the first Market step in this guide.
strife242 said:
I just noticed that WaveSecure now points to this post for instructions to install as system application, and I am not sure that the update.zip maintained with them is up-to-date.
However, you can now select to download the .apk directly to your PC thus eliminating the first Market step in this guide.
Click to expand...
Click to collapse
I believe it is kept up to date, as VillainROM kitchen uses it as a source for the WaveSecure app (fetched each night to keep it up-to-date).
I've certainly never had any problems with it.
Excellent guide Pulser,... I should really reinstall Wavesecure now Im not using a MoDacO Custom ROM. Nice one bruv.
Found this to be helpful.
https://www.wavesecure.com/blog/how-to-make-wavesecure-hard-reset-proof.aspx
I just did a search in the Market fro 'wavesecure' and two things popped up WaveSecure and WaveSecure UninstallProtection Add-on which needs to be uninstalled before WaveSecure and if the add-on is uninstalled it is supposed to lock the phone. (all this is in the description I have yet to try)

[Q] Needed: Idiots guide to updating system apps

In a lot of the custom roms threads I see that people are always asking the cooks to update the system apps as soon as a new one is released.
Rather than us users constantly hassling the cooks to do this, could somebody post an 'idiots' guide how to update the system apps ourselves?
I have seen a few threads about how to remove apps using adb, but none on how to update them.
Any help would be appreciated, not just by the users, but probably by the overworked cooks too
Cheers.
EDIT: by this I mean a way to update the apk in the system folder rather than the date to save space on the phones memory.
One way is to open the market and click on the 'downloads' link at the top and it will give you a list of installed apps and the ones highlighted in red have updates.
Another way is to search the market or a free app called 'aTrackDog' which will check all your apps for updates.
Thanks, but that is not what I meant. I should have made it clearer in my question.
What I want is this: a way to update the applications so that the updated apk goes into the system folder rather than the data folder. That way the update doesn't take up any more of the precious space on my phone.
I'll edit the OP to show this.
But thanks anyway for your help.
Don't you mean the fact that certain apps included in roms cant be updated. Only possible by flashing an updated version of that rom.
Wrong section.
prodygee said:
Don't you mean the fact that certain apps included in roms cant be updated. Only possible by flashing an updated version of that rom.
Click to expand...
Click to collapse
No, that's not true. Often when a cook produces their own rom they will release an "Update pack" when a system app has been updated (such as Flash or Maps). For an example, see here under 'updated system apps':
http://forum.xda-developers.com/showthread.php?t=773997
What I am asking for is if anybody knows how to use adb to update apps on the system partition. When updating from the market a the update takes place on the data folder, not the system one.
Ta.
scutworker said:
No, that's not true. Often when a cook produces their own rom they will release an "Update pack" when a system app has been updated (such as Flash or Maps). For an example, see here under 'updated system apps':
http://forum.xda-developers.com/showthread.php?t=773997
What I am asking for is if anybody knows how to use adb to update apps on the system partition. When updating from the market a the update takes place on the data folder, not the system one.
Ta.
Click to expand...
Click to collapse
do you mean by example
Code:
adb push Vending.apk /system/app
adb reboot
TomLeeDesire said:
do you mean by example
Code:
adb push Vending.apk /system/app
adb reboot
Click to expand...
Click to collapse
That is something like it. What I want is a guide to what to do to update these apps when an update is out in the market place. Something like being able to update the app from the market, but then move the new apk to the system folder so to save space on data.
Thing is, if you're using a cooked ROM you're likely to be using A2SD+ which makes the need to not have system updates redundant as you've got your EXT partition. The other way would just be to edit the original ZIP file and reflash the ROM without a wipe
EddyOS said:
Thing is, if you're using a cooked ROM you're likely to be using A2SD+ which makes the need to not have system updates redundant as you've got your EXT partition. The other way would just be to edit the original ZIP file and reflash the ROM without a wipe
Click to expand...
Click to collapse
That is not entirely true, even though I sport A2SD+ (and it's 1/3 free) my /data is always begging for room... I'm always at the 15MB-free-limit.
Then you've either got a LOT of apps storing data or something's not right
Small dirty 0.1beta guide
I'll use teppic's update zip as example (hope he doesn't mind), sample of his updateapps.zip can be found in this thread -> http://forum.xda-developers.com/showthread.php?t=773997
1. Install the update from Market, then open Appmonster and backup it on SD. After that, uninstall the update, to free up space.
2. Open the update.zip with WinRar (don't unpack it), you'll see 2 folders
META-INF
system
Open the inside of META-INF till you get to update-script and open it for editing, here's the example:
Code:
show_progress 0.1 0
delete SYSTEM:app/YouTube.apk
delete SYSTEM:app/YouTube.odex
delete SYSTEM:app/Facebook.apk
delete SYSTEM:app/Facebook.odex
delete_recursive DATA:data/com.android.vending
copy_dir PACKAGE:system SYSTEM:
set_perm_recursive 0 0 0755 0644 SYSTEM:app
show_progress 0.1 10
Replace/add/remove .apk's (you can add .apk without .odex) in this list, as those commands will delete existing apps from /system/app on phone
The rest of the script will copy the content of the other folder you saw before (system with subfolder app), so you want to add/remove apk's you like to there. Remember to use WinRar's function to add the file to archive, everything done here's is inside of the archive. When you're done, save the update-script, check everything again and close WinRar.
3. Flash the zip ;]
or do it manually:
h_ttp://forum.cyanogenmod.com/topic/8067-how-to-manually-update-system-apps/
EddyOS said:
Then you've either got a LOT of apps storing data or something's not right
Click to expand...
Click to collapse
I do think A LOT fits (about 300 apps installed)...
That's exactly what I wanted.
Thanks for the help, everybody.
Does this work on a Rooted (Unrevoked) phone with HTC's Original Froyo?
- I've been following teppic74's thread for some time now, and for every app that get an updated I get closer to flashing his ROM... but if I can just update my apps I wouldn't have to go through the process of reinstalling everything else after...
gosa said:
Does this work on a Rooted (Unrevoked) phone with HTC's Original Froyo?
- I've been following teppic74's thread for some time now, and for every app that get an updated I get closer to flashing his ROM... but if I can just update my apps I wouldn't have to go through the process of reinstalling everything else after...
Click to expand...
Click to collapse
Sure thing.
thed0g said:
Sure thing.
Click to expand...
Click to collapse
Nice!
That means my weekend is saved, I 'm gonna give myself some updates!
- Thanks!
One thing...if using the push and pull commands in adb to move the apk files to the system partition, what happens to the .odex files? Do you move them as well?
scutworker said:
One thing...if using the push and pull commands in adb to move the apk files to the system partition, what happens to the .odex files? Do you move them as well?
Click to expand...
Click to collapse
.odex files are only on some custom rom's, you probably dont have them.
Hello again...
I kind of never got around to doing this last weekend - both because lack of time but also because the more I read the more worries I have. (Don't know when I lost my "gung ho" attitude, but age seems to turn me into a chicken...)
Anyway - I wanted to ask one important question.
How do I keep an eye on the space I have available for updating my apps? What if the updates are so much larger than the apps I'm replacing, what will happen then?
I read in teppic74's thread that he recommended some adjustments to save space, but how do I know what I have to "play" with? Is there a good app to read available space in "system"?
Thanks in advance,
gosa

[Q] Odexing and dalvik-cache

I have two questions, but they are related, so I thought they could go in one thread:
1. How can I odex the system framework? Odexing the system apps seems to work on the phone, but it freezes when I try to odex the framework. I called the script from userinit.sh instead, but that didn't work either. What is the proper way to do this??
2. For unodexed systems, there is a dalvik cache for data apps in /data/dalvik-cache an also one for system apps and framework in /data/tmpcache/dalvik-cache.
Clear dalvik cache in the boot menu only clears the first one. If the second one was cleared as well, a lot of cases of corruption could be fixed by selecting clear dalvik-cache from the boot menu without needing to wipe data!
The line that does this is line 34 of initrd/./bin/instscripts/cleardalvik
Code:
/bin/rm -Rf /data/dalvik-cache
and "/data/tmpcache/dalvik-cache" needs to be added as well.
Can someone add this, or let me know how and I will do it.
I'll look into question 2 in a bit I can never be arsed with odexing so i'm not very clued up on that, if i'm going to odex a build i usually do it when it is compiled rather then after it is installed. There are others on the forums who odex their builds from a script though so i'm sure someone will be able to help you out.
Ah, so it's a compile option.
I just find that with an odexed build, I never get any "fatal" corruption, I just have to re-enter my email settings in every couple of days, and I can generally use the same build for months without reinstalling.
Then again, 2. might help a bit with this for unodexed builds
Sent from my CyanogenMod Kaiser/Kaiser using XDA App
mmec2 said:
1. How can I odex the system framework? Odexing the system apps seems to work on the phone, but it freezes when I try to odex the framework. I called the script from userinit.sh instead, but that didn't work either. What is the proper way to do this??
Click to expand...
Click to collapse
You might not be following your bootclasspath, which will cause all sorts of nastiness if you try to odex a standing system. The other 2 hangups that I'm aware of would be odexing apks in framework (need big mojo for that. lots of chicken blood.), and odexing files on a seperate partition from where they will run.
To find out what order you need to odex your files in, do:
Code:
echo $BOOTCLASSPATH
and odex in that order first. After those files, you can do the rest in any order.
Just thought i would follow this one up. I pushed your suggestion to git the other day and i have compiled it into a kernel. Whilst testing CM7 yesterday i had to do a hard reboot whilst installing an app and on startup i had data corruption so i cleared the dalvik cache which also cleared /tmpcache and android booted fine so good job on finding that one I've never had success fixing data corruption by clearing dalvik cache before so this is good. Also, it narrowed down what could be the cause of data corruption so i have a few different avenues to explore.
tanimn said:
You might not be following your bootclasspath, which will cause all sorts of nastiness if you try to odex a standing system
Click to expand...
Click to collapse
I was not intentionally following the bootclasspath Actually, I have just had a look at your odexer tool, and I did odex the framework jars in the same order as your program does, but I haven't checked the bootclasspath, so I am probably doing them in the wrong order. Unfortunately, I'm trying out an odexed gingerbread build at the moment, so I can't check whether the bootclasspath was wrong yet. I'll have to flash back and check on Monday! (The bootclasspath order for gingerbread is quite different anyway)
Also, I noticed that you're not zipaligning the apks. Is it not neccessary? Does zip -d take care of that?
The script that I found/modified does a "zipalign -f -v 4" for each apk after removing the classes.dex
scooter1556 said:
Just thought i would follow this one up. I pushed your suggestion to git the other day and i have compiled it into a kernel. Whilst testing CM7 yesterday i had to do a hard reboot whilst installing an app and on startup i had data corruption so i cleared the dalvik cache which also cleared /tmpcache and android booted fine so good job on finding that one I've never had success fixing data corruption by clearing dalvik cache before so this is good. Also, it narrowed down what could be the cause of data corruption so i have a few different avenues to explore.
Click to expand...
Click to collapse
Great! I stumbled on that folder by accident after Gmail.apk and Email.apk stopped working. I knew it was really unlikely that the apks would be corrupted, because system is mounted ro, and clear dalvik didn't work....
Any chance you could upload that kernel?
mmec2 said:
I have two questions, but they are related, so I thought they could go in one thread:
1. How can I odex the system framework? Odexing the system apps seems to work on the phone, but it freezes when I try to odex the framework. I called the script from userinit.sh instead, but that didn't work either. What is the proper way to do this??
Click to expand...
Click to collapse
so the framework-res does not have a classes.dex in it so there is nothing to odex this would be why the script errors out or has no effect, everything else in the framework folder should be able to be odex'd but the framework-res will not
Here you go, this should be the latest .32 kernel with the changes the to dalvik cache wiping
thoughtlesskyle said:
framework-res does not have a classes.dex in it so there is nothing to odex
Click to expand...
Click to collapse
I was only odexing the .jars in /system/framework so that wasn't the problem.
I've been having some problems with gingerbread, and the version I just compiled doesn't work at all, so I have just flashed scoot's 5.5 CM6.1 build and tried odexing it, (before installing any apps) and it all worked!
The last times I tried it crashed every time, but I had been using the build for about a week - maybe last time I already had some data corruption, or an app running in the background caused it to crash.
Oh well, at least I've learnt some more about how Android works!
mmec2 said:
I was not intentionally following the bootclasspath Actually, I have just had a look at your odexer tool, and I did odex the framework jars in the same order as your program does, but I haven't checked the bootclasspath, so I am probably doing them in the wrong order. Unfortunately, I'm trying out an odexed gingerbread build at the moment, so I can't check whether the bootclasspath was wrong yet. I'll have to flash back and check on Monday! (The bootclasspath order for gingerbread is quite different anyway)
Also, I noticed that you're not zipaligning the apks. Is it not neccessary? Does zip -d take care of that?
The script that I found/modified does a "zipalign -f -v 4" for each apk after removing the classes.dex
Click to expand...
Click to collapse
The bootclasspath is different from manufacturer to manufacturer, handset to handset, and sometimes even between different files on the same handset. The most obvious examples of this would be sense and touchwiz, which both rely on a custom bootclasspath.
Zipaligning was removed from version 1.0 of my odexing script as a compatibility check and I never found a pressing reason to add it back in. It is included in the 1.2 beta found later in that thread. As an aside, zip -d does NOT do zipaligning, and in fact often breaks the file alignment.
Even in a perfect environment where dexopt_wrapper completes successfully, the results can still be unuseable. (at least on the epic) Sometimes there is just no way to programmatically replicate the voodoo that is involved in some deodexes...

Understanding the difference.

I'm running 2.1 rooted. I have both 2.2 odex and deodexed versions sitting on my laptop. Not sure which to use am I'm unfamiliar with what the difference between the 2 are.
And when I update to Froyo do I need to flash a custom rom or can I use as comes?
Sent from my Epic 4G - Rooted for My Pleasure!!
I think the odexed and dedexed have to do with the stuff being signed or not, but it doesn't really matter if that's right, because I don't know what the real world diff is. I see that brought up the most in terms of themes not working on one or the other.
When an update comes peole will work that into their stuff. So, whatever rom you choose will probably just get updated itself within a day or two, and then you just flash it more or less the same as any other update to midnight, bonzai, etc.
Searching google turned this up in less than 30 seconds. Since finding the answer was so quicky and easy, I'm just going to copy here instead of taking the time to explain it myself.
WHAT IS AN ODEX FILE?
In Android file system, applications come in packages with the extension .apk. These application packages, or APKs contain certain .odex files whose supposed function is to save space. These ‘odex’ files are actually collections of parts of an application that are optimized before booting. Doing so speeds up the boot process, as it preloads part of an application. On the other hand, it also makes hacking those applications difficult because a part of the coding has already been extracted to another location before execution.
THEN COMES DEODEX
Deodexing is basically repackaging of these APKs in a certain way, such that they are reassembled into classes.dex files. By doing that, all pieces of an application package are put together back in one place, thus eliminating the worry of a modified APK conflicting with some separate odexed parts.
In summary, Deodexed ROMs (or APKs) have all their application packages put back together in one place, allowing for easy modification such as theming. Since no pieces of code are coming from any external location, custom ROMs or APKs are always deodexed to ensure integrity.
HOW THIS WORKS
For the more geeky amongst us, Android OS uses a Java-based virtual machine for running applications, called the Dalvik Virtual Machine. A deodexed, or .dex file contains the cache used by this virtual machine (referred to as Dalvik-cache) for a program, and it is stored inside the APK. An .odex file, on the other hand, is an optimized version of this same .dex file that is stored next to the APK as opposed to inside it. Android applies this technique by default to all the system applications.
Now, when an Android-based system is booting, the davlik cache for the Davlik VM is built using these .odex files, allowing the OS to learn in advance what applications will be loaded, and thus speeds up the booting process.
By deodexing these APKs, a developer actually puts the .odex files back inside their respective APK packages. Since all code is now contained within the APK itself, it becomes possible to modify any application package without conflicting with the operating system’s execution environment.
ADVANTAGES & DISADVANTAGES
The advantage of deodexing is in modification possibilities. This is most widely used in custom ROMs and themes. A developer building a custom ROM would almost always choose to deodex the ROM package first, since that would not only allow him to modify various APKs, but also leave room for post-install theming.
On the other hand, since the .odex files were supposed to quickly build the dalvik cache, removing them would mean longer initial boot times. However, this is true only for the first ever boot after deodexing, since the cache would still get built over time as applications are used. Longer boot times may only be seen again if the dalvik cache is wiped for some reason.
For a casual user, the main implication is in theming possibilities. Themes for android come in APKs too, and if you want to modify any of those, you should always choose a dedoexed custom ROM.
Was this article helpful? If you are confused with some other terms and want us to help explain them, please let us know in the comments.
Click to expand...
Click to collapse
In the future, searching will answer your basic questions a whole lot faster than posting a new thread.

[Q] Question about build sizes

Hi All...
Maybe a dumb question but I need an answer.
I was looking through the rest of the builds on kingshui's sourceforge site and something caught me off-guard.
Apparently he has some /system builds exceeding 100mb (the one I downloaded was 103mb, 98mb in a tarball).
I know with standard kernels we can slide the partition marker to the right and gain some /system space, but I'm currently using Scoot's cache kernel: No partition changing allowed (I guess), but the kernel is so smooth and fluid with my kingshui build.
I guess my question would be this...
Can I remove apps from the app folder to shrink this build to the 100mb limit, or will this cause issues in the build itself?
Edit; it appears to be CGM 5.0.8 RLS11, which is Android 2.1 -update1
DURRR!
Still... it's better to answer for future generations.
The androidinstall.tar has at least on folder in it, named System.
It might have another folder in it, named Data.
It might even have other folders, ignore them for now.
Inside both system, there might be alot of folders (expecially in system), but one of them is called "App". Now, all the apps will be there, along with perhaps a .odex file for everyone.
You can move certains apps from /system/app to /data/app. (if /data does not exists, create /data and app inside it.) You can also remove things from /system/app, if you're not going to use them. Like, CMwallpapers.apk.
PoXFreak said:
Hi All...
Maybe a dumb question but I need an answer.
I was looking through the rest of the builds on kingshui's sourceforge site and something caught me off-guard.
Apparently he has some /system builds exceeding 100mb (the one I downloaded was 103mb, 98mb in a tarball).
I know with standard kernels we can slide the partition marker to the right and gain some /system space, but I'm currently using Scoot's cache kernel: No partition changing allowed (I guess), but the kernel is so smooth and fluid with my kingshui build.
I guess my question would be this...
Can I remove apps from the app folder to shrink this build to the 100mb limit, or will this cause issues in the build itself?
Edit; it appears to be CGM 5.0.8 RLS11, which is Android 2.1 -update1
DURRR!
Click to expand...
Click to collapse
Hey, I learn something new everyday!
I assume this would mean that if I needed to move apps from /system to /data, I would copy the files I wanted from /system/app and make a new folder for /data and put the apps in /data/app, along with the odex files if needed?
I did not know it was that easy. I always had a fear of ruining a build due o mis-matched apps being installed.
PoXFreak said:
Hey, I learn something new everyday!
I assume this would mean that if I needed to move apps from /system to /data, I would copy the files I wanted from /system/app and make a new folder for /data and put the apps in /data/app, along with the odex files if needed?
I did not know it was that easy. I always had a fear of ruining a build due o mis-matched apps being installed.
Click to expand...
Click to collapse
Be advised!!! Not every single package SHOULD/CAN be moved to DATA.
Examples:
Vending.apk -- Market... shouldn't.
Google*.apk -- Can't/Shouldn't
LatinIME.apk - I belive CAN'T.
Also... you never bumped into a release with the data folder already present ?
It's usually made so that you can remove apps by uninstalling them (Default launcher for example, in case you replaced it).
Also... why didn't you experiment ??
Sorry for the late reply, I got hung up in trying to memory map the HTC Raphael...
Anyway, I tend to think of it as "sacrelige" (sp) to mess with what others have already worked hard to build.
I will however take the "system_froyo_us_odex" package and modify it by changing the bootanimation.zip or wallpapers.apk to what I like. I have a CM theme pack (5.0.8 I believe), but I haven't gotten around to messing with it. It does however have a couple of certificates along with it, one being "manifest.cert", whic I really don't want to play with.
My Ubuntu machine doesn't like me since the latest kernel update to 11.04 and working on it has become a bear.
Que sera sera, another laptop needed...
PoXFreak said:
Sorry for the late reply, I got hung up in trying to memory map the HTC Raphael...
Anyway, I tend to think of it as "sacrelige" (sp) to mess with what others have already worked hard to build.
I will however take the "system_froyo_us_odex" package and modify it by changing the bootanimation.zip or wallpapers.apk to what I like. I have a CM theme pack (5.0.8 I believe), but I haven't gotten around to messing with it. It does however have a couple of certificates along with it, one being "manifest.cert", whic I really don't want to play with.
My Ubuntu machine doesn't like me since the latest kernel update to 11.04 and working on it has become a bear.
Que sera sera, another laptop needed...
Click to expand...
Click to collapse
It would be sacrilegio if you would dessecate a rom, and publish it as your own without credits. But for out own use, tweak away Just remember not to come asking on it's respective thread if the errors happening might be introduced with your tampering.
As for themes, it's not really my topic
About ubuntu... what machine are we talking about ?
An old Toshiba with an intel proc and realtek audio. I think it has to do with the touchpad (alps) because the system will freeze until I touch it.
As far as that CGM build, I can't use it becaus I'm set up for Froyo and that build is 2.1 update 1.

Categories

Resources