I have been modifying Dalvik VM and I was wondering if there is a way that I can build only Dalvik VM from android source code.
If I can build Dalvik VM separately then how can I add the modified Dalvik VM to Android system?
Once you have done the initial build (I am assuming you have followed the steps described here: http://source.android.com/source/building.html), you can build just the Dalvik VM by doing
$ make libdvm
When the build is done, you will see some output near that looks something like
Install: out/target/product/generic/system/lib/libdvm.so
This is the newly built Dalvik VM (or more specifically, the library in which the Dalvik VM is implemented). The last part of the out path is where the installed file is expected, in this case /system/lib/libdvm.so
. To install your new VM, first ensure you are root and then remount the system partition
$ adb root
adbd is already running as root
$ adb remount
remount succeeded
you can now push the new VM to the system:
$ adb push out/target/product/generic/system/lib/libdvm.so /system/lib/libdvm.so
Note that if you run the emulator, this change is not permanent, since the emulator reloads system.img
each time it starts. On a device however, the change will be permanent. Also, since Android preloads a process called Zygote that is later used to fork application processes, you need to reboot the system to make the new VM be used in applications
$ adb reboot
You can actually rebuild virtually all Android components this way. The general steps are
Android.mk
in the source tree for the component you wish to rebuildLOCAL_MODULE := libdvm
make
the module name, which is libdvm
for Dalvik VMInstall:
. In the case of the Dalvik VM, this is Install: out/target/product/generic/system/lib/libdvm.so
adb root
and adb remount
, then adb push
the built file to a running Android system. The destination path is the last part of the out file path, which in the case of dalvik is /system/lib/libdvm.so
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With