Building Linux
PLEASE NOTE: Some steps are known to be out-of-date. We are working on updates.
This section details the steps to build the Android 4.2.2 BSP for ZC702 board. All commands displayed on this page are executed on an Ubuntu 10.04 x86_64 Linux system.
This solution is not directly supported by Xilinx. For questions and help about this solution, please contact iVeia at http://git.iveia.com/support
Getting the Linux Source
The Linux source is stored as a Git repository on iVeia's Git server. To clone the Linux Git repository:
user@local-machine $ git clone git://
git.iveia.com/xilinx2/xilinx/android/kernel/zynq.gitOnce cloned, Git can be used to manage the source tree. See the Git documentation for more information.
Build Steps
The Linux source has been built and tested with the Xilinx Arm Compiler Toolchain for ARM GNU/Linux. This toolchain is included in the Xilinx ISE packages.
To build the Linux kernel binary, add the toolchain to your PATH and setup required environment variables. Then, run "`make`" to build the binary, as follows:
user@local-machine $ cd zynquser@local-machine $ export PATH=/opt/Xilinx/14.5/ISE_DS/EDK/gnu/arm/lin64/bin:$PATHuser@local-machine $ export ARCH=armuser@local-machine $ export CROSS_COMPILE=arm-xilinx-linux-gnueabi-user@local-machine $ make xilinx_zynq_android_defconfiguser@local-machine $ make uImage modules UIMAGE_LOADADDR=0x8000The kernel binary will be located at arch/arm/boot/uImage.
Building the Device Tree Blobs using the make utility:
For the FMC-HMI adapter, run the following:
user@local-machine $ make ARCH=arm zynq-zc702-android-fmc.dtbThis makes the file arch/arm/boot/dts/zynq-zc702-android-fmc.dtb. Remember to copy this file to the card and rename it to devicetree.dtb.
For the HDMI interface, run the following:
user@local-machine $ make ARCH=arm zynq-zc702-android-hdmi.dtbThis makes the file arch/arm/boot/dts/zynq-zc702-android-hdmi.dtb. Remember to copy this file to the card and rename it to devicetree.dtb.
Building the Device Tree Blobs using provided scripts:
For the FMC-HMI adapter, run the following:
user@local-machine $ scripts/dtc/dtc \-I dts -O dtb \-o devicetree.dtb \arch/arm/boot/dts/zynq-zc702-xylon-fmc.dtsFor the onboard HDMI interface, run the following:
user@local-machine $ scripts/dtc/dtc \-I dts -O dtb \-o devicetree.dtb \arch/arm/boot/dts/zynq-zc702-xylon-hdmi.dtsBoth the uImage and devicetree.dtb files are required to boot the ZC702. In addition, the correct BOOT.BIN must be wrapped and selected corresponding to the interface used (FMC-HMI or onboard HDMI), as described in the Binaries section of Android On Zynq Getting Started Guide.
Building Android
Getting the Android Source
The following instructions assume the user will obtain the Android source code from iVeia's Git server that has been configured to mirror Google's Android Open Source (AOSP) code. Please see Google's
http://source.android.com/ AOSP site for more information on building Android.
Obtain the desired version of Android from the local mirror:
user@local-machine $ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repouser@local-machine $ chmod a+x ~/bin/repouser@local-machine $ mkdir -p ~/scm/androiduser@local-machine $ cd ~/scm/androiduser@local-machine $ repo init -u git:git.iveia.com/xilinx2/android/platform/manifest.git -b zynq-android-2.0user@local-machine $ repo syncuser@local-machine $ repo forall -c git checkout aosp/aosp/masterTo determine the list of available branches for Android:
user@local-machine $ git clone git:git.iveia.com/xilinx2/android/platform/manifest.gituser@local-machine $ cd manifestuser@local-machine $ git branch -rorigin/HEAD -> origin/masterorigin/android-1.6_r1origin/android-1.6_r1.1origin/android-1.6_r1.2origin/android-1.6_r1.3. . .origin/zynq-android-2.0origin/froyoorigin/gingerbreadorigin/gingerbread-releaseorigin/ics-mr0origin/ics-mr1origin/masterorigin/tradedeforigin/tradefedSelect the desired branch name from the list and use that name for the "-b" parameter in the "`repo init ...`" command. Note that the "`repo sync`" command will fail if not all Android projects contain the specified branch.
Build Steps
Building the Android source can take an hour or more, depending on the CPU and memory characteristics of the development machine. Navigate to the project root directory and run the following:
user@local-machine $ . build/envsetup.shuser@local-machine $ lunch full-enguser@local-machine $ make -j<N>where <N> is the number of cores on your building machine multiplied by two. (i.e. A quad core machine would use make -j8)
Create an ext2 root.img file for loading on the SD card. For this step, you'll need the "`genext2fs`" utility installed (provided by the genext2fs package on Ubuntu). First, make a new file at the project root directory, Makefile.zynq, containing the following text:
OUT_DIR:=out/target/product/genericROOT_IMG:=root.imgROOTFS:=rootfsROOT_DIRS=lib/modules tmp media mnt sdcard.PHONY: dummy$(ROOT_IMG): dummyrm -rf $@sudo rm -rf $(ROOTFS)cp -r $(OUT_DIR)/root $(ROOTFS)cp -r $(OUT_DIR)/system $(ROOTFS)cd $(ROOTFS) && mkdir -p $(ROOT_DIRS)sudo chown -R root:root $(ROOTFS)sudo genext2fs -d $(ROOTFS) -b $$((250*1024)) -m 0 -N $$((64*1024)) $(ROOT_IMG)sudo chown $(shell id -u):$(shell id -g) $(ROOT_IMG)# Phony target forces the rootfs image file to be rebuilt on each makedummy:Now, build the root.img file:
user@local-machine $ make -f Makefile.zynqThis image file is to be mounted locally and copied to the second partition of the SD card.
Ramdisk
The ramdisk (also refered to as an initrd (Initial RamDisk)) is provided by Xylon, but has modifications to mount the SD card under a different directory for other uses. The ramdisk also allows Android to boot automatically when the init.sh script is present on the SD card.
To modify the Xylon provided ramdisk to work with the android build on the ZC702 following the instructions at
http://www.wiki.xilinx.com/Build+and+Modify+a+Rootfs, these changes need to be made:
- Modify the file etc/init.d/rcS to remove the "Mounting SD card" section at the end and replace with:
echo "Mounting SD card to /media/sd"mkdir -p /media/sdmount /dev/mmcblk0p1 /media/sdmount /dev/mmcblk0 /media/sdecho "++ Starting init.sh script on SD card"if [ -f /media/sd/init.sh ]; then. /media/sd/init.shfi- Unmount and recompress the image