Seabright Technology Header Image

Building dalvik by itself

Just some notes for now. After following the instructions at http://source.android.com/download you’ll have a local copy of the full android source code. We’re only interested in dalvik so we’ll skip building the rest.

First switch to the 1.5 release tag. The first version that I pulled had a typo that stopped the build.  To do this, change to the dalvik directory, list the tags, then change to the 1.5r2 tag
cd dalvik
git tag
git checkout android-1.5r2

According to dalvik/docs/hello-world.html, we can set up the local environment to build a x86 debug release. Change back to the top directory and run:
. build/envsetup.sh
choosecombo Simulator debug sim eng

Note that this command and many others are defined in envsetup.sh.

We can now build individual directories using mm to build the module in the current directory.

Try:
cd dalvik/vm
mm
cd ../dalvikmm
mm

On my system this gave me a libdvm.so in out/debug/host/linux-x86/product/sim/obj/lib/libdvm.so and a executable in out/debug/host/linux-x86/product/sim/obj/EXECUTABLES/dalvikvm_intermediates/dalvikvm. To run, change to the top directory and run:

export LD_LIBRARY_PATH=$PWD/out/debug/host/linux-x86/product/sim/obj/lib
./out/debug/host/linux-x86/product/sim/obj/EXECUTABLES/dalvikvm_intermediates/dalvikvm

E/dalvikvm(22399): ERROR: must specify non-'.' bootclasspath
W/dalvikvm(22399): JNI_CreateJavaVM failed
Dalvik VM init failed (check log file)

It looks like I had most of the system already built from an earlier top level make. The next step is to take the source back to the 1.5r2 tag and build everything for linux-x86.

The lesson for today was the ‘mm’ command. I couldn’t make head nor tail of the rest of the build system. The top level main.mk is 699 lines by itself.

Leave a Reply