Android Panda Build Source

From OMAPpedia

Jump to: navigation, search

Contents

[edit] Android on PandaBoard Build From Source

Here we will take a look at Building Android from Source for PandaBoard.

[edit] Tools & Dependency packages

Pre-requisite packages for building the Android Filesystem (Note this is with reference to Ubuntu 10.04 64-bit). Ubuntu 64-bit is required by Ice Cream Sandwich.

If you are behind firewall, you will have to set-up firewall using the instructions in [1]


The following commands will install the correct packages to your server:

sudo apt-get install git-core flex bison gperf libesd0-dev zip libwxgtk2.6-dev zlib1g-dev build-essential tofrodos x-dev 
sudo apt-get install lib32readline5-dev libstdc++6 lib32z1 lib32z1-dev ia32-libs g++-multilib libx11-dev libncurses5-dev 

Add the partner repositories and install the JDK:

sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk

Install Linaro Image Creation Tools: Since linaro image tools are not backward compatible, please download and use the below mentioned version of the Linaro Image creation tools if you are going to build from Linaro:

http://releases.linaro.org/12.06/components/platform/linaro-image-tools/linaro-image-tools-2012.06.tar.gz

Install latest repo tool:

mkdir ~/bin -p
sudo apt-get install curl
curl 
chmod a+x ~/bin/repo
export PATH=~/bin:$PATH

Command to get repo version:

repo --version
Should be repo version v1.7.8.2 or higer.

If you do not have sudo rights to your machine, contact your System Administrator for assistance.


Tool Chain for building Kernel and Drivers

The Kernel and Driver sources are built using Sourcery G++ Lite 2010q1-202 for ARM GNU/Linux version.

This tool chain can be obtained from

2010q1-202

NOTE: Must use this specific version to avoid internal compiling errors.

[edit] Building from AOSP master branch

AOSP supports panda as a build target on the master branch. Please visit http://android.googlesource.com for more details. In general follow below steps to get the AOSP source code and build it for PandaBoard. AOSP includes pre-built kernel, u-boot and x-loader on it's master branch.

The device/ti/panda/README also contains instructions on building and installing the software onto a SD card.

  $ mkdir ~/bin
  $ PATH=~/bin:$PATH
  $ curl  > ~/bin/repo
  $ chmod a+x ~/bin/repo
  $ mkdir WORKING_DIRECTORY
  $ cd WORKING_DIRECTORY
  $ repo init -u https://android.googlesource.com/platform/manifest -m default.xml
  $ repo sync
  # Get the latest SGX package
  $ wget -p -nd 
  $ tar zxf imgtec-panda-imm76i-67545da7.tgz
  $ ./extract-imgtec-panda.sh
  $ . build/envsetup.sh
  $ lunch full_panda-userdebug
  $ make -j4

[edit] Building from Linaro

Follow below steps to build Android ICS from Linaro. When you do repo sync as mentioned below then you get kernel source also in the kernel folder.

   $ export MANIFEST_REPO=git://android.git.linaro.org/platform/manifest.git
   $ export MANIFEST_BRANCH=linaro_android_4.0.4
   $ export MANIFEST_FILENAME=landing-panda.xml
   $ mkdir android
   $ cd android
   $ repo init -u ${MANIFEST_REPO} -b ${MANIFEST_BRANCH} -m ${MANIFEST_FILENAME}
   $ repo sync
   $ wget --no-check-certificate http://android-build.linaro.org/download/linaro-android_toolchain-4.7-bzr/lastSuccessful/archive/build/out/android-toolchain-eabi-4.7-daily-linux-x86.tar.bz2
   $ tar -jxvf android-toolchain-eabi-4.7-daily-linux-x86.tar.bz2
   # On Ubuntu 11.10 I had to get the below gcc version to be used as the host compiler:
   $ sudo apt-get install gcc-4.4 g++-4.4 g++-4.4-multilib gcc-4.4-multilib 
   $ export NUM_PROC=`getconf _NPROCESSORS_ONLN`
   $ export TARGET_PRODUCT=full_panda
   $ . build/envsetup.sh
   $ make -j${NUM_PROC} HOST_CC=gcc-4.4 HOST_CPP=cpp-4.4 HOST_CXX=g++-4.4 TARGET_SIMULATOR=false TARGET_TOOLS_PREFIX=/bin/arm-linux-androideabi- boottarball systemtarball userdatatarball showcommands > build_log_YYMMDD.txt 2>&1 &
   # Create media (this assumes your SD card is /dev/sdX, replace with your device name)
   $ sudo ./linaro-image-tools/linaro-android-media-create --dev panda --mmc /dev/sdX --system out/target/product/panda/system.tar.bz2 --userdata out/target/product/panda/userdata.tar.bz2 --boot out/target/product/panda/boot.tar.bz2 
   # Get graphics binaries
   $ wget http://people.linaro.org/~vishalbhoj/install-binaries-4.0.4.sh
   $ chmod a+x install-binaries-4.0.4.sh
   $ ./install-binaries-4.0.4.sh /dev/sdX2 "device node of system partition"

Note: Wifi, bluetooth, YouTube, jpeg, video playback (both .mp4 and .3gp), and audio playback (both .mp3 and .aac) all have been verified as working in this release.

The binaries (boot.tar.bz2, system.tar.bz2, userdata.tar.bz2 as well as linaro-image-tools and install-binaries are also available from the gforge site

The following boards were tested OK:

On the following boards these binaries DO NOT WORK:

Troubleshooting

While building from source, if you encounter an error as shown below, please follows the steps mentioned here to solve it:

linux-androideabi/4.7.3/armv7-a/libgcc.a out/target/product/panda/obj/lib/crtend_so.o
system/media/wilhelm/src/assert.c:24: error: undefined reference to '__android_log_assert'
system/media/wilhelm/src/assert.c:31: error: undefined reference to '__android_log_assert'
collect2: error: ld returned 1 exit status
make: *** [out/target/product/panda/obj/SHARED_LIBRARIES/libOpenMAXAL_intermediates/LINKED/libOpenMAXAL.so] Error 1
make: *** Waiting for unfinished jobs....
system/media/wilhelm/src/assert.c:24: error: undefined reference to '__android_log_assert'
system/media/wilhelm/src/assert.c:31: error: undefined reference to '__android_log_assert'
collect2: error: ld returned 1 exit status
make: *** [out/target/product/panda/obj/SHARED_LIBRARIES/libOpenSLES_intermediates/LINKED/libOpenSLES.so] Error 1


Please see the patch below to solve the above error:

diff --git a/wilhelm/src/Android.mk b/wilhelm/src/Android.mk
index 6da321a..d5765c6 100644
--- a/wilhelm/src/Android.mk
+++ b/wilhelm/src/Android.mk
@@ -207,7 +207,8 @@ LOCAL_PRELINK_MODULE := false
LOCAL_MODULE_TAGS := optional
LOCAL_CFLAGS += -x c++ -DLI_API= -fvisibility=hidden -UNDEBUG \
                -DSL_API='__attribute__((visibility("default")))'
-LOCAL_SHARED_LIBRARIES := libwilhelm
+LOCAL_SHARED_LIBRARIES := libwilhelm \
+                          libutils
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
@@ -222,5 +223,6 @@ LOCAL_PRELINK_MODULE := false
LOCAL_MODULE_TAGS := optional
LOCAL_CFLAGS += -x c++ -DLI_API= -fvisibility=hidden -UNDEBUG \
                -DXA_API='__attribute__((visibility("default")))'
-LOCAL_SHARED_LIBRARIES := libwilhelm
+LOCAL_SHARED_LIBRARIES := libwilhelm \
+                          libutils
include $(BUILD_SHARED_LIBRARY)

[edit] Building the kernel from source

[edit] Buildling Linaro Kernel

Identify the exact build you're interested in, e.g.:

https://android-build.linaro.org/builds/~linaro-android/leb-panda/#build=90

Look at the pinned-manifest.xml. That manifest contains the exact revisions that were used for all the sub-gits. Look for the kernel:

Find the remote "linaro":

Synthesize the git clone command line:

git clone git://git.linaro.org/people/asac/android/kernel/pandroid -b 062684a2a23eae7f3f0b93b437aaa4429f5fbe0c

Now browse build log, accessible by "Log: complete output" link on build's page. (It may be easier to save to your computer, though Ctrl+F also works.)

$ grep ARCH=arm consoleText.txt TARGET_ARCH=arm

       make ARCH=arm CROSS_COMPILE=/mnt/jenkins/workspace/linaro-android_leb-panda/build/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- defconfig panda_defconfig &&\
       make ARCH=arm CROSS_COMPILE=/mnt/jenkins/workspace/linaro-android_leb-panda/build/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- uImage

Those are your build command for kernel, you will reuse them.

Now look in the pinned manifest for the prebuilt subproject, which contains toolchain (caveat: there might be separate Linaro toolchain used instead, describe such case too).

This is using the default remote:

Construct the clone call:

git clone git://android.git.kernel.org/platform/prebuilt -b 671c1cd3e5c89891cadd615e53484df904ac1810

Fix up the build lines:

TARGET_ARCH=arm

       make ARCH=arm CROSS_COMPILE=prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- defconfig panda_defconfig &&\
       make ARCH=arm CROSS_COMPILE=prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- uImage

and build.

[edit] Building AOSP kernel

Below steps would get you AOSP kernel source code and build.

   git clone https://android.googlesource.com/kernel/omap
   cd omap
   git checkout remotes/origin/android-omap-panda-3.0
   make ARCH=arm CROSS_COMPILE= mrproper
   make ARCH=arm CROSS_COMPILE= panda_defconfig
   make uImage

[edit] Building x-loader and u-boot

U-boot and xloader are availalbe from mainline u-boot. Follow below instructions to build them.

  git clone git://git.linaro.org/boot/u-boot-linaro-stable.git
  cd u-boot-linaro-stable.git
  make CROSS_COMPILE=arm-none-linux-gnueabi- omap4_panda
  # Replace the CROSS_COMPILE with the name of your compiler

After the compile is done you should see two files named MLO and u-boot.img. u-boot.img is same as u-boot.bin with some header information. Copy the MLO file as MLO in the boot partition of the SD and copy the u-boot.img as u-boot.bin in the boot partition of the SD card.

[edit] Install AOSP Images

Follow the instructions in the devices/ti/panda/README file to format the SD card, put the Panda board into fastboot mode, and installing the filesystem images.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox