Android 2.3.1 For 5-Series

This page will collect the information used to build Android 2.3.1 for 5-Series EK board.

Getting Started

In order to get familiar with the working environment of development on Android, it's highly recommended Getting Started Page shall be read firstly.

AT91Bootstrap

AT91Bootstrap is the first step bootloader which provides a set of algorithms to manage hardware initialization (GPIO, Clock, SDRAM, etc), to download your main application from specified FLASH media to main memory and to start it.

In the Android4SAM pre-built demo it is used to configure the hardware and to load and start the standard U-Boot bootloader, it can also be configured to start Linux kernel directly.

For more information, Please goto the AT91Bootstrap application note.

Source code or patches

Description Resource URL Size
AT91Bootstrap SAM9x5_at91bootstrap.tar.gz (~ 1.3 MB)

Load AT91Bootstrap on SAM9 Boards (NandFlash booting only)

  • See here for reference

Build AT91Bootstrap

For SD Card Booting

  1. Change to your working directory
    $ cd YOUR_WORKING_DIR
  2. Get the source code of AT91Bootstrap
    $ wget ftp://ftp.linux4sam.org/pub/Android4SAM/9x5/v1.2/Patches/SAM9x5_at91bootstrap.tar.gz
  3. Decompress the package
    $ tar zxvf SAM9x5_at91bootstrap.tar.gz && cd at91bootstrap
  4. Setup environment variable
    $ export ARCH=arm
    $ export CROSS_COMPILE=/path/to/your/crosstoolchain/bin/arm-none-linux-gnueabi-
    
  5. Configure AT91Bootstrap
    $ make mrproper && make at91sam9x5sd_defconfig
  6. Build AT91Bootstrap
    $ make
  7. Format one SD Card to FAT32
    
    
  8. Copy binaries/at91sam9x5ek-sdcardboot-3.0.bin to SD card and rename it to boot.bin

Warning, important In Linux environment, you may need to name the booting image as BOOT.BIN

Warning, important In order to boot from SD card, the MCU ROM code has two assumptions,

  • The first partition of the SD Card is formated with FAT or FAT32
  • The bootstrap file is named with "boot.bin" and is copied into the first partition

For NandFlash Booting

  1. Get the source code of AT91Bootstrap
    $ wget ftp://ftp.linux4sam.org/pub/Android4SAM/9x5/v1.2/Patches/SAM9x5_at91bootstrap.tar.gz
  2. Decompress the package
    $ tar zxvf SAM9x5_at91bootstrap.tar.gz && cd at91bootstrap
  3. Setup environment variable
    $ export ARCH=arm
    $ export CROSS_COMPILE=/path/to/your/crosstoolchain/bin/arm-none-linux-gnueabi-
    
  4. Configure AT91Bootstrap
    $ make mrproper && make at91sam9x5nf_kernel_defconfig
  5. Build AT91Bootstrap
    $ make
  6. Format one SD Card to FAT32
    
    
  7. The final image can be found as binaries/at91sam9x5ek-nandflashboot-3.0.bin
  8. Flash the final image to your EK board, as mentioned above


Linux Kernel 2.6.35

Introduction

Android4SAM kernel is based on Linux kernel 2.6.35, with AT91 patch and Android experimental patch applied orderly.

Official Linux 2.6.35

Linux Kernel Version Vanilla Kernel
Linux 2.6.35 linux-2.6.35.tar.bz2

Source code or patches

Description Resource URL Size
Patch for 5-Series on Linux 2.6.35 SAM9x5_linux-2.6.35.diff (~ 0.6 MB)
Patch for Android on 5-Series EK SAM9x5_linux-2.6.35_Android-2.3.1_r1.diff (~ 3.4 MB)

Build Linux Kernel

  1. Export environment variables
    $ export ARCH=arm
    $ export CROSS_COMPILE=/path/to/your/crosstoolchain/bin/arm-none-linux-gnueabi-
    
  2. Download official 2.6.35 Linux Kernel
    $ cd YOUR_WORKING_DIR
    $ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.35.tar.bz2
    $ tar xvjf linux-2.6.35.tar.bz2
    
  3. Apply 5-Series patchset
    $ wget ftp://ftp.linux4sam.org/pub/Android4SAM/9x5/v1.2/Patches/SAM9x5_linux-2.6.35.diff
    $ cd linux-2.6.35 && cat ../SAM9x5_linux-2.6.35.diff | patch -p1
    $ cd ..
    
  4. Apply Android4SAM patchset
    $ wget ftp://ftp.linux4sam.org/pub/Android4SAM/9x5/v1.2/Patches/SAM9x5_linux-2.6.35_Android-2.3.1_r1.diff
    $ cd linux-2.6.35 && cat ../SAM9x5_linux-2.6.35_Android-2.3.1_r1.diff | patch -p1
    
  5. Configure and Build Linux Kernel
    • Booting from SDCard
      $ make mrproper
      $ make at91sam9x5_android_defconfig
      $ make uImage
      
    • Booting from Nandflash (UBIFS) Warning, important You need to build Android before this step
      Build Android, see Here
      $ make mrproper
      $ cp -a YOUR_WORKING_DIR/Android-$ANDROID_VERSION/out/target/product/sam9x5/root ./
      $ make ARCH=arm at91sam9x5_android_ubifs_defconfig
      $ make uImage
      
  6. After successful building, you can find Linux image(U-Boot format) in: arch/arm/boot/uImage


Android Root File System

Setup Build Machine

Host System

  • Google recommends recent versions of 64bits UBuntu (10.04 or newer)

Necessary Packages

  • Python 2.4 -- 2.7, which you can download from python.org
  • JDK 6 if you wish to build Gingerbread or newer
    $ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
    $ sudo add-apt-repository "deb-src http://archive.canonical.com/ubuntu lucid partner"
    $ sudo apt-get update
    $ sudo apt-get install sun-java6-jdk
  • Git 1.5.4 or newer. You can find it at git-scm.com
  • GNU Make - Google recommends make 3.81
    note.gif GNU Make 3.82 will even prevent Android system from building
  • (optional) Valgrind, a tool that will help you find memory leaks, stack corruption, array bounds overflows, etc. Download from valgrind.org
  • Other packages
    $ sudo apt-get install git-core gnupg flex bison gperf build-essential \
    zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
    x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \
    libgl1-mesa-dev g++-multilib mingw32 tofrodos
note.gif The official Android Page shall always be taken as a reference

Get Android Source Code

* Downaload Android source code from official web server
    • Make sure you have a bin/ directory in your home directory, and that it is included in your path:
      $ mkdir ~/bin
      $ export PATH=~/bin:$PATH
    • Download the Repo script and ensure it is executable:
      $ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
      $ chmod a+x ~/bin/repo
    • Initializing a Repo client
      $ mkdir ANDROID_DIR
      $ cd ANDROID_DIR
    • Run repo init to get latest version of repo
      repo init -u https://android.googlesource.com/platform/manifest
    • Checkout Android 2.3.1-r1
      $ repo init -u https://android.googlesource.com/platform/manifest.git -b android-2.3.1_r1
    • Download all files
      $ repo sync

note.gif The official Android Page shall always be taken as a reference

Apply Patches

Description Resource URL Size Features
Android source code patch SAM9x5_Android-2.3.1_r1.tar.gz (~ 2.6 MB)
  • Add the touchscreen calibration application to Android
  • Add IP configure application to Android
  • Make music work well under Android
  • Modify code to use Android's own screen-lock
  • Add configuration files for Android system initialization and ALSA system
  • Add customized apk for Android system

  • Download AT91 Android patches
    $ cd ANDROID_DIR/device
    $ wget ftp://ftp.linux4sam.org/pub/Android4SAM/9x5/v1.2/Patches/SAM9x5_Android-2.3.1_r1.tar.gz
    $ tar zxvf SAM9x5_Android-2.3.1_r1.tar.gz
    

Configure and Build Android

  • Setup Environment
    $ cd ANDROID_DIR/
    $ source build/envsetup.sh
    $ partner_setup uninstall
    $ partner_setup sam9x5
    $ choosecombo Device release sam9x5 eng
    
  • Build Android
    $ make clean
    $ make -j8   # Assume your workstation has 8 CPU cores
    

Generate Android Root Filesystem (UBIFS)

  • Download helper script
    $ wget ftp://ftp.linux4sam.org/pub/Android4SAM/9x5/v1.2/Tools/Generate_ubifs_image.tar.gz
    $ cp Generate_ubifs_image.tar.gz ANDROID_DIR/
    $ cd ANDROID_DIR/
    $ tar zxvf Generate_ubifs_image.tar.gz
    
  • Run script
    # cd Generate_ubifs_image
    $ ./ubifs.sh -b sam9x5
    
  • After successful building, you'll get system_ubifs-at91sam9x5ek–ANDROID -2.3.1_r1.img and userdata_ubifs-at91sam9x5ek-ANDROID-2.3.1_r1.img

Generate Android Root Filesystem (SDCard Booting)

  • Download helper script
    $ wget ftp://ftp.linux4sam.org/pub/Android4SAM/9x5/v1.2/Tools/Generate_sdcard_image.tar.gz
    $ cp Generate_sdcard_image.tar.gz ANDROID_DIR/
    $ cd ANDROID_DIR/
    $ tar zxvf Generate_sdcard_image.tar.gz
    
  • Insert one SDCard to your Linux workstation (Size recommended, >= 2G)
  • Run script
    $ cd Generate_sdcard_image
    # Note, you should specify correct device file for your SDCard
    $ ./sdimage.sh -b sam9x5 -s /dev/sdc
    
Warning, importantCaution!! The SD card device node depends on your Linux host, here we take /dev/sdc as an example.

Use UBIFS image files

Pre-Built demo images

Description Resource URL Size
Booting from NandFlash Android-2.3.1_r1.tar.gz (~ 107 MB)

  • Replace system_ubifs-at91sam9x5ek–ANDROID -2.3.1_r1.img and userdata_ubifs-at91sam9x5ek-ANDROID-2.3.1_r1.img in the demo package
  • Run flashing script to flash all image files to Evaluation Board. For details, see here
  • Reboot the Evaluation Board, your new Android Root Filesystem will take effect

Use SDCard image files

Pre-Built demo images

Description Resource URL Size
Booting from SDCard Android-2.3.1_r1-sd.img.tar.bz2 (~ 40 MB)

  • In order to program SDCard using the prebuilt image, please have a look at here

-- EricXu - 2011-09-28

r5 - 04 Jan 2012 - 01:19:28 - VoiceShen
 
Android4SAM

Copyright by the contributing authors. All material on the platform is the property of the contributing authors.

Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions

Atmel and others, are registered trademarks or trademarks of Atmel or its subsidiaries.This site is powered by the TWiki collaboration platform

ARM and others are registered trademarks or trademarks or ARM Ltd. Other terms and product names may be trademarks of others.

Under the terms of the Creative Commons Attribution License

Syndicate this siteRSS ATOM