beginnersguide-androidonomapzoom

Upload: m13marle

Post on 14-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 BeginnersGuide-AndroidonOmapZoom

    1/10

    ANDROID ON OMAP ZOOM

    Prepared By: Govindraj.R (Project Engineer, Wipro Technologies) &

    KiranKumar V M (Project Engineer, Wipro Technologies)

    Reveiwed by:Shivananda Hebbar (Technical Lead, Wipro Technologies)

  • 7/29/2019 BeginnersGuide-AndroidonOmapZoom

    2/10

    Booting Introduction

    The OMAP processor follows a 2 stage boot process. The first stage is loaded into the internal static ramby the ROM code. Because the internal static ram is very small (64k), the first stage loader is needed to

    initialize memory and enough of the peripheral devices to access and load the second stage loader intomain memory. It is the job of the second stage loader to initialize the remaining hardware and prepare thesystem for kernel boot.

    SD Card Boot

    Assuming there was no answer from the host during serial boot, the ROM looks for an SD Card on thefirst MMC controller. If a card is found, the ROM then looks for the first FAT32 partition within the

    partition table. Once the partition is found, the root directory is scanned for a special signed file called"MLO". Assuming all is well with the file, it is transfered into the internal sram and control is passed to it.

    The SDCard x-loader looks for a FAT32 partition on the first MMC controller and scans the top leveldirectory for a file named "u-boot.bin". It then transfers the file into main memory and transfers control toit.

    Formatting the SD Card

    Since putting a Linux file system on a FAT32 partition is problematic, it is recommended to create 2partitions. The first partition is a boot partition between 64-128 Megabytes and the second partition is aLinux partition consuming the rest of the card.

    Plug your SD card into your Linux box - do not mount it. For this example, we will assume the card showsup as /dev/sdc - substitute this for the real device on your specific machine.

    Fdisk the drive and print the partition information

    fdisk /dev/sdcCommand (m for help): pDisk /dev/sdc: 1018 MB, 1018691584 bytes......

    Look for the size in bytes of the device and calculate the number of cylinders, dropping factions, if wehave 255 heads and 63 sectors.

    new_cylinders = Size / 8225280 (for this example we will have 993001472 / 8225280 which equals120.725 or 120 cylinders)

  • 7/29/2019 BeginnersGuide-AndroidonOmapZoom

    3/10

    Since we are changing the underlying geometry of the disk, we must clear the partition table before doingit. So delete all partitions using the fdisk 'd' command - yes, you will lose all data on the card. Once thatis done, we can set the new geometry in expert mode. We will set the # of heads to 255, # of sectors to 63,

    and # of cylinders to new_cylinders.To delete partition use fdisk /dev/sdb1Command (m for help):d

    Even the gparted tool can be used to delete the existing patition on the SD-card.

    Command (m for help): xExpert command (m for help): h

    Number of heads (1-256, default 30): 255Expert command (m for help): s

    Number of sectors (1-63, default 29): 63

    Warning: setting sector offset for DOS compatiblityExpert command (m for help): c

    Number of cylinders (1-1048576, default 2286): 120

    Now we return to the main menu and create our 2 partitions as needed - 1 boot partition of 64Meg and therest a linux partition.

    Expert command (m for help): rCommand (m for help): nCommand actione extended

    p primary partition (1-4)pPartition number (1-4): 1First cylinder (1-123, default 1):Using default value 1Last cylinder or +size or +sizeM or +sizeK (1-123, default 123): +64MCommand (m for help): nCommand actione extended

    p primary partition (1-4)p

    Partition number (1-4): 2First cylinder (10-123, default 10):Using default value 10Last cylinder or +size or +sizeM or +sizeK (10-123, default 123):Using default value 123

    Set the partition type of the first partition to FAT32 and make it active.

    Command (m for help): tPartition number (1-4): 1Hex code (type L to list codes): cChanged system type of partition 1 to c (W95 FAT32 (LBA))

  • 7/29/2019 BeginnersGuide-AndroidonOmapZoom

    4/10

    Command (m for help): tPartition number (1-4): 2Hex code (type L to list codes): 83

    Changed system type of partition 2 to 83 +LINUX

    Command (m for help): aPartition number (1-4): 1

    You have to format 1st partition with vfat32 filesystem.

    You have to format 2nd partition with EXT3 LINUX filesytem

    The partition table should look something like the following. Notice the heads, sectors, and cylinders.

    Make sure partition 1 is active and FAT32. If it looks good - write the new partition information out.

    Command (m for help): pDisk /dev/sdc: 993 MB, 993001472 bytes255 heads, 63 sectors/track, 120 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk identifier: 0x00000000

    Device Boot Start End Blocks Id System/dev/sdc1 * 1 9 72261 c W95 FAT32 (LBA)/dev/sdc2 10 120 891607+ 83 Linux

    Command (m for help): wThe partition table has been altered!

    Calling ioctl() to re-read partition table.

    WARNING: If you have created or modified any DOS 6.xpartitions, please see the fdisk manual page for additionalinformation.Syncing disks.

    Formating the partitions

    Format the filesystems on the partitions

    mkfs.vfat -F 32 -n boot /dev/sdc1mkfs.ext3 /dev/sdc2

    use tune2fs -c 100 /dev/sdc2 /* to increase the maximum mount count */

  • 7/29/2019 BeginnersGuide-AndroidonOmapZoom

    5/10

    Downloading the the OMAP Android Source :

    This repository contains the following:

    1.Android Source.

    2.Omap kernel source for the android.

    3.Omap bootloaders source.(i.e, x-loader and u-boot source).

    How to use Repo to get the Android files, and how to build the files on your machine?

    Setting up your machine:

    To build the Android source files, you will need to use Linux or Mac OS. Building under Windows is notcurrently supported.

    Linux

    The Android build is routinely tested on recent versions of Ubuntu (6.06 and later),

    Ubuntu Linux (i386)

    To set up your Linux development environment, make sure you have the following:

    * Git 1.5.4 or newer and the GNU Privacy Guard.

    $ sudo apt-get install git-core gnupg

    * JDK 5.0, update 12 or higher.

    $ sudo apt-get install sun-java6-jdk

    * The following packages: flex, bison, gperf, libsdl-dev, libesd0-dev, libwxgtk2.6-dev (optional), build-essential, zip, curl.

    $ sudo apt-get install flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curllibncurses5-dev zlib1g-dev

    * You might also want Valgrind, a tool that will help you find memory leaks, stack corruption, arraybounds overflows, etc.

    $ sudo apt-get install valgrind

    Ubuntu Linux (amd64)

    The Android build requires a 32-bit build environment as well as some other tools:

    * Git, JDK, flex, and the other packages as listed above in the i386 instructions:$ sudo apt-get install sun-java6-jdk git-core gnupg flex bison gperf build-essential zip curl* Pieces from the 32-bit cross-building environment:

  • 7/29/2019 BeginnersGuide-AndroidonOmapZoom

    6/10

    $ sudo apt-get install lib32z1-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs

    Other Linux

    There's no reason why Android cannot be built on non-Ubuntu systems. In general you will need:* Python 2.4, which you can download from python.org .

    * JDK 5.0, update 12 or higher, which you can download from java.sun.com .* Git 1.5.4 or newer. You can find it at http://git.or.cz/ .

    Note: repo to download the Android source was done using an ubuntu machine with direct internet

    connection as we faced certain issues while using repo under an proxy internet setting.

    Installing Repo

    Repo is a tool that makes it easier to work with Git in the context of Android. For more information aboutusing Repo and Git refer to the link http://source.android.com/download/using-repo

    To install, initialize, and configure Repo, follow these steps:

    1. Make sure you have a ~/bin directory in your home directory, and check to be sure that this bindirectory is in your path:

    $ cd ~

    $ mkdir bin

    $ echo $PATH

    2. Download the repo script and make sure it is executable:$ curl http://android.git.kernel.org/repo >~/bin/repo

    $ chmod a+x ~/bin/repo

    3. Create an empty directory to hold your working files:

    $ mkdir mydroid

    $ cd mydroid

    4. Run repo init to bring down the latest version of Repo with all its most recent bug fixes. You mustspecify a URL for the manifest:

    $repo init -u git://git.omapzoom.org/repo/android/platform/omapmanifest.git5. When prompted, configure Repo with your real name and email address.

    A successful initialization will end with a message such as

    repo initialized in /mydroid

    Note:

    What is a manifest file?

    The Android source files are divided among a number of different repositories. A manifest file contains a

    mapping of where the files from these repositories will be placed within your working directory when yousynchronize your files.

  • 7/29/2019 BeginnersGuide-AndroidonOmapZoom

    7/10

    Getting the files

    To pull down files to your working directory from the repositories as specified in the default manifest, run

    $ repo sync

    Building the codeThe below steps generate only the Android filesystem then we have to build the kernel and the boot loader.

    To build the files, run make from within your working directory:

    Setting the ANDROID_JAVA_HOME env var to $JAVA_HOME before making.

    $ export ANDROID_JAVA_HOME=$JAVA_HOME

    $ cd ~/mydroid

    $cp vendor/ti/ldp1/buildspec.mk.default buildspec.mk

    $ make -j2

    Copying Android root filesystem to Sd card:

    Now we have Built the Android Filesystem:

    The root filesystem is available in the following directory:

    /mydroid/out/target/product/ldp1/

    You need to copy the contents of root folder to the second patition on the SD card:

    wipro@wipro-desktop:/mydroid/out/target/product/ldp1/root$ sudo cp -rf * /media/disk-2/

    Also we need to copy the contents of the system folder to the root filesystem.

    wipro@wipro-desktop:/mydroid/out/target/product/ldp1/system$ sudo cp -rf * /media/disk-2/system/

    Also we need to copy data folder to root filesystem:

    wipro@wipro-desktop:/mydroid/out/target/product/ldp1/data$ sudo cp -rf * /media/disk-2/data/

    Note: For porting the application developed using the Android SDK (i.e, the *.apk file generated on

    an succesfull execution of an application using SDK) can be copied to /media/disk-2/data/app/ or

    /media/disk-2/system/app/ location.

  • 7/29/2019 BeginnersGuide-AndroidonOmapZoom

    8/10

    Generating binaries for boot partition on SD card:Now we have the Android root filessytem ready next is to build the following:

    1. X-loader

    2. u-boot

    3. Kernel

    Toolchain required to compile the above can be downloded from below link:

    http://www.codesourcery.com/gnu_toolchains/arm/releases/2007q3

    Select ARM GNU/Linux and IA32 GNU/Linux options.

    *Note : Tool chain requires glibc 2.3.0 or higher to compile

    Building x-loader:

    wipro@wipro-desktop:/mydroid/bootloader/x-loader$ make CROSS_COMPILE=/arm-2007q3/bin/arm-none-linux-gnueabi- distclean

    wipro@wipro-desktop:/mydroid/bootloader/x-loader$ make CROSS_COMPILE=/arm-2007q3/bin/arm-

    none-linux-gnueabi- omap3430labrador_config

    wipro@wipro-desktop:/mydroid/bootloader/x-loader$ make CROSS_COMPILE=/arm-2007q3/bin/arm-none-linux-gnueabi-

    wipro@wipro-desktop:/mydroid/bootloader/x-loader$ cp x-load.bin x-load-nand.bin

    wipro@wipro-desktop:/mydroid/bootloader/x-loader$ ./../../vendor/ti/support-tools/boot/omap3430gp-

    signer.pl x-load-nand.bin x-load-nand-signed.bin

    Now we can copy the x-load-nand-signed.bin file to first partition i.e the boot partition of the SD card:

    wipro@wipro-desktop:/mydroid/bootloader/x-loader$ sudo cp x-load-nand-signed.bin/media/disk-1/MLO

    http://www.codesourcery.com/gnu_toolchains/arm/releases/2007q3http://www.codesourcery.com/gnu_toolchains/arm/releases/2007q3
  • 7/29/2019 BeginnersGuide-AndroidonOmapZoom

    9/10

    Building u-boot:

    wipro@wipro-desktop:/mydroid/bootloader/u-boot$ make CROSS_COMPILE=/arm-2007q3/bin/arm-none-linux-gnueabi- distclean

    wipro@wipro-desktop:/mydroid/bootloader/u-boot$make CROSS_COMPILE=/arm-2007q3/bin/arm-none-linux-gnueabi- omap3430labrador_config

    wipro@wipro-desktop:/mydroid/bootloader/u-boot$make CROSS_COMPILE=/arm-2007q3/bin/arm-none-linux-gnueabi-

    Now we can copy the u-boot.bin file to first partition i.e the boot partition of the SD card:

    wipro@wipro-desktop:/mydroid/bootloader/u-boot$ sudo cp u-boot.bin /media/disk-1/

    Now we have to build the mkimage tool which is used during the Kernel build process.

    wipro@wipro-desktop:/mydroid/bootloader/u-boot$make CROSS_COMPILE=/arm-2007q3/bin/arm-

    none-linux-gnueabi- tools

    wipro@wipro-desktop:/mydroid/bootloader/u-boot$export PATH=$PATH:/mydroid/bootloader/u-boot/tools/

    Building the Kernel:

    wipro@wipro-desktop:/mydroid/kernel$make CROSS_COMPILE=/arm-2007q3/bin/arm-none-linux-

    gnueabi- distclean

    wipro@wipro-desktop:/mydroid/kernel$make CROSS_COMPILE=/arm-2007q3/bin/arm-none-linux-gnueabi- omap_ldp_android_defconfig

    wipro@wipro-desktop:/mydroid/kernel$make CROSS_COMPILE=/arm-2007q3/bin/arm-none-linux-gnueabi- uImage

    wipro@wipro-desktop:/mydroid/kernel$ sudo cp arch/arm/boot/uImage /media/disk-1/uImage.bin

  • 7/29/2019 BeginnersGuide-AndroidonOmapZoom

    10/10

    Note: Kernel version obtained from repo process is 2.6.26, Alternatively any other kernel version requiredcan also be downloaded from the link

    http://git.omapzoom.org/?p=omapkernel.git;a=summary

    Booting up the Android using the SD card on Omap zoom:

    We may require to use an virtual terminal software like tera term or minicom for giving the bootargs:

    Set up the Virtual terminal with the following data:

    Bps/Par/Bits : 115200 8N1

    Once you get bootloader prompt (OMAP34XX LAB #)

    Give the following arguments in the bootloader prompt

    OMAP34XX LAB #setenv bootfile=uImage.bin;saveenv;setenv bootargs console=ttyS2,115200n8

    root=/dev/mmcblk0p2 init=./init rw wsize=1024,rsize=1024 ip=none rootdelay=2mem=128M;saveenv;mmcinit;fatload mmc 0 80c00000 uImage.bin;bootm 80c00000

    Now you get the Android on the omap zoom board.

    REFERENCES:

    http://source.android.com/download/using-repo

    http://source.android.com/download

    https://omapzoom.org/gf/project/omapandroid/wiki/?pagename=FrontPage

    http://git.omapzoom.org/

    http://source.android.com/download/using-repohttp://source.android.com/downloadhttps://omapzoom.org/gf/project/omapandroid/wiki/?pagename=FrontPagehttp://git.omapzoom.org/http://source.android.com/download/using-repohttp://source.android.com/downloadhttps://omapzoom.org/gf/project/omapandroid/wiki/?pagename=FrontPagehttp://git.omapzoom.org/