bc10

Outline for bc10/prebuilt-20110107

bc10/prebuilt-20110107 is based upon AOSP android-2.2_r1.1

This article provides the detail explanations of the bootable prebuilt image, android-2.2_r1.1 prebuilt image. This
prebuilt image is basically a modified and extended version of the bootable image for bc10/froyo. The first half
of this section shows how to build the bootable image, and the second half explains how to create a bootable SD
card, placing the prebuilt image on a the SD card.

  • The instructions of how to create the prebuilt image
    This section provides the instructions of how to create an development environment for prebuilt-20110107, the
    building method of prebuilt-20110107, and the addition of Wifi driver for prebuilt-20110107. This explains
    how to create the prebuilt image.
  • The instructions of how to place the prebuilt image
    This section shows that how to download the image of prebuilt-20110107, bc10-boot-sd-image-release20110107.tar.gz
    and how to place the images into a SD card. This section shows how to make a SD card bootable.

Instructions of creating prebuilt image

Developing environment

To create the development environment, these three items are really critical.

  • OS: Ubuntu 10.04 (32bit version)
  • JAVA: java 1.5x
  • Android Version: android-2.2_r1.1

Installing packages

Obtain the required packages from the repository of ubuntu and instal 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

Since Ubuntu 9.10 sun-java5-jdk, which is critical to build Android, has been removed from the repository of ubuntu.
An old repository is temporarily added to /etc/apt/source.list.

$ 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 old repository, acquire the information of repository by applying apt-get update. Then, install
sun-java5-jdk.

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

After completing the installation, the added repository is removed. This prevents accidentally installing 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, applying apt-get update, obtain the present information of the current repository and restore the
original present depository.

$ sudo apt-get update    

Obtaining Android source file

Setting up repo

Configure repo for obtaining the source code of android.

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

As using Ubuntu, once log-out and then log-in, PATH is going through ~/bin automatically. Prefer to stay
log-in, set the PATH to ~/bin flowing directions shown below.

$ export PATH=~/bin:$PATH

Initializing repo

Create a directory called bc10 for the source file, and execute repo init to download android-2.2_r1.1 branch
to the bc10 directory.

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

Adding local_manifest.xml

The source code that can be downloaded with the android-2.2_r1.1 tag does not include ALSA. To use ALSA as audio
library, modify the local_manifest.xml for adding ALSA and its related files, and make the source code of the ALSA
file obtainable. To obtain the files, create a local_manifest.xml under the directory of bc10/.repo/ and modify
it as shown below.

The android-2.2_r1.1 specific ALSA related files have not been tagged out yet. This time, the ALSA of Froy branch is used
for android-2.2_r1.1.

$ 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 adding local_manifest.xml, execute repo sync''', and obtain the source code of android.

$ repo sync

The total size of the files is from 2 to 4GB. Download time highly depends on the speed of network.

Applying the build configuration file of bc10

The patches and configuration files, which Optimize and build android-2.2_r1.1 for bc10, are downloaded from the
repository of github by the command of git clone. Then apply the patches and configuration files by the command of
patch_to_android-2.2_r1.1_for bc10/bc10-patch.sh.

$ cd ~
$ git clone git://github.com/bc-dev/path_to_android-2.2_r1.1_for _bc10.git
$ cd patch_to_amndroid-2.2_r1.1_for _bc10

There are no specific directory for the downloaded patches and configuration files, which are obtained by git clone,
but before applying these patches and files, make sure that the environment variables in bc10-patch.sh are matched with
the PATHs of these files.

$ vi bc10-patch.sh
### 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 PATHs of the files are equal to the the environment variables in bc10-patch.sh, execute bc10-patch.sh.

$ ./bc10-patch.sh

Android build

Set up the environment for 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 of environment. Then, execute make.

$ make 

Crating image

After build is completed, relocate the binary of userland to a bootable place. mkbc10-image.sh is used for setting up
userland.

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

Execute commands above, bc10-image is created under the directory of bc/out/target/product/bc10/. Under the directory of
this bc10-image android userland will be placed.

/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

Configuring environment variable

x-loader, u-boot, and kernel are required for booting bc10. These are built with toolchain, which is distributed with the
source code of android. toolchain used here is located at the directory, prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin.
The environment variable is needs to set for the cross compile as this toolchain build 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-

kernel

$ cd ~
$ git clone git://gitorious.org/~bc-dev/rowboat/bc10-rowboat-kernel.git bc10-rowboat-kernel
$ cd bc10-rowboat-kernel/

Shift to the release branch for bc10.

$ git checkout -t -b bc10-2.6.32 origin/bc10-2.6.32
$ make omap3_bc10_defconfig
$ make uImage
$ make modules

After build is completed, uImage is created at the directory shown below.

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

Building USB Wifi (RT3070USB) driver

To work with USB Wifi devices, a Wifi driver, RT3070USB is added. The devices listed below have been tested and confirmed that
the devices are working appropriately.
Some devices are still underdevelopment, please do understand that the contents may change without advanced notice.

Maker     Serial Number     Device ID   Memo
PLANEX    GW-USMicroN-G     2019:ED14
Logitec   LAN-W150N/U2IPH   0789:0164
Logitec   LAN-W150N/U2BK    0789:0168
Buffalo   WLI-UC-GNM        0411:01a2
Buffalo   WLI-UC-G301N      0411:016f&#12288; The performance of Baffalo WLI-UG-G301N is only confirmed as it is connected to AC powered hub.
Buffalo   WLI-UC-GN         0411:015d

In this section, the explanation is specifically targeted at Baffalo's and Logitec's Wifi devices.

The driver, 2010_0831_RT3070_Linix_STA_v2.4.01_DPO.bz2, is downloaded from PALINK Web. The driver used here is
a Linux driver. Also, a firmware, RT28xx/RT30xx USB series (RT2870/RT2770/RT3572/RT3070) are required. To download
the source code and/or firmware, input user name and email address for downloading the files. Assume that the downloaded
files are placed at the directory of /home/beat/. toolchain used here is the same toolchain which is used for building kernel
and located at the directory of prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin. The firmware is modified for bc10. prebuilt image
does not produce any debug logs since a part of config.mk, which is located at the directory of os/linux/config.mk, is set as
WLAGS += -DCONFIG_STA_SUPPORT. As debug logs are not displayed, critical logs may be missed. Please be careful.

To produce debug logs, set up the part of config.mk as -WFLAGS += -DCONFIG_STA_SUPPORT -DDBG, then, rebuild
the source file and place the file again. During the redoing process, debug logs are output. There may be too many logs,
and these logs make to harder to work on this process.

To apply the patch, RT3070USB.diff, this becomes capable of cross-compile for bc10.
The contents of the patch are:

  • Add the compile configuration for bc10 (platform, PATH of toolchain, and the configuration of compile frags.
  • Set up the region of firmware to Japan, and change the examples of each section.
  • Add USB Wifi vender ID and product ID.
diff -urpN 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO-orig/Makefile 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO/Makefile
--- 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO-orig/Makefile       2010-08-31 18:12:20.000000000 +0900
+++ 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO/Makefile    2011-01-12 16:46:57.732360338 +0900
@@ -15,7 +15,8 @@ endif
 RTMP_SRC_DIR = $(RT28xx_DIR)/RT$(CHIPSET) 

 #PLATFORM: Target platform
-PLATFORM = PC
+#PLATFORM = PC
+PLATFORM = BC10
 #PLATFORM = 5VT
 #PLATFORM = IKANOS_V160
 #PLATFORM = IKANOS_V180
@@ -147,6 +148,11 @@ LINUX_SRC_MODULE = /lib/modules/$(shell
 CROSS_COMPILE =
 endif 

+ifeq ($(PLATFORM),BC10)
+LINUX_SRC = /home/beat/prebuilt-20101227/bc10-rowboat-kernel
+CROSS_COMPILE = /home/beat/prebuilt-20101227/bc10/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
+endif
+
 ifeq ($(PLATFORM),IXP)
 LINUX_SRC = /project/stable/Gmtek/snapgear-uclibc/linux-2.6.x
 CROSS_COMPILE = arm-linux-
@@ -347,6 +353,9 @@ ifeq ($(OSABL),YES)
        cp -f $(RT28xx_DIR)/os/linux/rtnet$(CHIPSET)apsta.ko /tftpboot
 endif
 else
+ifeq ($(PLATFORM),BC10)
+       $(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C  $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
+else
        cp -f $(RT28xx_DIR)/os/linux/rt$(CHIPSET)sta.ko /tftpboot
 ifeq ($(OSABL),YES)
        cp -f $(RT28xx_DIR)/os/linux/rtutil$(CHIPSET)sta.ko /tftpboot
@@ -355,7 +364,7 @@ endif
 endif
 endif
 endif
-
+endif 
 
release:
ifeq ($(TARGET), LINUX)
@@ -388,6 +397,9 @@ endif
        $(MAKE) -C os/linux clean
        rm -rf os/linux/Makefile
 endif
+ifneq ($(TARGET),THREADX)
+       $(MAKE) -C tools clean
+endif
 ifeq ($(TARGET), UCOS)
        $(MAKE) -C os/ucos clean MODE=$(RT28xx_MODE)
 endif
diff -urpN 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO-orig/RT2870STA.dat 2010_0831_RT3070_Lin
ux_STA_v2.4.0.1_DPO/RT2870STA.dat
--- 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO-orig/RT2870STA.dat  2010-08-31 18:12:20.000000000 +0900
+++ 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO/RT2870STA.dat       2011-01-12 16:46:57.732360338 +0900
@@ -1,10 +1,12 @@
 #The word of "Default" must not be removed
 Default
 CountryRegion=5
-CountryRegionABand=7 
-CountryCode=
+#CountryRegionABand=7
+#CountryCode=
+CountryRegionABand=1
+CountryCode=JP
 ChannelGeography=1
-SSID=11n-AP
+SSID=ssidname
 NetworkType=Infra
 WirelessMode=5
 Channel=0
@@ -18,9 +20,9 @@ TxBurst=1
 PktAggregate=0
 WmmCapable=1
 AckPolicy=0;0;0;0
-AuthMode=OPEN
-EncrypType=NONE
-WPAPSK=
+AuthMode=authtype
+EncrypType=encrptype
+WPAPSK=passname
 DefaultKeyID=1
 Key1Type=0
 Key1Str=
diff -urpN 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO-orig/common/rtusb_dev_id.c 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO/common/rtusb_dev_id.c
--- 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO-orig/common/rtusb_dev_id.c  2010-09-01 10:47:30.000000000 +0900
+++ 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO/common/rtusb_dev_id.c       2011-01-12 16:46:57.755056649 +0900
@@ -107,8 +107,14 @@ USB_DEVICE_ID rtusb_dev_id[] = {
        {USB_DEVICE(0x13D3,0x3321)}, /* Azurewave */
        {USB_DEVICE(0x07FA,0x7712)}, /* Edimax */
        {USB_DEVICE(0x0789,0x0166)}, /* Edimax */
-       {USB_DEVICE(0x0DB0,0x822B)}, /* MSI 3070*/^M
-       {USB_DEVICE(0x0DB0,0x871B)}, /* MSI 3070*/
+       {USB_DEVICE(0x0DB0,0x822B)}, /* MSI 3070*/
+       {USB_DEVICE(0x2019,0xED14)}, /* PLANEX*/
+       {USB_DEVICE(0x2019,0xAB29)}, /* PLANEX*/
+       {USB_DEVICE(0x0789,0x0164)}, /* Logitec*/
+       {USB_DEVICE(0x0789,0x0168)}, /* Logitec*/
+       {USB_DEVICE(0x0411,0x01a2)}, /* Buffalo*/
+       {USB_DEVICE(0x0411,0x016f)}, /* Buffalo*/
+       {USB_DEVICE(0x0411,0x015d)}, /* Buffalo*/
 #endif // RT3070 //
 #ifdef RT3370
        {USB_DEVICE(0x148F,0x3370)}, /* Ralink 3370 */
diff -urpN 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO-orig/os/linux/config.mk 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO/os/linux/config.mk
--- 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO-orig/os/linux/config.mk     2010-08-31 18:12:20.000000000 +0900
+++ 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO/os/linux/config.mk  2011-01-12 16:46:57.765058823 +0900
@@ -26,7 +26,7 @@ HAS_WDS=n
 HAS_APCLI=n 

 # Support Wpa_Supplicant
-HAS_WPA_SUPPLICANT=n
+HAS_WPA_SUPPLICANT=y 

 # Support Native WpaSupplicant for Network Maganger
 HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=n
@@ -149,6 +149,7 @@ endif 

 ifeq ($(RT28xx_MODE),STA)
-WFLAGS += -DCONFIG_STA_SUPPORT -DDBG
+#WFLAGS += -DCONFIG_STA_SUPPORT -DDBG
+WFLAGS += -DCONFIG_STA_SUPPORT 

 ifeq ($(HAS_XLINK),y)
 WFLAGS += -DXLINK_SUPPORT
@@ -545,6 +546,10 @@ ifeq ($(PLATFORM),PC)
     endif 
 endif 

+ifeq ($(PLATFORM),BC10)
+EXTRA_CFLAGS := $(WFLAGS) -I$(RT28xx_DIR)/include -DMODILE
+endif
+
 #If the kernel version of RMI is newer than 2.6.27, please change "CFLAGS" to "EXTRA_FLAGS"
 ifeq ($(PLATFORM),RMI)
 EXTRA_CFLAGS := -D__KERNEL__ -DMODULE=1 -I$(LINUX_SRC)/include -I$(LINUX_SRC)/include/asm-mips/mach-generic
                 -I$(RT28xx_DIR)/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common
                 -DCONFIG_IFX_ALG_QOS -DCONFIG_WAN_VLAN_SUPPORT -fomit-frame-pointer -DIFX_PPPOE_FRAME -G 0 -fno-pic
                 -mno-abicalls -mlong-calls -pipe -finline-limit=100000 -mabi=32 -G 0 -mno-abicalls -fno-pic -pipe -msoft-float
                 -march=xlr -ffreestanding-march=xlr -Wa,--trap, -nostdinc -iwithprefix include $(WFLAGS)
(From "EXTRA_CFLAGS := -D__KERNEL__ -DMODULE=1" to "$(WFLAGS)", this is supposed to be one line.)

As it is shown below, the archive is extracted, apply the patch, and executes make. After make is completed, rt3370sta.kois
created under the directory of OS/linux.

$ cd ~
$ tar xvfj 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO.bz2
$ patch -p0 < RT3070USB.diff
$ cd 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO/
$ make
$ ls  -l os/linux/rt3370sta.ko
-rw-r--r-- 1 beat beat 10746686 2011-01-05 12:42 os/linux/rt337sta.ko

About placing USB Wifi (RT3070USB) driver

  • rt3370sta.ko
    Create the directory modules/ under the directoy of bc10/out/target/product/bc10/bc10-image/system/lib/, which is
    located at android userland. rt3370sta.ko a driver file, which is crated at the process described above, is shifted to the
    directory of modules/.
  • RT2870STA.dat
    The wifi configuration RT2870STA.dat contains SSID, authentication types, passphrase, and other information. This
    configuration file is put down the directory of bc10/out/target/product/bc10/bc10-image/system/etc/.
  • rt2870.bin
    Creating a directory firmware/ under the directory of bc10/out/target/product/bc10/bc10-image/system/etc/, rt2870.bin
    a firmware and LICENSE.ralink-firmware.txt are placed inside newly created firmware/ directory.

To comply with mkbc10-image.sh, hereafter file's owner and authority are named as root and 777, respectively.

$ sudo mkdir ~/bc10/out/target/product/bc10/bc10-image/system/lib/modules
$ sudo mkdir -p ~/bc10/out/target/product/bc10/bc10-image/system/etc/Wireless/RT2870STA
$ sudo cp -afr os/linux/rt3370sta.ko ~/bc10/out/target/product/bc10/bc10-image/system/lib/modules/
$ sudo cp -afr RT2870STA.dat ~/bc10/out/target/product/bc10/bc10-image/system/etc/Wireless/RT2870STA/
$ cd ~
$ unzip RT2870_Firmware_V22.zip
$ cd RT2870_Firmware_V22/
$ sudo mkdir ~/bc10/out/target/product/bc10/bc10-image/system/etc/firmware
$ sudo cp -afr * ~/bc10/out/target/product/bc10/bc10-image/system/etc/firmware/
$ sudo chown -R root.root ~/bc10/out/target/product/bc10/bc10-image/system
$ sudo chmod -R 777 ~/bc10/out/target/product/bc10/bc10-image/system

Building SGX SDK

Obtain TI Android SGX SDK as employing the same method as the process described at bc10/froyo.

(Caution):

  • It may take long time to download the SDK.
  • If you have already installed '''OMAP35x_Android_Graphics_SDK_3_01_00_03 for bc10/froyo, you can use the same SDK.
    Make sure that the SDK is moved to the directory of Rules.make. If you download the file, please backup or remove the
    original SDK as you wish.
  • As whole kernel and/or Android userland are replaced, the whole rebuild of kernel and Android is required.
$ cd ~
$ git clone git://gitorious.org/rowboat/ti_android_sgx_sdk.git
$ cd ti_android_sgx_sdk/
$ ./OMAP35x_Android_Graphics_SDK_setuplinux_3_01_00_03.bin

As working with the command line above, the location of install directory is asked. Please select the default directory of
${HOME}/OMAP35x_Android_Graphics_SDK_3_01_00_03. ${HOME} indicates the home directory, /home/beat.

To download TI's Android SGX SDK

Changing Rules.make

Adjust HOME, GRAPHICS_INSTALL_DIR, ANDROID_ROOT, CSTOOL_DIR, and KERNEL_INSTALL_DIR on Rules.make to each
file PATH.

(Caution):
The Rules.make shown below is created according to the setting of the directory described at the end of the previous section.
ANDROID_ROOT should be matched to the location of directory, which has been created at the process of mkbc10-image.sh.

$ CD ~/OMAP35X_ABDROID_Graphics_SDK_3.01_00_03
--- Rules.make  2011-01-05 14:20:43.863788943 +0900
+++ Rules.make-orig     2011-01-05 14:17:04.661291128 +0900
@@ -4,24 +4,20 @@ PLATFORM=LinuxOMAP3 

 ################# FIELDS MODIFIABLE BY THE USER ###############################
 #set home area HOME (relative location for all SDK operations)
-#HOME=INVALIDVAL
-HOME=/home/beat/prebuilt-20101227
+HOME=INVALIDVAL
 #Current Directory where Graphics SDK is installed
 GRAPHICS_INSTALL_DIR=$(HOME)/OMAP35x_Android_Graphics_SDK_3_01_00_03
 #Android Specific
 #Path of Android Root FS
-#ANDROID_ROOT=$(HOME)/INVALIDVAL
-ANDROID_ROOT=$(HOME)/bc10/out/target/product/bc10/bc10-image
+ANDROID_ROOT=$(HOME)/INVALIDVAL
 #set toolchain root path for arm-eabi
-#CSTOOL_DIR=INVALIDVAL
-CSTOOL_DIR=$(HOME)/bc10/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0
+CSTOOL_DIR=INVALIDVAL
 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-rowboat-kernel
+KERNEL_INSTALL_DIR=$(HOME)/INVALIDVAL
 TARGETFS_INSTALL_DIR=$(ANDROID_ROOT)

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

After the modifications of RULE.make is completed, make Install is executed.

$ make
$ make OMAP-3.x install

u-boot

As u-boot-bc10 is updated, boot.scr , which makes AMOLED as the default value of display device is adjusted. After
the update is completed, the duration of waiting period at bc10's boot process is changed from 10 seconds to 2 seconds.

$ cd ~
$ git clone git://gitorious.org/bc10/u-boot-bc10.git u-boot-bc10
$ cd u-boot-bc10
$ make mrproper
$ make omap3_bc10_config
$ make

The display configuration, which treats AMOLED as its default value, is written in the directory of include/configs/omap3_bc10.h.
This directory is located inside u-boot-bc10. Its details are shown below.

u-boot-bc10/include/configs$ vi omap3_bc10.h
#define CONFIG_EXTRA_ENV_SETTINGS \
        "loadaddr=0x82000000\0" \
        "usbtty=cdc_acm\0" \
        "console=ttyS2,115200n8\0" \
        "androidconsole=ttyS2\0" \
        "mem=256M\0" \
        "vram=12M\0" \
        "dvimode=1024x768MR-24@60\0" \
        "defaultdisplay=lcd\0" \
        "mmcroot=/dev/mmcblk0p2 rw\0" \
        "mmcrootfstype=ext3 rootwait\0" \
        "nandroot=/dev/mtdblock4 rw\0" \ 

Shown below, the contents are the same as ones of boot.scr.

if fatload mmc 0 84000000 uImage
then 
 echo ***** Kernel: /dev/mmcblk0p1/uImage.bin *****
fi
echo ***** RootFS: /dev/mmcblk0p2 *****
setenv bootargs 'mem=256M androidboot.console=ttyS2 console=tty0  
console=ttyS2,115200n8 root=/dev/mmcblk0p2 init=/init rootwait omapdss.def_disp=lcd'
bootm 84000000
(Caustion)From "setenv bootargs2 to "disp=lcd", this is originally written in one line. As you apply this script,
please write in one line.

After the build process is completed, u-boot.bin is copied into the FAT partition. This is copied right after MOL file is copied.
To create SD card image, please look at the section of creating SD card image, shown below.

x-loader

$ cd ~
$ 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

The specifications and format of x-load.bin do not match with OMAP BootROMs. If x-load.bin is written into a SD card
without modification, it does not work as a boot loader. To solve this issue, x-load.bin is needed to be modified with signGP.
signGP can be downloaded from the address shown below.
http://beagleboard.googlecode.com/files/signGP
After the download is finished, execute sigGP is executed as it is defined below.

$ ./signGP x-load.bin

x-load.bin.ift, which is created after build is completed, is needed to change its name to MLO. MLO should be written into the top
of FAT partition of the SD card. The information of how to create the SD card image is available at the section below.

The prebuilt image is compressed files that we have built so far.

Order of placing prebuilt image

prebuilt-image

The rebuilt image can be created as following instructions described in the first half of this section, or the image is obtained
by downloading the prebuilt image from here.
The obtained file (created or downloaded) is placed at the HOME directory, /home/beat/.
Extract bc10-boot-sd-image—release20110107.tar.gz

FAT.tar.gz
EXT3.tar.gz

There are two archives in the file. As their names are indicated, please put these archives in FAT partition and EXT3 partition of
the targeted SD card, respectively.
The instructions of writing into these archives are described as it is followed.

Creating SD card image

The creation of bootable SD card is following the instructions described in the section of Create bootable SD card at bc10/booting.
This instructions are strictly for SD card. bc10 cannot be booted from microSD card by its design. The structure of the SD card is
described below.

  • FAT32 partition
    • X-Loader
    • U-Boot
    • Linux kernel
  • Linux partition
    • Linux root file system

This working environment is expected to employ a Linux environment. The working instruction is listed below.

  1. Initialization and configuration of partitions.
  2. Format file system
  3. Placement of files

    The instructions are mainly from LinuxBootFormat (code.google.com) and modified for bc10.

Unmounting SD card

To start working on partition and formatting, unmount the SD card, first, if the SD card is mounted.

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

unmount the SD card.

$ unmount /media/disk

Initializing and configuring partitions

Execute fdiskcommand. Its parameter is the device file of the SD card. The directory shown below may differ, depending on your
working environment and the location of the SD card. Please check the directory of your SD card before starting working on 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)

Remove all partitions

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

Shift into 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 depends 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. For this example, the number of cylinders is 245.

Expert Command (m for help): [c]
Number of cyliner (1-256, default xxx): [the number obtained from the equation 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))

Configure boot flag in the first partition, and male it bootable.

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

Create the partition for Linux file system.

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 the setting of the 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.

Formatting filesystem

Format the FAT32 partition and the Linux partition, individually. The first line of each command, FAT32 and EXT3 indicate
the labels of the partitions, respectively. You can replace “FAT32” and “EXT3” with the names of partitions depending on
your preference.

This is for FAT32 partition. At the end of the first line, “FAT32” indicates the name of partition, you can label the name
whatever you like.

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

This is for Linux partition. At the first command line, “EXT3” (the capital letters) suggest that the location of the partition
name. It can be replaced with own partition name.

$ [sudo mkfs.ext3 -L EXT3 /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: 

Placing prebuilt-image file

Putting MLO into FAT32 partition

To place the file in FAT32 partition, there are some restrictions. Please follow the instruction carefully. The archive is
extracted at the working environment.

$ [tar xvfz FAT.tar.gz]

The extracted archive contains a file.

$ ls FAT.tar.gz
MLO u-boot.bin uImage

Since X-Loader (MLO) is the first boot loader, there are strict order to place the file to the SD card. Please follow the
instructions, carefully.

  • After formatting FAT32 directory, MLO is placed first.
  • MLO is put at the top directory in the partition.
    $ [cp MLO /media/FAT32/]
    There are no specific rules for how to put other files. Copy these files on the SD card as they are.
    $ [cp u-boot.bin boot. Scr uImage/media/FAT32]
    If you have made mistakes and/or done it in wrong order, redone from the part of formatting Fat32 partition.

Placing files into EXT3 partition

There are no specific restriction for placing the created files. The archive is extracted on the SD card.

$ [sudo tar xvfz ext3.tar.gz -C /media/EXT3]

This is the end of transferring the prebuild image onto the SD Card. To do sync for saving all changes, then unmount the SD card.

$ [sudo sync]
$ [unmount /media/EXT3]
$ [unmount/ media/FAT32]

Booting from SD card

To insert the prepared SD card into the SD card slot of bc10, turn on power supply. For the first time booting, DB is made for
setting up SQLite and Dalvik EXecutable.dat is created. These newly created information is written into bootable disk.
Thus, the first time booting takes a lttle longer than usual.

Supplements

Key assignment

There are seven buttons on the right hand side of bc10 (seven buttons on each side, and totally 14 buttons).
As Picture a is indicated, each button has been pre-assigned for a different task. To change the program, the assignment of
each key is also altered.
(In the picture, the enclosure of bc10 is a prototype.)

1. Menu
2. Back
3. Home
4. Up
5. Left
6. Right
7. Down
keypad_android.jpg

About Android SGX

As explaining at the last line of init.rc, SGX functions remain effective. To make SGX ineffective, please comment out
the lines of commands. As kernel and/or userland are updated or modified, not only kernel and/or userland, but also GSX are needed
to be rebuild.

$ vi init.rc
# Start PowerVR SGX DDK
service pvr /system/bin/sgx/rc.pvr start

Order of configuring bc10 Wifi

As Android is not capable of control on/off function of wifi over its GUI, apply insmod and netcfg commands to check
the working status of wifi functionality. This wifi configuration method is only applicable the devices, which is equipped with
RT3070USB driver.

Maker      Parts Number       Device ID
PLANEX     GW-USMicroN-G      2019:ED14
Logitec    LAN-W150N/U2IPH    0789:0164
Logitec    LAN-W150N/U2BK     0789:0168
Buffalo    WLI-UC-GNM         0411:01a2
Buffalo    WLI-UC-GN          0411:015d
Buffalo    WLI-UC-G301N       0411:016f&#12288;&#12288;&#12288;&#12288;Baffalo WLI-UG-G301N works only as it is connected to a USB AC-powered hub.

One of the RT3070USB devices shown in the table above is connected to bc10, and bc10 is booted. As the device is recognized,
the serial console displays such outputs as shown below.~ (This is an example of connecting WLI-UC-GN)

 ...
usb 1-2.4: new high speed USB device using ehci-omap and address 3
usb 1-2.4: New USB device found, idVendor=0411, idProduct=015d
usb 1-2.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-2.4: Product: 802.11 n WLAN
usb 1-2.4: Manufacturer: Ralink
usb 1-2.4: SerialNumber: 1.0
...

After booting is completed, execute insmod on the rt3370sta.ko file. Apply netcfg command to the device, and execute
up dhcp. RT2870STA.dat is used for connecting to the SSID, which is specified in the rt3370sta.ko file. The following
outputs, which are displayed in the serial console, are resulted from the connection up to netcfg dhcp connection.
(The some parts of logs are not shown. RT2870STA.dat, which is located at '''/system/lib/module is not used here.)

# cd /system/lib/modules
# ls
RT2870STA.dat  rt3370sta.ko
# netcfg
lo       UP    127.0.0.1       255.0.0.0       0x00000049
# insmod rt3070sta.ko
...
# netcfg
lo       UP    127.0.0.1       255.0.0.0       0x00000049
ra0      DOWN  0.0.0.0         0.0.0.0         0x00001002
# netcfg ra0 up 
...
# netcfg
lo       UP    127.0.0.1       255.0.0.0       0x00000049
ra0      UP    0.0.0.0         0.0.0.0         0x00001043
# netcfg ra0 dhcp
# netcfg
lo       UP    127.0.0.1       255.0.0.0       0x00000049
ra0      UP    192.168.13.4    255.255.255.0   0x00001043
#  

RT2870STA.dat in the prebuilt image is configured in the way as it is shown below. The configuration is highly depending on
working environment, please set up RT2870STA.dat for the working environment.

An an example of connection configuration, the example below is listed in SSID (xxx-BC):

authentication method (AuthMode OPEN)
encryption scheme (EncryType WEP)
typeface of encryption key (Key1Type1 (scsii))
and encryption key (Key1Str xxx.testessid).


For the farther explanations, please look at 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO/README_STA_usb.

  • RT2870STA.dat
      ...
    SSID=ssidname
    NetworkType=Infra
    WirelessMode=5
    Channel=0
    BeaconPeriod=100
    TxPower=100
    BGProtection=0
    TxPreamble=0
    RTSThreshold=2347
    FragThreshold=2346
    TxBurst=1
    PktAggregate=0
    WmmCapable=1
    AckPolicy=0;0;0;0
    AuthMode=authmodetype
    EncrypType=encyptype
    WPAPSK=
    DefaultKeyID=1
    Key1Type=0
    Key1Str=
     ...
  • An example of the connection set up
    SSID=XXX-BC
     ...
    AuthMode=OPEN
    EncrypType=WEP
    WPAPSK=
    DefaultKeyID=1
    Key1Type=1
    Key1Str=xxx.testessid
    Key2Type=0

About USB Wifi (RT3070USB) driver

The prebuilt image is built with += -DCONFIG_STA_SUPPORT. Under this configuration, debug logs are not output and critical logs are
not obtainable. The original file is put under the directory of os/linux/config.mk. This file is configured as WFLAGS += -DCONFIG_STA_SPPORT -DDBG
and produces more than adequate amounts of debug logs. Since a lot of debug logs are issued, it may be difficult to work under the original setting.

$ vi os/linux/config.mk

# config for STA mode

ifeq ($(RT28xx_MODE),STA)
WFLAGS += -DCONFIG_STA_SUPPORT -DDBG

Also, a debugged and printed version of rt3370sta.ko, rt3370sta.gz is available at the URL below. To use this file, download
the file, and replace the original, which is located at the directory of /system/lib/modules/. The name of the original file is
the same as new one.

http://sourceforge.jp/projects/bc10-dev/releases/50494/

The log shown below is a real log, which is displayed on a serial console. This log is generated as '''RT3070USB is inserted
and insmod rt3370sta.ko is executed.

  • This is a log of WFLAGS += - DCONFIG_STA_SUPPOT -DDBG
    # insmod rt3370sta.ko
    rtusb init --->
    ===>rt2870_probe()!
    --> RTMPAllocAdapterBlock 
    
    
    === pAd = d284d000, size = 503240 ===
    
    <-- RTMPAllocAdapterBlock, Status=0
    NumEndpoints=7
    BULK IN MaxPacketSize = 512
    EP address = 0x81
    BULK OUT MaxPacketSize = 512
    EP address = 0x 1
    BULK OUT MaxPacketSize = 512
    EP address = 0x 2
    BULK OUT MaxPacketSize = 512
    EP address = 0x 3
    BULK OUT MaxPacketSize = 512
    EP address = 0x 4
    BULK OUT MaxPacketSize = 512
    EP address = 0x 5
    BULK OUT MaxPacketSize = 512
    EP address = 0x 6
    STA Driver version-2.4.0.1
    NVM is EEPROM
    Allocate a net device with private data size=0!
    Allocate net device ops success!
    The name of the new ra interface is ra0...
    RtmpOSNetDevAttach()--->
    <---RtmpOSNetDevAttach(), ret=0
    <===rt2870_probe()!
    usbcore: registered new interface driver rt2870
    # netcfg
    lo       UP    127.0.0.1       255.0.0.0       0x00000049
    ra0      DOWN  0.0.0.0         0.0.0.0          0x00001002
  • WFLAGS += -DCONFIG_STA_SUPPORT
    # insmod rt3370sta.ko
    rtusb init --->
    usbcore: registered new interface driver rt2870
    # netcfg
    lo       UP    127.0.0.1       255.0.0.0       0x00000049
    ra0      DOWN  0.0.0.0         0.0.0.0         0x00001002

About boot.scr

Due to update u-boot-bc10, the initial value, which treats AMOLED as the display device, is already written under the directory of
include/configs/omap3_bc10h. Therefore boot.scr is not included the newer version of u-boot-bc10

To copy the contents of the original boot.scr to the newer boot.scr, it can is possible to boot the bc10. In this case, configuration of
u-boot.bin is written over on the configuration of boot.scr, then, bc20 is booted. The script blow is used for creating a boot.scr,
which makes AMOLED the default value for display device.

$ 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=256M androidboot.console=ttyS2 console=tty0  
console=ttyS2,115200n8 root=/dev/mmcblk0p2 init=/init rootwait omapdss.def_disp=lcd'
bootm 84000000
(Caution) From setenv bootargs to disp=lcd', these are supposed to be one line.
$ mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n ./boot.script -d ./boot.script ./boot.scr &> /dev/null

If DVI is selected for the initial value of display device, the last line of the code shown above will be change as omapdss.def_disp=dvi
in boot.scr.
The details of omapfb.mode and mapdss are listed in the file, which is located at the directory of kernel/Documentation/arm/OMAP/DSS in the kernel source

Reference

Revision History

2011/02/23 This article is initially uploaded.


Attach file: file2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO.bz2 875 download [Information] fileRT3070USB.diff 1076 download [Information] filekeypad_android.jpg 987 download [Information]

Front page   Edit Freeze Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   RSS of recent changes
Last-modified: 2011-02-22 (Tue) 13:04:29 (2795d)