Saturday, January 30, 2010

Building Android Emulator on SMP Fedora 12

I was trying to build Android Eclair Emulator on a Fedora 12 SMP system. By making use of SMP support in make utility I was able to build the emulator much faster.

See the cpu utilizations graphs below. When we use of make without any SMP options, cpu utilization graph will come as below.

 
where one cpu is utilized to the maxium and other is not much used. But if you provide SMP options to make, then cpu utilization graph will change like what is below.

Now both the cpu's are utilized to the maximum. Now I will explain the steps and some tricks involved in compiling Eclair branch of Android on system with non standard java installation. Non standard java installation means, you have a system where java version is not 1.5, like my system where installed java version is 1.6 

[nmathew@Devel Desktop]$ java -version
java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.6) (fedora-33.b16.fc12-i386)
OpenJDK Client VM (build 14.0-b16, mixed mode)

Android requires java 1.5 i.e. because dalvik currently understands only the code generated by java 1.5, I think Android developers are adding support for Java 1.6.
Now we will start with it. You can follow the steps mentioned here. In order to sync eclair branch you must use repo init -u git://android.git.kernel.org/platform/manifest.git -b eclair. repo sync command will take some time. After that we need to setup the java 1.5 environment. For that first we need to download and install the java JDK  from sun site. Install in any of the local directory by just running java_ee_sdk-5_01-linux.bin directly. Now we need to export the JAVA path. 

export JAVA_HOME=/media/_workspace/android/java_cc
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jdk/bin:$JAVA_HOME/jdk/jre/bin:$PATH
export ANDROID_JAVA_HOME=$JAVA_HOME

Now issue the following commands
./build/envsetup.sh
make -jN where N is the number of physical cpu cores in the system. For my case N was 2.

After completion of compilation you can execute following commands to run the emulator.
cd ./out/host/linux-x86/bin/
./emulator -system /media/_workspace/android/out/target/product/generic/ -kernel /media/_workspace/android/prebuilt/android-arm/kernel/kernel-qemu -data /media/_workspace/android/out/target/product/generic/userdata.img

Now you can see something like below.








No comments:

Post a Comment