bc10/Software

Currently Work in Progress

Overview: android-2.2_r1.1 for bc10

This section discusses how to build userland of android-2.2_r1.1. android-2.2_r1.1 is based upon the Android Open Source
Project (AOSP). AOSP is modified for the hardware of bc10, and android-2.2_r1.1 is created. The directions of how to create
the userlnd are: 1) building the development environment for android-2.2_r1.1, 2) obtaining the source code, 3) running the
modification script for bc10, and 4) installing SGX SDK. SGX SDK improves rendering 2D/3D graphics and encoding/decoding
video.

This is still working in progress for some devices, and the contents of this page may change without advanced notice

Development Environment

Install packages

Obtain the required packages from the repository of Ubuntu, and install the packages

$ sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev \
  libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev uboot-mkimage

java5

Ubuntu 9.10 or newer has no longer supported sun-java5-jdk initially. sun-java5-jdk is not in the repository of the 9.10 or
newer version of Ubuntu, but is needed to build branch android-2.2_r1.1. Add the old repository on /etc/apt/sources.list,
temporarily.

$ sudo vi /etc/apt/sources.list
  ## respective vendors as a service to Ubuntu users.
  deb http://archive.canonical.com/ubuntu lucid partner
  deb-src http://archive.canonical.com/ubuntu lucid partner
  deb http://archive.ubuntu.com/ubuntu lucid-security main restricted
  deb-src http://archive.ubuntu.com/ubuntu lucid-security restricted main multiverse universe #Added by software-properties
  deb http://archive.ubuntu.com/ubuntu lucid-security universe
  deb http://archive.ubuntu.com/ubuntu lucid-security multiverse
+ deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse
+ deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse

After adding the repository to the sources.list, use apt-get updateto acquire the added repository information and install sun-java5-jdk.

$ sudo apt-get update
$ sudo apt-get install sun-java5-jdk

After the installation of the old java is completed, erase the added repository. This prevents accidentally installing unnecessary old packages.

$ sudo vi /etc/apt/sources.list
  ## respective vendors as a service to Ubuntu users.
  deb http://archive.canonical.com/ubuntu lucid partner
  deb-src http://archive.canonical.com/ubuntu lucid partner
  deb http://archive.ubuntu.com/ubuntu lucid-security main restricted
  deb-src http://archive.ubuntu.com/ubuntu lucid-security restricted main multiverse universe #Added by software-properties
  deb http://archive.ubuntu.com/ubuntu lucid-security universe
  deb http://archive.ubuntu.com/ubuntu lucid-security multiverse
- deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse
- deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse

Once again, use apt-get update, and reset the information of repository to the original one.

$ sudo apt-get update

Obtain Source

Configuration of repo

To download the source code of android, configure repo.

$ cd ~
$ mkdir bin
$ curl http://android.git.kernel.org/repo >~/bin/repo
$ chmod a+x ~/bin/repo

On Ubuntu, PATH is automatically set to ~/bin once users log-out then log-in again. To stay working on the current environment,
without log-out, ~/bin can be added to PATH of the environment variable. To configure the environment variable, follow the command
shown below.

$ export PATH=~/bin:$PATH

Initialize repo

Create a working directory called bc10, and execute repo init for obtaining android-2.2_r1.1 branch.

$ cd ~/
$ mkdir bc10 
$ cd bc10
$ repo init -u git://android.git.kernel.org/platform/manifest.git -b android-2.2_r1.1

Addition of local_manifest.xml

The source code, which is obtained from android-2.2_r1.1 branch does not include ALSA. To use ALSA as the audio library, create
local_manifest.xml below the directory of bc10/.repo/. Then, as ALSA related files are added to local_manifest.xml, the source code
of ALSA is downloaded.

Since the files related to ALAS does not tagged out against android-2.2-r1, use Froyo branch, directly.

$ vi .repo/local_manifest.xml
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <project path="external/alsa-lib" name="platform/external/alsa-lib" revision="froyo"/>
  <project path="external/alsa-utils" name="platform/external/alsa-utils" revision="froyo"/>
  <project path="hardware/alsa_sound" name="platform/hardware/alsa_sound" revision="froyo"/>
</manifest>

repo sync

After local_manifest.xml is revised, execute repo sync. Obtain the source code of android.

$ repo sync

Applying of the build configuration file for bc10

The second command line below is to copy the configuration file from github repository to the directory below bc10/. This
intends to optimize and build android2.2_r1.1 for bc10. Then, execute bc10-patch.sh. which is located under the directory
of device/beatcraft/patch-for-bc10.

$ cd ~/bc10/device/
$ git clone git://github.com/bc-dev/device_beatcraft_bc10.git beatcraft
$ cd beatcraft/patch-for-bc10/
$ ./bc10-patch.sh

$ cd
$ git clone git://github.com/bc-dev/patch_to_android-2.2_r1.1_for_b10.git
$ cd patch_to_android-2.2_r1.1_for_b10

The destination of the files, which are obtained by git clone is not specified.
Before executing bc10-patch.sh, modify the environment variable inside bc10-patch.sh
to match up to the PATH, which us determined in the configuration file

### Settings 
ANDROID_DIR=${HOME}/bc10
SETUP_DIR=${HOME}/patch_to_android-2.2_r1.1_for_b10
PATCH_DIR=${SETUP_DIR}/patches-for-bc10

After checking the configuration of PATH, execute bc10-patch.sh.

$ ./bc10-patch.sh

Applying this patch, the list of features are also added.

Build Android

To build android, set up the development environment of bc10.

$ cd ~/bc10
$ source build/envsetup.sh
$ lunch bc10-eng
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.2
TARGET_PRODUCT=bc10
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=FRF91
============================================

Check the configuration listed above, then, execute make command.

$ make

The duration of make process is reduced as applying parallel execution. Add an extension, j2 to the command line. The
results may differ. This highly depends on CPU.
To obtain detail information of the make process, add showcommands and execute with make command. This outputs
the logs which report the details of the executed commands during the makeprocess.

Creation of image

After the build process is completed, the binary of userland, which is built by the process, is moved to the bootable location.
To organize userland, bc10-image.sh is used.

$ cd ~/bc10
$ cd device/beatcraft/patch-for-bc10/image/
$ ./bc10-image.sh

$ cd patch_to_android-2.2_r1.1_for_b10
$ ./mkbc10-image.sh

To run the script, a new directly, bc10-image/ is added to out/target/product/bc10/. android userland is placed inside
the directory of bc10-image.

/home/beat/bc10/out/target/product/bc10
mkdir android for android-rfs
/home/beat/bc10/out/target/product/bc10
copy android-root
copy android-system
change permission and owner
[sudo] password for beat:
$ cd ~/bc10/out/target/product/bc10
$ ls -l
-rw-r--r--  1 beat beat        7 2010-08-27 23:37 android-info.txt
drwxrwxrwx  8 root root     4096 2010-08-30 11:34 bc10-image
-rw-r--r--  1 beat beat     8866 2010-08-27 21:16 clean_steps.mk
drwxr-xr-x  3 beat beat     4096 2010-08-27 21:54 data
-rw-r--r--  1 beat beat    22869 2010-08-27 23:37 installed-files.txt
drwxr-xr-x 13 beat beat     4096 2010-08-27 23:28 obj
-rw-r--r--  1 beat beat      189 2010-08-27 21:16 previous_build_config.mk
-rw-r--r--  1 beat beat   163811 2010-08-27 23:37 ramdisk.img
drwxr-xr-x  8 beat beat     4096 2010-08-27 21:54 root
drwxr-xr-x  4 beat beat     4096 2010-08-27 21:54 symbols
drwxr-xr-x 11 beat beat     4096 2010-08-27 23:17 system
-rw-------  1 beat beat 78486144 2010-08-27 23:37 system.img
-rw-------  1 beat beat  1522752 2010-08-27 23:37 userdata.img
$ cd bc10-image
$ ls -l
drwxrwxrwx  2 root root   4096 2010-08-27 21:26 data
-rwxrwxrwx  1 root root    118 2010-08-27 21:54 default.prop
drwxrwxrwx  2 root root   4096 2010-08-27 21:26 dev
-rwxrwxrwx  1 root root 107440 2010-08-27 21:54 init
-rwxrwxrwx  1 root root   1677 2010-08-27 20:53 init.goldfish.rc
-rwxrwxrwx  1 root root    197 2010-08-24 20:58 init.omap3.rc
-rwxrwxrwx  1 root root  13605 2010-08-24 20:58 init.rc
drwxrwxrwx  2 root root   4096 2010-08-27 21:26 proc
drwxrwxrwx  2 root root   4096 2010-08-27 21:54 sbin
drwxrwxrwx  2 root root   4096 2010-08-27 21:26 sys
drwxrwxrwx 11 root root   4096 2010-08-30 11:34 system

kernel build

The details of changed parts in X-Loader, U-Boot, and kernel are listed in the section of the changed parts of X-Loader, U-Boot, and kernel.

Configure the environment variable

X-Loader, U-Boot and kernel are necessity for boot. All three are built by tookchain, which is distributed with the source code of android.

Configure environment variable as toolchain can be used for cross compile on the build process of these files.

$ export PATH=/home/beat/bc10/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin:${PATH}
$ export ARCH=arm
$ export CROSS_COMPILE=arm-eabi-

X-Loader

$ cd ~/bc10
$ git clone git://gitorious.org/~bc-dev/x-load-omap3/x-load-bc10.git x-load-bc10
$ cd x-load-bc10
$ git checkout -t -b bc10 origin/bc10
$ make omap3530bc10_config
$ make

Since x-load.bin is not matched with the format of OMAP BootROM, X-Loader does not work as the bootloader as it is wretten into
NAND Flash or a SD card. To solve this issue, x-load.bin is modified with signGP.
The executable file of signGP is downloaded form the website, whose address is shown below.
http://beagleboard.googlecode.com/files/signGP
Execute the downloaded signGP.

$ ./signGP x-loader.bin

After its build is completed, change the name of file, x-loader.bin.ift into MLO, and MLO is written into the top of the FAT
partition of SD card.

U-Boot

$ cd ~/bc10
$ git clone git://gitorious.org/bc10/u-boot-bc10.git u-boot-bc10
$ cd u-boot-bc10
$ git checkout -t -b build origin/build
$ make omap3_bc10_config
$ make


After U-Boot is built, u-boot.bin is copied to the FAT partition of SD card.

kernel

$ cd ~/bc10
$ git clone git://gitorious.org/~bc-dev/rowboat/bc10-rowboat-kernel.git bc10-rowboat-kernel
$ cd bc10-rowboat-kernel
$ git checkout -t -b bc10-2.6.32-build origin/bc10-2.6.32-build
$ make omap3_bc10_defconfig
$ make uImage
$ make modules

After the build is over, uImage is created in the following directory.

$ ls ~/bc10/bc10-rowboat-kernel/arch/arm/boot/
Image  Makefile  bootp  compressed  install.sh  uImage  zImage

Installation of SGX SDK

Install SGX SDK Caution: It takes quite time to download SGX_SDK.

$ cd bc10
$ git clone git://gitorious.org/rowboat/ti_android_sgx_sdk.git TI_Android_SGX_SDK
$ cd TI_Android_SGX_SDK
$ ./OMAP35x_Android_Graphics_SDK_setuplinux_3_01_00_03.bin

As the location of installation is asked, in this section, choose the default location, ${HOME}OMAP35x_Android_Graphics_SDK_3_01_00_03.
As the installation is completed, the file is placed in the directory.

Edit Rules.make

Rules.make is edited as shown below, and the file is located at {HOME}/bc10/device/beatcraft/bc10. Copy the file.

To build SGX SDK, android userland, toolchain, and kernel source are needed.Rules.make is a reference for the location of the directory of
{HOME}/bc10/device/beatcraft/bc10 as SGX SDK are built and installed.

$ cd ${HOME}/OMAP35x_Android_Graphics_SDK_3_01_00_03
$ mv Rules.make Rules.make.orig
$ cp ${HOME}/bc10/device/beatcraft/bc10/Rules.make ${HOME}/OMAP35x_Android_Graphics_SDK_3_01_00_03/
#Rules.make

PLATFORM=LinuxOMAP3

################# FIELDS MODIFIABLE BY THE USER ###############################
#set home area HOME (relative location for all SDK operations)
# HOME=INVALIDVAL
HOME=/home/beat
#Current Directory where Graphics SDK is installed
GRAPHICS_INSTALL_DIR=$(HOME)/OMAP35x_Android_Graphics_SDK_3_01_00_03
#GRAPHICS_INSTALL_DIR=$(HOME)/bc10/TI_ANDROID
#Android Specific
#Path of Android Root FS
# ANDROID_ROOT=$(HOME)/INVALIDVAL
ANDROID_ROOT=$(HOME)/bc10/out/target/product/bc10/bc10-image
#set toolchain root path for arm-eabi
# CSTOOL_DIR=INVALIDVAL
CSTOOL_DIR=$(HOME)/bc10/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/
CSTOOL_PREFIX=arm-eabi-
CSTOOL_PATH=$(CSTOOL_DIR)/bin
CSTOOL_LIBSTDC++_PATH=$(CSTOOL_DIR)/arm-none-linux-gnueabi/libc/usr/lib

#set the kernel installation path
# KERNEL_INSTALL_DIR=$(HOME)/INVALIDVAL
KERNEL_INSTALL_DIR=$(HOME)/bc10/kernel-rowboat-bc10
TARGETFS_INSTALL_DIR=$(ANDROID_ROOT) 

GFX_TARGETFS_KERMOD_PATH=$(TARGETFS_INSTALL_DIR)/lib/modules/2.6.32 

#Android
ANDROID_DISCIMAGE=$(TARGETFS_INSTALL_DIR)/

Copy is completed, then start executing the build process.

$ cd ~/OMAP35x_Android_Graphics_SDK_3_01_00_03
$ make
$ make OMAPES=3.x install

In the code shown above, the last code, make install does have an option OMAPES=3.x. Since bc10 is equipped with OMAP3530 as CPU,
and 3.x is selected. There are same options for other types of processors.

For OMAP3530 ES 1or2 = 2.x
For OMAP3530 ES3.0   = 3.x
For AM3517           = 3.x
For AM37x            = 5.x

After the build process is completed, the massage, described below, appears.

Installation complete!

The required files has been copied to the directory ~/bc10/out/target/product/bc10/bc10-image/, and this is the end of the creation of
android userland for bc10.

Create SD card image

This section reviews how to crete SD card image. This most processes shown here have been discussed before. The structure
of SD card and contents of each partition are the same as other embedded Linux system which includes Android. The creation
of SD card image are to follow the directions, which is listed at “Create bootable SD card on bc10/booting.” The placement of
the created images is to apply the same method as rowboart-eclair-dsp's one.

The overview of structure of SD card is shown below.

It is assumed that working environment is Linux.
The order of the instructions is shown below.

  1. Initialization and setting of partitions
  2. Format the bootlorder file system
  3. Placing the bootlorder files

The instruction is originally listed at LinuxBootDiskFormat (code.google.com), and this section is quoted and rearranged.
For the convenience of the explanation for the command lines, user inputs are also shown, and user inputs are written
inside squire brackets [ ]. This is an example, and the directory and the location of device file may vary. These are
highly dependent on SD cards.

Unmount SD card

Unmount is required for creating partitions and formatting the SD card. If the automounter mounts the SD card, unmount
the SD card.

Assume that presently a SD card is mounted as it is described below.

$ [df -h]
Filesystem            Size  Used Avail Use% Mounted on
...
/dev/sdc1             400M   94M  307M  24% /media/disk
...

The name of the SD card is disk, and the SD card is currently situated the directory /media/disk.
Unmount the SD card.

$ [umount /media/disk]

Initialization and configuration of partitions

Execute fdisk command. The parameter of fdisk is the starting point of the SD card, in which the device file of the SD
card is located. The directory may differ, depending on SD cards. Please check before start this task.

$ [sudo fdisk /dev/sdc]
Command (m for help): [p]

Disk /dev/sdc: 2021 MB, 2021654528 bytes
255 heads, 63 sectors/track, 245 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1         246     1974240+   c  W95 FAT32 (LBA)
Partition 1 has different physical/logical endings:
     phys=(244, 254, 63) logical=(245, 200, 19)

Write down the number of bytes on the SD card. The number will use later. (in this example 2021654528)
Delete any partitions that already exist in the SD card.

Command (m for help): [d]
Selected partition 1

Change to expert mode.

Command (m for help): [x]

Set the number of heads to 255.

Expert Command (m for help): [h]
Number of heads (1-256, default xxx): [255]

Set the number of sectors to 63.

Expert Command (m for help): [s]
Number of sectors (1-63, default xxx): [63]

The number of cylinders is differ, and it is dependent on SD cards. This is how to calculate the number of cylinders.
The outcome is truncated, do not be rounded.

#cylinders = FLOOR (the number of Bytes on the SD Card (from above) / 255 / 63 / 512 )

The number of cylinders for the SD card used here is calculated as described below.

2021654528 / 255 / 63 / 512 = 245.79
-> 245

Set the number of cylinders, The number of cylinders is 245 for this example.

Expert Command (m for help): [c]
Number of cylinders (1-256, default xxx): [enter the number calculated above]

Return to normal mode.

Expert Command (m for help): [r]

Create FAT32 partition in the SD card.

Command (m for help): [n]
Command action
   e   extended
   p   primary partition (1-4)
[p]
Partition number (1-4): [1]
First cylinder (1-245, default 1): [(press Enter)]
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-245, default 245): [+50]

Command (m for help): [t]
Selected partition 1
Hex code (type L to list codes): [c]
Changed system type of partition 1 to c (W95 FAT32 (LBA))

Set up the boot flag in the first partition, and make it bootable.

Command (m for help): [a]
Partition number (1-4): [1]

Create the second partition for the root file system of Linux.

Command (m for help): [n]
Command action
   e   extended
   p   primary partition (1-4)
[p]
Partition number (1-4): [2]
First cylinder (52-245, default 52): [(press Enter)]
Using default value 52
Last cylinder or +size or +sizeM or +sizeK (52-245, default 245): [(press Enter)]
Using default value 245

Check up configurations of the newly created partitions.

Command (m for help): [p]

Disk /dev/sdc: 2021 MB, 2021654528 bytes
255 heads, 63 sectors/track, 245 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1          51      409626    c  W95 FAT32 (LBA)
/dev/sdc2              52         245     1558305   83  Linux

Save the changes in the partition table.

Command (m for help): [w]
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.

Format the file system

Format the FAT32 partition and the Linux partition.
In the example described below, LABLE1 and LABEL2 are given by the commands. The names of the partitions are
freely decided. Input the names of the partitions.

$ [sudo mkfs.msdos -F 32 /dev/sdc1 -n LABEL1]
mkfs.msdos 2.11 (12 Mar 2005)

$ [sudo mkfs.ext3 -L LABEL2 /dev/sdc2]
mke2fs 1.40-WIP (14-Nov-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
195072 inodes, 389576 blocks
19478 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=402653184
12 block groups
32768 blocks per group, 32768 fragments per group
16256 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912

Writing inode tables: done                            
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: 

Place the image files of bootloaders

The image files of bootloaders are set into the SD card.
First, remount the SD card. (Gently push the SD card into its holder, then the card pops out, and reinsert the
SD card into its folder again.) The mount point of SD card is highly dependent on system. Change the mount
point, which is suitable to its system.

FAT partition

  1. After the format of FAT32 partition is completed, X-Loader is the first one to be placed in the partition.
  2. It is placed at the top of the directory in the partition.
  3. Change the name of the file to MLO.
$ cd  ~/bc10/x-load-bc10
$ cp x-load.bin.ift /media/LABEL1/MLO
$ cd ~/bc10/u-boot-bc10
$ cp u-boot.bin /media/LABEL1/u-boot.bin
$ cd ~
$ vi boot.script
if fatload mmc 0 84000000 uImage
then
 echo ***** Kernel: /dev/mmcblk0p1/uImage.bin *****
fi
echo ***** RootFS: /dev/mmcblk0p2 *****
setenv bootargs 'mem=88M@0x80000000 mem=128M@0x88000000 androidboot.console=ttyS2 console=tty0 console=ttyS2,115200n8 root=/dev/mmcblk0p2 init=/init rootwait omapfb.video_mode=680x480MR-24@60'
bootm 84000000

As this file is used as a varialbe, mkimage is executed as it is shown below.

$ mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n ./boot.script -d ./boot.script ./boot.scr &> /dev/null

Createed boot.scr is copied to FAT partition of the SD card.

$ sudo cp boot.scr /media/LABEL1/

Linux partition

Place the userland of android for bc10, which is just built.

$ cd ~/bc10/out/target/product/bc10/bc10-image
$ sudo cp -fr * /media/LABEL2/

At the end, before unmount the SD card, execute sync.

$ sync
$ sudo umount /media/LABEL1
$ sudo umount /media/LABEL2

The creation of SD card image has been completed.

Modified parts of X-Loader, U-Boot, and kernel

This section lists up the modified parts of X-Loader, U-Boot, and kernel. These changes are specifically adjustments for bc10 froyo.

bc10-rowboat-kernel

Origin

Major changes

u-boot-bc10

Origin

Major changes

x-load-bc10

Origin

Major changes

Reference URL

Revision History


Front page   New List of pages Search Recent changes   RSS of recent changes