0% found this document useful (0 votes)
87 views

BeginnersGuide AndroidonOmapZoom

This document provides instructions for setting up an Android build environment on Linux, downloading the Android source code using Repo, building the Android filesystem, and copying it to an SD card to boot Android on an OMAP Zoom board. It describes formatting the SD card with two partitions, one for boot files and one for the Linux filesystem. It also explains using Repo to initialize, sync, and build the Android source tree to generate the root filesystem, then copying that filesystem to the second partition on the SD card.

Uploaded by

m13marle
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
87 views

BeginnersGuide AndroidonOmapZoom

This document provides instructions for setting up an Android build environment on Linux, downloading the Android source code using Repo, building the Android filesystem, and copying it to an SD card to boot Android on an OMAP Zoom board. It describes formatting the SD card with two partitions, one for boot files and one for the Linux filesystem. It also explains using Repo to initialize, sync, and build the Android source tree to generate the root filesystem, then copying that filesystem to the second partition on the SD card.

Uploaded by

m13marle
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 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)

Booting Introduction The OMAP processor follows a 2 stage boot process. The first stage is loaded into the internal static ram by 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 into main memory. It is the job of the second stage loader to initialize the remaining hardware and prepare the system 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 the first 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 level directory for a file named "u-boot.bin". It then transfers the file into main memory and transfers control to it.

Formatting the SD Card Since putting a Linux file system on a FAT32 partition is problematic, it is recommended to create 2 partitions. The first partition is a boot partition between 64-128 Megabytes and the second partition is a Linux 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 shows up as /dev/sdc - substitute this for the real device on your specific machine. Fdisk the drive and print the partition information fdisk /dev/sdc Command (m for help): p Disk /dev/sdc: 1018 MB, 1018691584 bytes ...<more>... Look for the size in bytes of the device and calculate the number of cylinders, dropping factions, if we have 255 heads and 63 sectors. new_cylinders = Size / 8225280 (for this example we will have 993001472 / 8225280 which equals 120.725 or 120 cylinders)

Since we are changing the underlying geometry of the disk, we must clear the partition table before doing it. So delete all partitions using the fdisk 'd' command - yes, you will lose all data on the card. Once that is 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/sdb1 Command (m for help):d Even the gparted tool can be used to delete the existing patition on the SD-card. Command (m for help): x Expert command (m for help): h Number of heads (1-256, default 30): 255 Expert command (m for help): s Number of sectors (1-63, default 29): 63 Warning: setting sector offset for DOS compatiblity Expert 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 the rest a linux partition. Expert command (m for help): r Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-123, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-123, default 123): +64M Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (10-123, default 10): Using default value 10 Last 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): t Partition number (1-4): 1 Hex code (type L to list codes): c Changed system type of partition 1 to c (W95 FAT32 (LBA))

Command (m for help): t Partition number (1-4): 2 Hex code (type L to list codes): 83 Changed system type of partition 2 to 83 +LINUX Command (m for help): a Partition number (1-4): 1
You You

have to format 1st partition with vfat32 filesystem. 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): p Disk /dev/sdc: 993 MB, 993001472 bytes 255 heads, 63 sectors/track, 120 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk 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): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: If you have created or modified any DOS 6.x partitions, please see the fdisk manual page for additional information. Syncing disks.

Formating the partitions


Format the filesystems on the partitions mkfs.vfat -F 32 -n boot /dev/sdc1 mkfs.ext3 /dev/sdc2 use tune2fs -c 100 /dev/sdc2 /* to increase the maximum mount count */

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 not currently 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), buildessential, zip, curl. $ sudo apt-get install flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev * You might also want Valgrind, a tool that will help you find memory leaks, stack corruption, array bounds 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:

$ 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 about using 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 bin directory 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 must specify a URL for the manifest:

$repo init -u git://git.omapzoom.org/repo/android/platform/omapmanifest.git


5. 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 you synchronize your files.

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 code


The 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.

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/armnone-linux-gnueabi- distclean wipro@wipro-desktop:/mydroid/bootloader/x-loader$ make CROSS_COMPILE=/arm-2007q3/bin/armnone-linux-gnueabi- omap3430labrador_config wipro@wipro-desktop:/mydroid/bootloader/x-loader$ make CROSS_COMPILE=/arm-2007q3/bin/armnone-linux-gnueabiwipro@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/omap3430gpsigner.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

Building u-boot:
wipro@wipro-desktop:/mydroid/bootloader/u-boot$ make CROSS_COMPILE=/arm-2007q3/bin/armnone-linux-gnueabi- distclean wipro@wipro-desktop:/mydroid/bootloader/u-boot$make CROSS_COMPILE=/arm-2007q3/bin/armnone-linux-gnueabi- omap3430labrador_config wipro@wipro-desktop:/mydroid/bootloader/u-boot$make CROSS_COMPILE=/arm-2007q3/bin/armnone-linux-gnueabiNow 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/armnone-linux-gnueabi- tools wipro@wipro-desktop:/mydroid/bootloader/u-boot$export PATH=$PATH:/mydroid/bootloader/uboot/tools/

Building the Kernel:


wipro@wipro-desktop:/mydroid/kernel$make CROSS_COMPILE=/arm-2007q3/bin/arm-none-linuxgnueabi- distclean wipro@wipro-desktop:/mydroid/kernel$make CROSS_COMPILE=/arm-2007q3/bin/arm-none-linuxgnueabi- omap_ldp_android_defconfig wipro@wipro-desktop:/mydroid/kernel$make CROSS_COMPILE=/arm-2007q3/bin/arm-none-linuxgnueabi- uImage wipro@wipro-desktop:/mydroid/kernel$ sudo cp arch/arm/boot/uImage /media/disk-1/uImage.bin

Note: Kernel version obtained from repo process is 2.6.26, Alternatively any other kernel version required can 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=2 mem=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/

You might also like