Building Android 4.2.2 BSP on ZC702
Table of Contents
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.git
Once 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 zynq
user@local-machine $ export PATH=/opt/Xilinx/14.5/ISE_DS/EDK/gnu/arm/lin64/bin:$PATH
user@local-machine $ export ARCH=arm
user@local-machine $ export CROSS_COMPILE=arm-xilinx-linux-gnueabi-
user@local-machine $ make xilinx_zynq_android_defconfig
user@local-machine $ make uImage modules UIMAGE_LOADADDR=0x8000
The 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.dtb
This 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.dtb
This 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.dts
For 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.dts
Both 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/repo
user@local-machine $ chmod a+x ~/bin/repo
user@local-machine $ mkdir -p ~/scm/android
user@local-machine $ cd ~/scm/android
user@local-machine $ repo init -u git:git.iveia.com/xilinx2/android/platform/manifest.git -b zynq-android-2.0
user@local-machine $ repo sync
user@local-machine $ repo forall -c git checkout aosp/aosp/master
To determine the list of available branches for Android:
user@local-machine $ git clone git:git.iveia.com/xilinx2/android/platform/manifest.git
user@local-machine $ cd manifest
user@local-machine $ git branch -r
origin/HEAD -> origin/master
origin/android-1.6_r1
origin/android-1.6_r1.1
origin/android-1.6_r1.2
origin/android-1.6_r1.3
. . .
origin/zynq-android-2.0
origin/froyo
origin/gingerbread
origin/gingerbread-release
origin/ics-mr0
origin/ics-mr1
origin/master
origin/tradedef
origin/tradefed
Select 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.sh
user@local-machine $ lunch full-eng
user@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/generic
ROOT_IMG:=root.img
ROOTFS:=rootfs
ROOT_DIRS=lib/modules tmp media mnt sdcard
.PHONY: dummy
$(ROOT_IMG): dummy
rm -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 make
dummy:
Now, build the root.img file:
user@local-machine $ make -f Makefile.zynq
This 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/sd
mount /dev/mmcblk0p1 /media/sd
mount /dev/mmcblk0 /media/sd
echo "++ Starting init.sh script on SD card"
if [ -f /media/sd/init.sh ]; then
. /media/sd/init.sh
fi
- Unmount and recompress the image
© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy