Building_XDANDROID_From_Source
The XDANDROID source tree is currently kept as close as possible to the official Android open-source tree. We include several small, simple fixes to allow some components to work (or behave as expected) in the absence of closed-source Google components.
Building the XDANDROID source tree will be very similar to building an official Android system from source. Because of that similarity, it is important to have an understanding of the Android build process.
After familiarizing yourself with the basics of AOSP and repo, you can set up your local source tree:
mkdir myxdandroid ; cd myxdandroid– You may name this directory whatever you want, and put it wherever you want
curl https://android.git.kernel.org/repo >~/bin/repo
chmod a+x ~/bin/repo
~/bin/repo init -u git://gitorious.org/xdandroid-eclair/manifest.git
~/bin/repo sync– This step will download all the source code repositories for the tree and will take a long time
One the repo sync command is finished, you may configure your local source tree to build an XDANDROID system.
The build system is configured via a single buildspec.mk file in the root of the source tree (the myxdandroid directory from the example above). We use this file to tell the build system what kind of device we’re going to build for, as well as some other tunable options.
The XDANDROID project has provided its own vendor tree in the source code, along with a device configuration. Since these devices are not yet prepared for a completely-working Android environment, we also want an engineering build, so we can use the debugging facilities that the system provides. Adding the following lines will direct the build system to use that configuration:
TARGET_PRODUCT := xdandroid_msm_us
TARGET_BUILD_VARIANT := eng
TARGET_BUILD_TYPE := release
Many of the devices supported by the XDANDROID project are similar in architecture to the T-Mobile G1 (also the Android Dev Phone). For this reason, we will grab some proprietary bits from the G1/ADP. This step requires a firmware image from the device which can be downloaded at http://developer.htc.com/adp.html. You’ll need the signed-dream_devphone_userdebug-ota-14721.zip package, saved to the Android source root directory (myxdandroid). OPTIONAL: To include Google applications dumped from the Nexus One, download the gapps-passion package from http://www.mediafire.com/?mjmmfmm0jez and place it in the root directory as well.
- (From
myxdandroid)cd vendor/xdandroid/msm
./unzip-files.sh
The proprietary bits (and optionally, the Google apps) will be unpacked into the vendor source tree. Before building, there are some more options that can be added to the buildspec.mk file to enhance your build. Notably, you may build Android’s dalvik VM with a just-in-time compiler to accelerate execution. Additionally, if you unpacked the Google Apps, you may enable installation of those to the system image. Finally, you may want to build EXT2 images, instead of YAFFS, for simplicity.
WITH_JIT := true – Enable Dalvik JIT compiler
USE_GOOGLE_APPS := true – Install Google Apps
TARGET_USERIMAGES_USE_EXT2 := true – Build ext2 images
The XDANDROID build system is now finally configured. Build the system with the following, exceedingly simple, make command:
make -j3 – Increase -j for more cores to build faster. I use -j5 on a quad-core machine.
After this is finished, you’ll have images (under the myxdandroid directory) in out/target/product/msm/. The critical one is system.img. If you built an ext2 image, you can copy it directly to your SD card as system.ext2. Otherwise, you can mount it loopback and create a SquashFS image, then copy to the SD card as system.sqsh.
Other buildspec.mk Tunables
See Buildspec.mk Options for a list of XDANDROID switches that can be set in buildspec.mk, with a description of what each one does.

