[TOOL] DEXO – universal odex tool | HOW-TO move lib to /system/lib without reflash

amidabuddha

Senior Member
Jun 26, 2011
2,441
2,458
0
DISCLAIMER: I am not the author of this tool!

All credits goes to tommytomatoe and you can press thanks in this thread because there is no dedicated thread for DEXO @xda (at least I found none)​
Why does it give better battery life? Thank you.
Because it splits the .apk (app package) into two parts, the .apk and a .odex file. Usually, for the phone to use an app, it has to decompile the .apk and get the parts it needs to run the app. With the odex files, which stands for "Optimized Dex" the startup time is much faster since the phone doesn't have to perform any optimizing at startup/runtime, and because of that, it also uses less CPU power, and thus makes it faster, smoother, and battery life is increased. :)
OK. So what is this tool?

This tool doesn’t deal with partially odexed ROMs. This tool is for odexing a ROM that is completely DEODEX.

The benefits? Faster boot, smaller imprint on /data/ partition, overall faster feeling

The myths? I can’t theme ODEX! WRONG! You can theme odex just fine! Just use baksmali and smali.
Requirements:
Of the author:
  1. adb
  2. Linux, Mac OS X, Windows
  3. Android device with busybox
  4. Four minutes of your day
Added by me:
  • You have finally settled on a ROM that you want to use for some time without an intention to modify it further
  • You will need about 100 MB free space on system (my free space decreased from 160 MB to 96 MB after the completion of the process) To free some you can delete some apps from /system/app or move them to /data/app with a root file explorer (do not forget to set the correct permissions afterwards) or even better: to move your /system/lib folder to the lib partition without reflashing the ROM (see below for details)
  • Tested on Fallout 5.0 and Virtuous Infinity 1.35 with my Tweaked3 8.6 kernel. If you are using this it is at your own will and risk
  • NOT WORKING on CoolDroid and Sabsa Prime 6.5, probably because they have mixed framework from different Sense versions! Do not do on other similar ROMs only on ones with an original (even modded) framework!
Procedure:
Go here and read carefully. It is basically some adb commands.
Out of respect to the author I will not mirror his link nor the instructions​
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
How to free about 120 MB space on /system by moving the lib folder to its dedicated partition without reflashing the ROM

This is only for ICS Sense ROMs. AOSP ROMs have enough free space to run the script without issues. I am not sure about the GB Sense ROMs, but if I remember correct they have enough free space on /system too. (if I am wrong please PM me to add GB Sense boot.img)
Requirements:

  • Bootloader with /system/lib support: 2.xx or 7.xx
  • 150 MB free space on your SDcard
  • adb drivers installed (link in my signature)
  • 4EXT Recovery (or any other recovery that has a menu entry for mounting /system/lib partition)
  • good attention while copy/paste the commands from here. One typo will lead to a bootloop
Download Tweaked3: XI_lib_bootimg.zip
md5sum: 1bc1d645b8212cdb2e4e949c6b7b3312
Download Patched: 3089_lib_bootimg.zip
md5sum: f1ae0228eb4057b4e4c4934a1e8a0515​
The zips contain boot images of my Tweaked3 and Patched kernels with /system/lib support (I am not advertising them but this are the files I have ready, you can use a Stock kernel as well). There are 4 of them:
  • Sense4_lib_boot.img - for ALL Sense 4 ROMs (except VIrtuous Infinity)
  • Sense36_exp_lib_boot.img - for custom Sense 3.6 ROMs with experimental WiFi driver (Experimental kernel)
  • Sense36_lib_boot.img - for custom Sense 3.6 ROMs with stock WiFi driver (Stable kernel)
  • Virtuous_lib_boot.img - the name speaks for itself
Extract the archive in the folder where your fastboot executable is. This is not a flashable zip!​
or
Download 2: b2b_lib_bootimg.zip
md5sum: 4bb4d44506eae5f247b69f9c5663e3a8​
The zip contains boot images of my B2B kernel with /system/lib support (I am not advertising it but this are the files I have ready, you can use a Stock kernel as well). There are 2 of them:
  • Sense4_lib_boot.img - for ALL Sense 4 ROMs (except VIrtuous Infinity)
  • Sense36_lib_boot.img - for custom Sense 3.6 ROMs
Extract the archive in the folder where your fastboot executable is. This is not a flashable zip!​
NOTE: your ROM has to be on the same version of the kernel before the procedure, otherwise your WiFi will stop working. Or you will need to download the zip from the kernel thread and copy the modules to /system/lib/modules manually giving them right permissions (644 or -rw-r--r--)​
Procedure:
# Connect the device to PC, open Command Prompt (cmd) and browse to the folder where are your adb and fastboot executables are (example: cd C:\android-tools)

# Reboot to Recovery (4EXT recommended)
Code:
adb reboot recovery
# Make a Nandroid backup

# Mount manually /system and /sdcard from the "mounts | storage" menu of the Recovery

# Copy the content of /system/lib to the SDcard
Code:
adb shell
mkdir /sdcard/system
cp -r /system/lib /sdcard/system
# Clean /system/lib
Code:
rm -r /system/lib
# Recreate empty /system/lib and set permissions
Code:
mkdir /system/lib
chmod 755 /system/lib
# Unmount manually /system from the "mounts | storage" menu of the Recovery

# Mount manually /system_lib from the "mounts | storage" menu of the Recovery

# Copy the lib contents to /system/lib
Code:
cp -r /sdcard/system/lib/* /system_lib
# Set permissions to /system/lib
Code:
cd /system_lib
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

[I]# Creating symlinks [COLOR=Red]Only for Virtuous Infinity![/COLOR][/I]

ln -s libhtc_ril.so librilswitch.so
cd hw
ln -s copybit.msm8660.so copybit.msm7x30.so
ln -s gralloc.msm8660.so gralloc.msm7x30.so
ln -s lights.msm8660.so lights.msm7x30.so
# Remove the SDcard /system/lib folder
Code:
rm -r /sdcard/system
exit
# Unmount manually /system_lib and /sdcard from the "mounts | storage" menu of the Recovery

# Reboot to bootloader
Code:
adb reboot bootloader
# Flash the boot.img and reboot
Code:
fastboot erase boot
fastboot flash boot XXX_lib_boot.img
fastboot reboot
Now you can use the tool above without concerns about free space

Enjoy!
 
Last edited:

amidabuddha

Senior Member
Jun 26, 2011
2,441
2,458
0
if a rom is zipaligned, doesn't this mean that there's no need being odexed - kind of same thing? (same performance, battery life...)
Zipaligning is about better RAM utilization. Odexing is about reducing the Dalvik VM which in theory should reduce CPU use and make the system run smoothly. You can watch the video, it is made by one of the Elite Recognized Developers of XDA so this guy probably knows what he is talking about. Moreover ALL Stock ROMs are odexed and I am sure that the companies developers are not just too lame to use it for nothing :)
 
Last edited:

amidabuddha

Senior Member
Jun 26, 2011
2,441
2,458
0
Was a hard task to get enough space free.
Let's see how it works now.
Yes this may be an issue with the bigger ROMs. The easiest way is to move some app that you use rarely to /data/apps

The other way is to use the lib partition but this needs ramdisk modification and a hboot that supports it. It is not hard I may add a small how-to if more users want to use this tool

Sent from my HTC Desire S
 
Last edited:

mackhenri

Senior Member
Jul 25, 2011
633
217
73
Mumbai
Yes this may be an issue with the bigger ROMs. The easiest way is to move some app that you use rarely to /data/apps

The other way is to use the lib partition but this needs ramdisk modification and a hboot that supports it. It is not hard I may add a small how-to if more users want to use this tool

Sent from my HTC Desire S
Get it on buddy.....I am ready to try whatever u make as you seem to give life to my phone once again and all the devs here and I am become a flashaholic...

Sent from my HTC Desire S using xda premium
 

kwisatz79

Senior Member
Jun 24, 2011
70
29
48
Hamburg
The other way is to use the lib partition but this needs ramdisk modification and a hboot that supports it. It is not hard I may add a small how-to if more users want to use this tool
This would b great, I did it once for Fallout with one of your kernel ramdisks, but it was not so trivial and a pain in the a** doing this all by hand. Though it worked perfectly, I don't remember every step I did, and mayb I didn't do it the elegant way, as I'm not very experienced.

As far as I remember the complicated part was unpacking kernel+ramdisk, modifing ramdisk, repacking everything and signing it. But this has to be done only once (by one idividual) for every kernel (+ramdisk). The rest ist more or less flashing and copying from /system to /system/lib partition (can be done in recovery easily). The latter mayb realised with one single script installer for every kernel (and rom) I guess. But here I also lack the experince with script installers, elsewise I would have shared the info.

I did it on Windows with bootimg-tools via Cygwin (unpacking, repacking), with SignApk on cmd (signing), in recovery (flashing, copying). For flashing I guess fastboot is more elegant (reflashed whole rom with mod boot.img). For the rest I didn't found something more convinient, but maybe soemone can enlighten me.
 
  • Like
Reactions: amidabuddha

kwisatz79

Senior Member
Jun 24, 2011
70
29
48
Hamburg
Thx, the new guide worked like a charm for me on Fallout v5.0.0 with your kernel v8.5. I think it is more or less what I did, when it worked for me before. Also the odexing stuff worked well. What I am just wondering about, as this is odexing Rosie, will this affect the Fallout Tweaks for Rosie? And I tended to use Titanium Backup to merge updated system apps (like Facebook) into rom (essentially moving to system I guess), are there any drawbacks doing it with odexed apps?
 
  • Like
Reactions: amidabuddha

amidabuddha

Senior Member
Jun 26, 2011
2,441
2,458
0
Thx, the new guide worked like a charm for me on Fallout v5.0.0 with your kernel v8.5. I think it is more or less what I did, when it worked for me before. Also the odexing stuff worked well. What I am just wondering about, as this is odexing Rosie, will this affect the Fallout Tweaks for Rosie? And I tended to use Titanium Backup to merge updated system apps (like Facebook) into rom (essentially moving to system I guess), are there any drawbacks doing it with odexed apps?
All apps will work the same way after odexing. I can confirm all Rosie tweaks in Fallout working.
As per the Titanium stuff I have no idea try it and let us know :)

Sent from my HTC Desire S
 
  • Like
Reactions: kwisatz79