Porting of Android On Beagle board

View previous topic View next topic Go down

Porting of Android On Beagle board

Post  Admin on Tue Mar 05, 2013 2:33 am

Porting of Android On Beagle board

2.Hardware requirement.
3.Software requirement.
4.Beagle board.
6.Building Kernel Image.
7.Building Android File system.
8.Building Linux file system with Android file system.
9.Setting Up The Boot Parameters and Booting the Linux kernel
10.Script file to start android services.
11.Flashing the NAND


Android is a software stack for mobile devices that includes an operating system, middleware and key applications. To learn more about android check the below link http://developer.android.com/guide/basics/what-is-android.html. Android stack
uses Linux-2.6 kernel. Since this project is porting Android on Beagle board, the linux-2.6 kernel added a full support for Beagle board and its peripherals and android specific subsystems.

2.Hardware requirement

1. Beagle Board Rev-B6.
2. Null Modem Serial Cable.
3. S-video cable.
4. Mini-B to A USB cable.
5. SD/MMC card.
6. SD/MMC card Reader.
7. Monitor with S-video support.(Or TV tuner card with S-video support).

3.Software requirement

1. Linux kernel (2.6_kernel_revb-v2.tar.gz -
Beagle board based).
2. Android Patch – Patching above kernel to get android specific supports.
3. Linux File System – ramdisk image (ALSA-FS).
4. Android file system. Extracted form emulator discussed below.
5. Arm Toolchain – cross compiler(arm-2007q3-51-arm-none-linux-
6. Script file to start android services.

4.Beagle Board

BeagleBoard, a low cost OMAP3530 based board. POP (Package on Package) is a technique where the memory, NAND and SDRAM, are mounted on top of the OMAP3530. The different peripheral support the following

o Microprocessor unit (MPU) subsystem based on the ARM Cortex-A8™ processor.
o POP Memory interface
o 1Gb MDDR (128Mbytes)
o 2Gb NAND Flash (256 Mbytes)
o 24 Bit RGB Display interface (DSS)
o SD/MMC interface (The connector can supports 7 different types of card)
o USB OTG interface
o NTSC/PAL/S-Video output
o Power management
o Serial interface
o I2C interface
o I2S Audio interface (McBSP2)
o Expansion McBSP1
o JTAG debugging interface

More about Beagle board can get from http://beagleboard.org/ and http://elinux.org/BeagleBoard . Documents also available over this link. Source code for beagle board, booting procedure and compiling procedure can be found in http://code.google.com/p/beagleboard/

Boot Sequence:
Reset Button:
When pressed and released, causes a full power on reset of the BeagleBoard. It should be noted that currently, the reset will not work when the Linux kernel is running. To reset the board from the kernel operation, a power cycle is required.

User/Boot Button:
A button is provided on the BeagleBoard to provide two functions:
• Force a change in the boot sequence of the OMAP3530.
• Used as an application button that can be used by SW as needed.
When used in conjunction with the RESET button, it will force a change
to the order in which boot sources are checked as viable boot sources.
If the button is pressed while the RESET button is released, the sequence becomes:
o MMC1
Even though the NAND may have a program in it, if a card is placed in the MMC slot, it will try to boot from it first. If it is not there, it will boot from NAND. There is also the option to have a serial download application that will program the NAND if connected to the serial or USB ports. In this scenario the internal ROM will stop on either the serial or USB port and start the download process from there. It does require an application to be run on the host PC in order to perform this function.
If the user button is not pressed at reset, the sequence in which the internal ROM looks for viable boot sources is as follows:
o MMC1
In this case, NAND overrides every option and will always boot from NAND if there is data in the NAND. If the NAND is empty, then the other sources are available to be used based on the boot order.


1. Make sure Beagle power is in OFF state by removing the 5V
supply and the USB host connection.
2. Connect the IDC UART cable the Beagle Board and using a Null-
Modem serial cable connect it to a UART port on a Linux
3. Have terminal program, such as Minicom running on the host
4. Configure the terminal program for (BAUD RATE - 115200, DATA- 8 bit,
PARITY- none, STOP - 1bit, FLOW CONTROL – none).
5. Insert the MMC/SD card (that is prepared as described above) into MMC/SD slot on Beagle Board.
6. Connect a TV (NTSC-M) to S-video port. Power ON TV.
7. Make three partitions over the SD card. One should be VFAT filesystem while
other two with EXT2 filesystem.
a) mmcblk0p1 – first partition – filesystem vfat – keep uImage
b) mmcblk0p2 – second partition – filesystem ext2 – keep linux with
android filesystem
c) mmcblk0p3 – third partition – filesystem ext2 – keep android
6.Building Kernel Image

1. Configure Linux-2.6 kernel mentioned above with full beagleboard and
android support.

make ARCH=arm CROSS_COMPILE=$(Path of tool chain)/bin/arm-eabi- menuconfig

By default the kernel will have video output LCD. Change it to TV rather
than LCD. File to be change can be found in Linux-kernel/arch/arm/plot- omap-display.c

2. Compile kernel by fallowing command.
make ARCH=arm CROSS_COMPILE=$(Path of tool chain)/bin/arm-eabi- uImage

3. Copy uImage from Linux-kernel/arch/arch/boot folder to SD/MMC card with the following command to vfat partition,
mount /dev/sdxx /mnt.
cp arch/arm/boot/uImage /mnt.
umount /mnt

8. Building Android Filesystem

Extract the data.tar system.tar ramdisk.img with following commands. Which forms Android filesystem.

a) Download android SDK android-sdk-linux_x86-1.0_r1.zip and setup the path in

b) steps for extracting system and data from emulator...

source :................

c) step by step extracting system and data from emulator...
now get inside tools directory

1) mksdcard card 100M card.img // create an empty card image.
2) emulator -sdcard card.img // starting emulator.
Note: Download busybox binary for android.
3) adb -d 1 push busybox /system/bin/busybox // push busybox into emulator
4) adb shell
5) chmod +x /busybox
6) busybox tar -c /data.tar /data
7) busybox tar -c /system.tar /system
Cool mount -o loop card.img mnt/
9) adb pull /data.tar . // extracting data
Cool adb pull /system.tar . // extracting system

d) Get the ramdisk.img from SDK_PATH/tools/lib/images/ramdisk.img

steps for extracting ramdisk.img ..........

1) cp ramdisk.img ramdisk.gz
2) gunzip ramdisk.gz
3) cd target_fs
4) cpio -iv < ../ramdisk

e) Now Android file system is ready. Which means it should have

directories : system and data etc sys dev sbin
files : init init.rc

7.Building Linux filesystem with Android filesystem

Linux Filesystem used is rd-ext2-8M.bin (With Stream video support)
Source Link : http://code.google.com/p/beagleboard/downloads/list

a) gunzip -d < rd-ext2-8M.bin > ramdisk
b) mkdir linux-fs
c) mount -o loop ramdisk linux-fs/

d) cd linux-fs/
e) mkdir android – keep android file system extracted as per above, in this android directory.
f)copy linux file system with Android support to mmcblkp2 of sd card.
mount /dev/sdx2 /mnt
cp -av linux-fs/* /mnt/
umount /mnt

9)Setting Up The Boot Parameters and Booting the Linux kernel

In order to boot the Linux Kernel, kernel parameters need to be placed in Flash. This section describes the commands to boot the kernel up.

Steps for loading Kernel and File system images from SD card

a) mmcinit; // initialize mmc card.
b) fatload mmc 0:1 0x80300000 uImage // kernel image
c) fatload mmc 0:1 0x81600000 initrd.bin // file system ramdisk_image

Steps for loading Kernel and File System images serially

a) Boot the beagle board and type the following command at shell

command : loady ram_address Image.

b) Now open Minicom with 115200 baud Rate.
c) press ctrl A+Z , you will get menu in that select 'S' to send Image
and now select 'ymodem' protocol then press enter.
d) Now use space bar to select the intended file to send and press enter.
Which opens a dialog box showing file sending process sectors by sectors.

Prerequisites : MMC card should have 3 partitions.

a) First partition (EXT2) to have only android file system.
b) Second Partition (EXT2) to have Linux and android file system in a
separate directory.
c) This is of vfat type partition to have initrd.bin image and uImage files.

Steps for Android Booting in Beagle board :

a) Directly boot from Android Kernel into the android file system. i.e let the
android kernel directly start /init from android file system.

1. Setup the bootargs.
setenv bootargs console=ttyS2,115200n8,n8 noinitrd root=/dev/mmcblk0p1
rw rootfstype=ext2 init=/init nohz=off

2. Run these commands in Flash, type :
saveenv // to save
printenv // to display

3. Type the following command next: // if MMC card Present
mmcinit; // initialize mmc card.
fatload mmc 0:1 0x80300000 uImage; copy image to certain location.
4. bootm 0x80300000; // booting the kernel

b) Manually booting to android file system from normal linux file system.
Note:Disable autostart in /etc/init.rc for dbus-daemon, app_process and runtime.

1. Setup the bootargs.
setenv bootargs console=ttyS2,115200n8 noinitrd root=/dev/mmcblk0p2
rootfstype=ext2 rw rootdelay=1 init=/linuxrc nohz=off
2. Run these commands in Flash, type :
saveenv // to save
printenv // to display
3. Type the following command next: // if MMC card Present
mmcinit; // initialize mmc card.
fatload mmc 0:1 0x80300000 uImage; copy image to certain location.
4. bootm 0x80300000; // booting the kernel

Steps for Normal Bootup of Beagle board with Linux kernel and ramdisk image:

1. Setup the bootargs.
setenv bootargs console=ttyS2,115200n8 ro rootfstype=ext2 rootdelay=1
ramdisk_size=32768 init=/linuxrc root=/dev/console initrd=0x81600000,60M
2. Run these commands in Flash, type :
saveenv // to save
printenv // to display
3. Type the following command next: // if MMC card Present
mmcinit; // initialize mmc card.
fatload mmc 0:1 0x80300000 uImage;
fatload mmc 0:1 0x81600000 initrd.bin
4. bootm 0x80300000; // booting the kernel

10.Create a Script file to start android services(android_start.sh) using vi editor

ln -s /android/system /system
ln -s /android/data /data

#copy all android etc file
cp /android/etc/* /etc -R

export PATH=/sbin:/system/sbin:/system/bin:$PATH
export LD_LIBRARY_PATH=/system/lib
export ANDROID_ROOT=/system
export ANDROID_ASSETS=/system/app
export ANDROID_DATA=/data
export EXTERNAL_STORAGE=/sdcard
export DRM_CONTENT=/data/drm/content

/bin/chmod -R a+rw /data /tmp
/bin/chmod -R a+rw /dev/binder

chroot /android /init

/system/bin/app_process -Xzygote /system/bin --zygote &
/system/bin/dbus-daemon --system &
runtime &

11.Flashing the Nand


1) MMC card to be formated with single partition as vfat.
2) Need device to host converter cable.
3) Need UART serial cable.
4) Need to download source files.
Source Link : http://code.google.com/p/beagleboard/wiki/BeagleSourceCode

Steps to perform Flashing from u-boot using SD/MMC card.

1) Make sure that all below mentioned files are ready.
ramdisk.bin(file system)
2) copy the files into MMC card as with name given below in a order.
x-load.bin.ift for Nand as x-load.bin.ift
u-boot to flash onto Nand as flash-uboot.bin
u-boot.bin for MMC boot as u-boot.bin
ramdisk Image as rd-ext2.bin
Kernel(uImage) as uImage
3) Then insert the MMC card into slot and power up while pressing User button.
Commands to write into Nand Memory
fatload mmc 0 0x80200000 x-load.bin.ift;
(fatload mmc partition:partition number ram_adress image)
nand unlock;
nand ecc hw;
nand erase 0 80000;
(nand erase offset size)
nand write 0x80200000 0 80000;
(nand write address offset size)
nand lock

fatload mmc 0 0x80200000 flash-uboot.bin;
nand unlock;
nand ecc sw; nand erase 80000 0x1e0000;
nand write 0x80200000 80000 0x1e0000; nand lock;
fatload mmc 0 0x80300000 uImage;nand unlock nand ecc hw nand erase 0x280000 0x500000 nand write 0x80300000 0x280000 0x1e0000 ( nand write address offset kernel_size )
nand lock
nand unlock
nand ecc hw
nand erase 0x780000 0xf88000
nand write 0x81600000 0x780000 0x400000
(nand write address offset File_System_size)
nand lock
4) Now reboot the board and press reset button.
Steps to perform Flashing from Serial cable.

1) Download beagle_recover.tar.bz2
Source Link: http://groups.google.com/group/beagleboard/files
2) Extract the contents. And setup the connection using serial cable and
Beagle board and power it up.
3) Get inside the beagle_recover directory and run
$./recover_beagle.sh ttyS0
4) Which flashes contents x-load.bin.ift and u-boot.bin into NAND memeory.

Table of Memory Partitioning :

Ram_address Nand Flash offset Size
Start End
X-Loader 0x80200000 0x000000 - 0x80000 0x0080000
U-boot 0x 80200000 0x080000 - 0x260000 0x01e0000
Boot Env-Nand 0x80200000 0x260000 - 0x00280000 0x0020000
Kernel offset 0x80300000 0x280000 - 0x00780000 0x0500000
File System Offset 0x81600000 0x780000 - 0x10000000 0x0f88000


1.Boot with kernel on beagle-board.

1.Run the script file.

enjoy!!! farao


Posts : 49
Join date : 2012-08-15
Location : Mumbai,INDIA

View user profile http://embeddedforus.com

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum