Building and Packaging

From The XDAndroid Project
Jump to: navigation, search

With a configured source tree, building and packaging is a somewhat painless process. There are a couple of preliminary steps to do for optional portions of the system (such as Google apps). However, most of the time spent with the build process is waiting for compilation.

NOTE The following build procedures are for the froyo branch and newer. For eclair build procedures, please see Building and Packaging Eclair.

Before commencing with the complete build, it may be necessary to provide dependencies for the system.

Build Dependencies

XDAndroid runs on hardware similar to the HTC G1 and Android Dev Phone. As a result, XDAndroid takes advantage of the similarities by using certain proprietary libraries as provided by the reference system for the Dev Phone. Before building the system, download the Dev Phone system image, signed-dream_devphone_userdebug-ota-14721.zip, is available here or Google it. Place the zip file in the root of your XDAndroid source tree and do not extract it.

Hardware-accelerated 3D graphics are also available using a proprietary driver originally developed for the HTC Dream. A new driver compatible with gingerbread and later releases, supporting OpenGL-ES version 1.1, is available for download. Place that zip in the root of your XDAndroid source tree and do not extract it.

Camera support requires a modified proprietary binary library, and the system will not build without this library. A zip file containing the library is available as liboemcamera.zip. Place that zip in the root of your XDAndroid source tree and do not extract it.

Additionally, XDAndroid optionally allows installation of Google's proprietary programs. These programs provide the most popular common features of Android systems. It is usually recommended to install these. A script, located in the device/xdandroid repository of the AOSP build tree, will automatically download the currently-supported Google Apps package, then extract it and configure the build tree to use it. (BookPhone.apk is missing from gapps package and is available here or Google it then put it into vendor/xdandroid/msm/proprietary)

With the needed packages stored in the XDAndroid root, run a script to automatically extract the files and configure the build system: <syntaxhighlight lang="bash"> $ cd device/xdandroid/msm $ ./unzip-files.sh -g # Use -g to download the Google Apps package. </syntaxhighlight>

The files will be extracted and available to the build system.

Building the System

This highly convoluted step will eventually spit out a number of filesystem images, including one containing the XDAndroid system.

To build the system, execute the following extremely complicated command from the root directory of the XDAndroid source tree...

<syntaxhighlight lang="bash"> $ make -j4 # A -jX argument based on the number of CPUs available, plus one, is recommended. </syntaxhighlight>

NOTE When building a froyo image, it may be necessary to add /sbin to your PATH, if building ext2 filesystem images. If so, use the following command instead: PATH="${PATH}:/sbin" make -j4

After several weeks, the build will be complete and the system is ready for packaging.

Recent versions of Ubuntu (after 10.04 AFAIK) have a pitfall when building. Edit build/core/combo/HOST_linux-x86.mk:

   -HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0
   +HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0

Packaging the System

The Android build system, which hopefully went off without a hitch, will have generated a number of filesystem images in out/target/product/msm under the root directory of the source tree.

Until development of the system has progressed to the point where the system can be flashed to the phone's integrated flash storage, most of the generated images are of no concern. The most interesting image is system.img, which contains the binaries generated by the compilation process.

If the recommendations given in Build Configuration have been followed, the filesystem images will be ext2. This is usable as-is with the current boot process that the XDAndroid project uses, and it can be renamed system.ext2 and placed in the user's andboot directory for a successful boot.

Optionally, the system image can be repacked as a SquashFS file system, for smaller size. Instructions on completing this step will follow shortly. [1]