How to partially create Android source code?

I modified Dalvik VM and I was wondering if there is a way that I can only build Dalvik VM from Android source code.

If I can build the Dalvik VM separately, how can I add the modified Dalvik VM to the Android system?

+6
source share
1 answer

Once you have completed the initial assembly (I assume that you have completed the steps described here: http://source.android.com/source/building.html ), you can only build Dalvik VM by doing

$ make libdvm 

When the assembly is complete, you will see that something like

 Install: out/target/product/generic/system/lib/libdvm.so 

This is the newly built Dalvik VM (or, more specifically, the library that implements the Dalvik VM). The last part of the exit path where the installed file is expected, in this case /system/lib/libdvm.so . To install a new virtual machine, first make sure you are root and then remount the system partition

 $ adb root adbd is already running as root $ adb remount remount succeeded 

Now you can push the new virtual machine into the system:

 $ adb push out/target/product/generic/system/lib/libdvm.so /system/lib/libdvm.so 

Please note that if you run the emulator, this change is not permanent, as the emulator reloads system.img every time it starts. However, on the device, the change will be permanent. In addition, since Android preloads a process called Zygote, which is later used for fork application processes, you need to reboot the system to use the new VM in applications

 $ adb reboot 

You can actually rebuild virtually all of the Android components this way. General steps:

  • Find Android.mk in the source tree for the component you want to rebuild
  • Find the name of the module. In the case of Dalvik VM, the line looks like this: LOCAL_MODULE := libdvm
  • make name of the module that libdvm for Dalvik VM
  • The embedded file will be declared at the output of the assembly and will begin with Install: 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 built-in file in the running Android system. The destination path is the last part of the output file path, which in the case of dalvik is /system/lib/libdvm.so
+12
source

Source: https://habr.com/ru/post/902176/


All Articles