[bc10]
-Contents
#CONTENTS

* Outline [#pe8cd498]
>
This article explains how to build “android-2.3.2_r1” for bc10.
The directions of the building process are shown below.
+ Building the development environment in which '''build''' is actually executed
+ Obtaining the source code of the android open source project
+ Building bc10-kernel and the kernel module for USB wifi
+ Adding patches, and modifying android for bc10
+ Building android
+ Installing SGX SDK
+ Writing into SD card

>
COLOR(red){}

* Creating build environment. [#x0ec48e1]
>
The requirements for the development environment are shown below.
- OS: Ubuntu 10.04 (64bit version)
- JAVA: java 1.6x
- Android: android-2.3.2_r1

>
COLOR(red){Android 2.3 (Gingerbread ) or newer  versions needs a 64bit development environment}

>
This section follows the instructions of [[“Setting up your machine":http://source.android.com/source/download.html]] at “Getting the Source” page of Android Open Source Project.

** java6 [#n3a03865]
>
Applying the commands below, obtain the sun java package form the Ubuntu repository. Then, install the java package.
 $ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
 $ sudo add-apt-repository "deb-src http://archive.canonical.com/ubuntu lucid partner"
 $ sudo apt-get update
 $ sudo apt-get install sun-java6-jdk
 $ sudo update-java-alternatives -s java-6-sun

** Installing package [#c7003686]
> Using a command line below, pick up the required packages from the Ubuntu repository, then, install the packages.
(Actually, the command line show below is one line, the breaks (\) are added intentionally.)
 $ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev \
  gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs \
  x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev

* Obtaining android source [#v10768d1]
** Configuration of repository [#fb6bdf27]
>
To obtain the source code of Android, set up '''repo'''.
 $ cd ~
 $ mkdir bin
 $ curl http://android.git.kernel.org/repo >~/bin/repo
 $ chmod a+x ~/bin/repo
To take PATH to '''~/bin''', you just log-out Ubuntu once and log-in again. If you like to keep on log-in the Ubuntu environment, your need '''~/bin''' to PATH of environment variable. To export PATH, apply the command below.
 $ export PATH=~/bin:$PATH

** Initializing repo [#y49a659f]
>
Create the working directory called '''bc10''', execute '''repo init''' for obtaining '''android-2.3.2_r1 tag''' (The name of the working directory is arbitrary. You may call the directory in any name such as “android-2.3.2_r1.” If you name it your own rather than the example, please change the configuration of PATH.)
 $ cd ~/
 $ mkdir bc10 
 $ cd bc10
 $ repo init -u git://android.git.kernel.org/platform/manifest.git -b android-2.3.2_r1

** repo sync [#sdbc84d2]
>
After executing '''repo init''', run '''repo sync'''. Then, download the source code of a android.
 $ repo sync
The size of file is roughly 5GB. It takes time to download the file, and its duration highly depends on the speed of network.

* Building kernel [#w24fb237]
>
To turn on/off Wifi from UI of android, the kernel module of USB wifi will be needed to placed in userland. Before building android, the kernel module of USB wifi should be built. As this USB wifi kernel built requires the kernel source tree of already built kernel, kernel for bc10 is built first.

** Configuring environment variable [#qec3688f]
>
'''x-loader''', '''u-boot''', and '''kernel''', which  are necessary for booting,  are built from cross toolchain, which is included in the source code of android. Specifically, '''arm cross toolchain''' is used here, and this toolchain is located inside of the directory of '''prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/'''.

> 
To let '''arm cross toolchain''' do cross compile during the build process,  the configuration of the environment variable is changed.
 $ export PATH=/home/beat/bc10/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:${PATH}
 $ export ARCH=arm
 $ export CROSS_COMPILE=arm-eabi-

** kernel [#t6985412]
>
 $ cd ~/
 $ git clone git://gitorious.org/~bc-dev/rowboat/bc10-rowboat-kernel.git bc10-rowboat-kernel
 $ cd ~/bc10-rowboat-kernel/

>
Change to the release branch for bc10.
If you need only wifi module, you can omit '''make module''' from the command lines below.
 $ git checkout -t -b bc10-2.6.32 origin/bc10-2.6.32
 $ make omap3_bc10_defconfig
 $ make uImage
 $ make modules

>
After the build process is completed, '''uImage''' is created at the directory shown bwlow.
 $ ls ~/bc10-rowboat-kernel/arch/arm/boot/
 Image  Makefile  bootp  compressed  install.sh  uImage  zImage

* Building USB Wifi (RT3070USB) driver [#kb9d6a8a]
>
To use an USB Wifi device, install the drivers for RT3070USB.~
The devices that have confirmed to work with bc10 are listed below.
| Maker | Serial Number | Vendor ID | Device ID | Memo |h
| PLANEX  | [[GW-USMicroN-G>http://www.planex.co.jp/product/wireless/gw-usmicron-g/]] | 2019 | ED14 | Discontinued |
| Logitec | [[LAN-W150N/U2IPH>http://www.pro.logitec.co.jp/pro/g/gLAN-W150NU2M]] | 0789 | 0164 | |
| Logitec | [[LAN-W150N/U2BK>http://www.pro.logitec.co.jp/pro/g/gLAN-W150NU2BK/]] | 0789 | 0168 | |
| Buffalo | [[WLI-UC-GNM>http://buffalo.jp/product/wireless-lan/client/wli-uc-gnm/]] | 0411 | 01a2 | |
| Buffalo | [[WLI-UC-G301N>http://buffalo.jp/products/catalog/network/wli-uc-g301n/]] | 0411 | 016f |This only works when it is connected to a powered hub. |
| Buffalo | [[WLI-UC-GN>http://buffalo.jp/products/catalog/network/wli-uc-gn/]] | 0411 | 015d | |
The driver used here is a Linux driver, which is listed at RALINK web site. The name of driver is '''2011_0107_RT3070_RT3370_Linux_SAT_v2.5.0.1_DPO.tar.bz2'''. To download the driver, your name and mail address are required. The file downloaded from there can be placed at the directory of '''/home/beat/'''. (Hereafter, the working directory is assumed to be '''/home/beat/'''.)

>
To build the drover, employ the same cross toolchain,which has been used for building kernel. The toolchain is located at the dierctory of '''prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/'''.

> 
To apply a patch, the toolchain can cross compile for bc10. The list of modifications, which are resulted from the the patch. The major changes are shown below.
- Adding the specific compiler configuration for bc10 (platform, PATH of toochain, configuration of compile flag)
- Modifying the firmware. The region is set for “Japan,” and the list of other entires are simplified.
- Vender ID and product ID of USB Wifi are added.

>>
#ref(2011_0107_RT3070_RT3370_Linux_STA_v2.5.0.1_DPO.tar.bz2)~
#ref(RT3070-2.5.0.1.diff)~

>
[2011_0107_RT3070_RT3370_Linux_STA_v2.5.0.1_DPO.tar.bz2]
[RT3070-2.5.0.1.diff]
>
To check the effect of the patch, you can see the difference as applying the command line.
 diff -urN 2011_0107_RT3070_RT3370_Linux_STA_v2.5.0.1_DPO/ 2011_0107_RT3070_RT3370_Linux_STA_v2.5.0.1_DPO-bc10/
After applying the command line above, the modified source is renamed as '''2011_0107_RT3070_RT3370_Linux_STA_v2.5.0.1_DPO-bc10''' and compared to its original.
The difference is shown below. (“---”  or “-”indicates removed ones, and “+++” or “+”are added.)
-  Modifications for bc10 configuration

>
 --- 2011_0107_RT3070_RT3370_Linux_STA_v2.5.0.1_DPO/Makefile     2011-01-07 11:18:32.000000000 +0900
 +++ 2011_0107_RT3070_RT3370_Linux_STA_v2.5.0.1_DPO-bc10/Makefile        2011-01-30 15:09:46.023581979 +0900
 @@ -23,7 +23,8 @@
 RTMP_SRC_DIR = $(RT28xx_DIR)/RT$(CHIPSET)
 
  #PLATFORM: Target platform
 -PLATFORM = PC
 +PLATFORM = BC10
 +#PLATFORM = PC
 #PLATFORM = 5VT
 #PLATFORM = IKANOS_V160
 #PLATFORM = IKANOS_V180
 @@ -176,6 +177,11 @@
  CROSS_COMPILE =
  endif
 
 +ifeq ($(PLATFORM),BC10)
 +LINUX_SRC = /home/beat/bc10-rowboat-kernel
 +CROSS_COMPILE = /home/beat/bc10/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
 +endif
 +
  ifeq ($(PLATFORM),IXP)
  LINUX_SRC = /project/stable/Gmtek/snapgear-uclibc/linux-2.6.x
  CROSS_COMPILE = arm-linux-
 @@ -384,6 +390,9 @@
        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
 @@ -392,6 +401,7 @@
  endif
  endif
  endif
 +endif
 
 
 release:

>
- The changes for the regional setting and configurations

>
 --- 2011_0107_RT3070_RT3370_Linux_STA_v2.5.0.1_DPO/RT2870STA.dat        2011-01-07 11:18:32.000000000 +0900
 +++ 2011_0107_RT3070_RT3370_Linux_STA_v2.5.0.1_DPO-bc10/RT2870STA.dat   2011-01-30 15:18:32.301699483 +0900
 @@ -1,8 +1,8 @@
  #The word of "Default" must not be removed
  Default
  CountryRegion=5
 -CountryRegionABand=7
 -CountryCode=
 +CountryRegionABand=1
 +CountryCode=JP
  ChannelGeography=1
  SSID=11n-AP
  NetworkType=Infra
 @@ -18,8 +18,8 @@
  PktAggregate=0
  WmmCapable=1
  AckPolicy=0;0;0;0
 -AuthMode=OPEN
 -EncrypType=NONE
 +AuthMode=authtype
 +EncrypType=encrtype
  WPAPSK=
  DefaultKeyID=1
  Key1Type=0

>
- Adding Vender_ID:Device_ID

>
 --- 2011_0107_RT3070_RT3370_Linux_STA_v2.5.0.1_DPO/os/linux/config.mk   2011-01-07 11:20:51.000000000 +0900
 +++ 2011_0107_RT3070_RT3370_Linux_STA_v2.5.0.1_DPO-bc10/os/linux/config.mk      2011-01-30 15:36:50.191769728 +0900
 @@ -11,7 +11,7 @@
  HAS_XLINK=n
 
  # Support Wpa_Supplicant
 -HAS_WPA_SUPPLICANT=n
 +HAS_WPA_SUPPLICANT=y
 
  # Support Native WpaSupplicant for Network Maganger
  HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=n
 @@ -415,6 +415,10 @@
      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)

>
- Adding GPL flags (Without these flags, '''insmod''' cannot be applicable.)

>
 --- 2011_0107_RT3070_RT3370_Linux_STA_v2.5.0.1_DPO/os/linux/usb_main_dev.c      2011-01-07 11:18:32.000000000 +0900
 +++ 2011_0107_RT3070_RT3370_Linux_STA_v2.5.0.1_DPO-bc10/os/linux/usb_main_dev.c 2011-01-30 14:38:08.011046027 +0900
 @@ -37,6 +37,7 @@
  /* Otherwise post to forum in ralinktech's web site(www.ralinktech.com) and let all users help you. *** */
  MODULE_AUTHOR("Paul Lin <paul_lin@ralinktech.com>");
  MODULE_DESCRIPTION("RT2870 Wireless Lan Linux Driver");
 +MODULE_LICENSE("GPL");
  #ifdef CONFIG_STA_SUPPORT
  #ifdef MODULE_VERSION
  MODULE_VERSION(STA_DRIVER_VERSION);

>
The extension of the distributed source archive is denoted as '''bz2''', but the files are compressed with '''gzip'''. After extracting the archives, '''apply''' patch and execute '''make'''. The instructions are shown below.
 $ cd ~/
 $ tar xvfz 2011_0107_RT3070__RT3370_Linux_STA_v2.5.0.1_DPO.tar.bz2 
 $ patch -p0 < RT3070-2.5.0.1.diff
 $ cd 2011_0107_RT3070__RT3370_Linux_STA_v2.5.0.1_DPO/
 $ make
 $ ls -l os/linux/rt3070sta.ko
 -rw-r--r-- 1 beat beat 8809768 2011-01-30 21:58 rt3070sta.ko

>
After the '''make''' process is completed, '''rt3070sta.ko''' is created.

* Obtaining the additional files for bc10 [#jf9fc690]
>
To building '''android-2.3.2_r1''' for bc10, apply '''git clone''' and obtain the extra files from github repository.

** alsa_sound [#jcaf78d8]
>
Use the commands below, '''also_sound''' is added to '''android-2.3.2_r1'''.
 $ cd ~bc10/hardware/
 $ git clone git://github.com/bc-dev/2.3-hardware-alsa_sound.git alsa_sound

** alsa-lib and also-utils [#h6f0c1b9]
>
To apply the commands, alsa-lib and alsa-utils are included in '''android-2.3.2_r1'''.
 $ cd ~/bc10/external/
 $ git clone git://github.com/bc-dev/2.3-external-alsa-lib.git alsa-lib
 $ git clone git://github.com/bc-dev/2.3-external-alsa-lib.git alsa-utils

** bc10 device build files [#fccd21a0]
>
To apply the commands show below, the build configuration files are added to '''android-2.3.2_r1'''.
$ cd ~/bc10/device
$ git clone git://github.com/bc-dev/2.3-device-beatcraft.git beatcraft

* Application of patch and location of files [#l9f4bef8]
>
This patch is not for adding files to the source, but this modifies the source code of '''android-2.3.2_r1''' for bc10.

** Obtaining patch [#he06eb4f]
>
To employ the commands shown below, obtain patch files.
 $ cd ~/
 $ git clone git://github.com/bc-dev/2.3-patches.git

** wpa_supplicant_6 [#r697df82]
>
Apply a patch to '''wpa_supplicant_6'''. This patch  makes USB wifi manageable from the UI of Android.
 $ cd ~/bc10/external/wpa_supplicant_6
 $ cp ~/2.3-patches/external-wpa_supplicant_6.diff .
 $ patch -p1 < external-wpa_supplicant_6.diff 

** ti omap3 [#rfed05e3]
>
As bc10 is equipped with OMP3530, it is recognized as '''TARGET_BOARD=omap3''' in  the building configuration file. As this setting is effective, code are built under the directory of android-2.3.2_r1/hardware/ti/omap3/'''. The code are not fixed for Gingerbread, and it is not applicable to OMAP3530. This patch prevents building the code.
 $ cd ~/bc10/hardware/ti/omap3
 $ cd ~/2.3-patches/hardware-ti-omap3.diff
 $ patch -p1 < hardware-ti-omap3.diff

** Placing USB Wifi driver [#n368aeb1]
>
Copy the patched firmwares and the drier of RT3070USB, which, is discussed and built in the previous section, to '''device/beatcraft/bc10/'''.
 $ cd ~/bc10/2011_0107_RT3070__RT3370_Linux_STA_v2.5.0.1_DPO/
 $ cp os/linux/rt3070sta.ko ~/bc10/device/beatcraft/bc10/
 $ cp RT2870STA.dat ~/bc10/device/beatcraft/bc10/
Each file placed in this directory  is copied to its appropriate directory. Please look at the variables on PRODUCT_COPY_FILE, which are listed on '''~/bc10/device/beatcraft/bc10/device.mk'''.

>
The prebuilt images of '''uImage''', '''RT3070sta.ko''', and '''RT2870STA.dat''' are registered at git repository of '''device/beatcraft/bc10/'''. You may create a boot image of android with these prebuilt images. If you would like to use the prebuilt images, we recommend that the kernel and drivers, which are compatible the kernel, should be built at your own development environment.~
Now, the preparation for the build process is completed.~

* Building Android [#s6a6c1df]
>
Setting up the environment variables of bc10 for building android.
 $ cd ~/bc10
 $ source build/envsetup.sh
 including device/beatcraft/bc10/vendorsetup.sh
 including device/htc/passion/vendorsetup.sh
 including device/samsung/crespo/vendorsetup.sh
 $ lunch
 
 You're building on Linux
 
 Lunch menu... pick a combo:
      1. generic-eng
      2. simulator
      3. full_bc10-eng
      4. full_passion-userdebug
      5. full_crespo-userdebug
 
 Which would you like? [generic-eng] [3] &#8592; input 3  and press enter
 
 ============================================
 PLATFORM_VERSION_CODENAME=REL
 PLATFORM_VERSION=2.3.2
 TARGET_PRODUCT=full_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=GRH78C
 ============================================

>
After checking the configuration, execute '''make'''.
 $ make

>
As '''make''' is executed, the number of CPU's  cores can change depending on your development environment. As applying to '''-j2''', it is executed as parallel computing, and it will significantly reduces the duration of the building process. As adding '''showcommands''' to '''make''', the logs of the commands will be output. You may receive the detail information of building process.

>
- Example:

>
 $ time make showcommands -j2 2>&1 | tee make.log-20110201-01

* Additional build [#af4667a3]
>
The building process described above is completed, execute commands below under the same environment variables are applied. The commands will additionally build the HAL modules for GPS and other sensors.
 $ cd ~/bc10/device/beatcraft/bc10/libgps
 $ mm
 $ cd ~/bc10/device/beatcraft/bc10/libsensors
 $ mm

*Creating image [#v7c28b8d]
>
The built file is housed at the directory of  '''out/target/product/bc10/'''. The contents of the files are shown below.
 $ cd ~/bc10/out/target/product/bc10
 $ ls -al
 drwxr-xr-x  8 beat beat      4096 2011-02-01 20:29 .
 drwxr-xr-x  3 beat beat      4096 2011-02-01 19:47 ..
 -rw-r--r--  1 beat beat        11 2011-02-01 19:47 android-info.txt
 drwxrwxrwx  8 root root      4096 2011-02-01 20:32 bc10-image
 -rw-r--r--  1 beat beat      3727 2011-02-01 20:23 clean_steps.mk
 drwxr-xr-x  3 beat beat      4096 2011-02-01 19:53 data
 -rw-r--r--  1 beat beat     22633 2011-02-01 20:02 installed-files.txt
 drwxr-xr-x 14 beat beat      4096 2011-02-01 20:02 obj
 -rw-r--r--  1 beat beat       230 2011-02-01 20:23 previous_build_config.mk
 -rw-r--r--  1 beat beat    142336 2011-02-01 19:57 ramdisk.img
 drwxr-xr-x  8 beat beat      4096 2011-02-01 19:57 root
 drwxr-xr-x  5 beat beat      4096 2011-02-01 19:57 symbols
 drwxr-xr-x 12 beat beat      4096 2011-02-01 19:58 system
 -rw-------  1 beat beat 104951616 2011-02-01 20:02 system.img
 -rw-------  1 beat beat   1482624 2011-02-01 19:53 userdata.img

>
Applying the commands below, move userland to the bootable place.
 $ mkdir bc10-image
 $ cp -afr root/* bc10-image/
 $ cp -afr system/* 
 $ sudo chown -R root.root bc10-image/
 $ sudo chmod -R 777 bc10-image/

>
After userland is relocated, its contents are shown below.
 $ cd bc10-image
 $ ls -al
 drwxrwxrwx  8 root root  4096 2011-02-01 20:32 .
 drwxr-xr-x  8 beat beat  4096 2011-02-01 20:29 ..
 drwxrwxrwx  2 root root  4096 2011-02-01 19:47 data
 -rwxrwxrwx  1 root root   118 2011-02-01 19:47 default.prop
 drwxrwxrwx  2 root root  4096 2011-02-01 19:47 dev
 -rwxrwxrwx  1 root root   904 2011-02-01 15:35 gps_init.sh
 -rwxrwxrwx  1 root root 90084 2011-02-01 19:57 init
 -rwxrwxrwx  1 root root  1677 2011-02-01 14:27 init.goldfish.rc
 -rwxrwxrwx  1 root root   917 2011-02-01 15:08 init.omap3.rc
 -rwxrwxrwx  1 root root 15018 2011-02-01 17:15 init.rc
 drwxrwxrwx  2 root root  4096 2011-02-01 19:47 proc
 drwxrwxrwx  2 root root  4096 2011-02-01 19:57 sbin
 drwxrwxrwx  2 root root  4096 2011-02-01 19:47 sys
 drwxrwxrwx 12 root root  4096 2011-02-01 20:30 system
 -rwxrwxrwx  1 root root     0 2011-02-01 14:27 ueventd.goldfish.rc
 -rwxrwxrwx  1 root root   231 2011-02-01 15:08 ueventd.omap3.rc
 -rwxrwxrwx  1 root root  3764 2011-02-01 14:27 ueventd.rc

* Installing SGX SDK [#bec05e13]
>
To apply the same method as [[bc10/froyo]], obtain TI Android SDK.~
(Caution):~
- Whole process takes quite long time.
- If you have already downloaded and installed '''OMAP35x_ Android_Graphics_SDJ_3_01_00_03''' for bc10/froyo'''. Basically, the file is the same, and you may use it for this section. There are no issues on reusing the same file. Please be careful with the  location of  '''Rule.make''' directory. If download the same file again, please treat the old one as a backup or delate it.
- As changing a part of  kernel and/or Android userland, whole of kernel and Android is needed to be rebuilt.

> 
 $ 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  
The location of install directory is asked. In this example, select the default directory, '''${HOME}/OMAP35x_Android_Graphics_SDK_3_01_00_03'''. '''${HOME}''' means the home directory, it indicates the directory of '''/home/beat/'''.~

>
[[To download TI's Android SGX SDK]]

** Modifying Rules.make [#k2c4f6c4]
>
In the file of '''Rules.make''',  “Home”, “GRAPHICS_INSTALL_DIR”, “ANDRID_RooT”, “CSTOOL_DIR”, and “KERNEL_INSTALL_DIR” are needed to change their original file PATHs. The file PATH have to be the present locations of these files. The example is shown below. Please use it as a reference.
  $ cd ~/OMAP35x_Android_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.3
 +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
In this example, the setting of directories are determined at the build configuration. “ANDROID_ROOT” is relevant to the location of bc10-image directory.~
After '''Rules.make''' are modified, execute '''make''' and '''make install'''.
 $ make
 $ make OMAPES=3.x install

* Building other files [#zf7ce007]
** u-boot [#z985366d]
>
Because of updating, '''u-boot-bc10''' is modified for including the configuration of '''boot.scr''' whose default value of display device  is AMOLED. At booting period, the waiting time of '''u-boot shell''' is changed form 10 seconds to 2 seconds. To apply commands below, obtain the source code and built it.
 $ 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 configuration, which treats AMOLED as the default value of display device, is placed under the directory of '''u-boot-bc10/include/configs/omap3_bc10.h'''.
 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" \ 
This resembles the configuration 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
(Caution)From '''setenv bootargs''' to '''disp=lcd''', this is one line of command.

>
After the build process is finished, '''u-boot.bin''' is copied at the FAT partition of the targeted SD card. The copy must have done after MOL file is copied. (MLO must be copied to FAT partition first.) For the details of creation of SD card, please look at the section of “Creating a bootable SD card”, which is listed below.

** x-loader [#g0060a3a]
> 
To apply the commands shown below, obtain and build the source code.
 $ 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
Since the specifications and format of '''x-load.bin''' do not match with OMAP BootROM's ones,  '''x-load.bin''' does not work as boot loader in the NAND Flash or a SD card. To solve this issue, apply '''signGP''', and modify '''x-load.bin'''. '''signGP''' can be downloaded from [[http://beagleboard.googlecode.com/files/signGP]]. '''signGP''' can be used as it is shown below.
 $ signGP x-load.bin
'''x-load.bin.ift''', which is produced in the build process, is renamed as ''MLO''. MLO is a file, which is installed in the top of FAT partition. The details of creating SD card image is shown below.
Please look at the section of “Creating a bootable SD card.”
 $ mv x-load.bin.ift MLO

* Creating bootable SD card [#f89b7d91]
>
This article is originally published at the [[Create bootable SD card of bc10/booting]]. The instructions apply to only SD card. (bc10 cannot boot from microSD by design.)~
The partitions of SD card and the files contained in these partitions are shown below.~
- FAT32 Partition 
-- X-Loader
-- U-Boot
-- Linux kernel (Android Version)

>
- Linux Partition
-- Android root file system

>
The working environment is assumed to be Linux.~
The directions of process is shown below.~
+ Initializing and configuring the partitions
+ Formatting file system
+ Placing files

>
These instructions are based upon [[LinuxBootDiskFormat (code.google.com)]], and its details are arranged for bc10.

** Unmounting  SD card [#a30435c3]
>
To start working on a SD card, please unmount the SD card. As partitioning and formatting the SD card, it is needed to be unmounted.
 $ df -h

>
 Filesystem            Size  Used Avail Use% Mounted on
 ...
 /dev/sdc1             400M   94M  307M  24% /media/disk
 ...
Then, unmount the SD card.
 $ umount /media/disk

** Initializing and configuring partition [#z1d7338f]
>
To use '''fdisk''' command, obtain the basic information of the SD card. To initialize and configure the SD card, the parameter is the device file of the SD card. The location of the file may change, depending on your working environment. This is an example. The location of files may vary Please check your working environment before start working on the SD card.
  $ sudo fdisk /dev/sdc

>
 Command (m for help): [p]
 &#12288;
 Disk /dev/sdc: 2021 MB, 2021654528 bytes
 255 heads, 63 sectors/track, 245 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes
&#12288;
    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 dow the number of bytes on the SD card. This number will be used later. 
 (In this example, it is 2021654528.)

>
Erase all partitions
 Command (m for help): [d]
 Selected partition 1

>
Turn to expert mode.
 Command (m for help): [x]

>
According to the results of '''fdisk''', the number of heads is 255.
 Expert Command (m for help): [h]
 Number of heads (1-256, default xxx): [255]

>
Also, from the outputs of '''fdisk''', the number of sectors is 63.
 Expert Command (m for help): [s]
 Number of sectors (1-63, default xxx): [63]

>
The number of cylinders highly depends on a SD card. The figure that is used for calculating the number of cylinders. The outcome is truncated below decimal point, do not be rounded.
 #cylinders = FLOOR(the number of Bytes on the SD Card/#heads/#sectors/#some )
 #some is used for calculating units in the results of “fdisk” (Not #cylinders, the other number). 
 In this example it will be “512”.

>
The application of this figure is shown below.
 2021654528 / 255 / 63 / 512 = 245.79
 -> 245

>
The number of cylinders for this example is 245
 Expert Command (m for help): [c]
 Number of cylinders (1-256, default xxx): [245]

>
Go back to the normal mode
 Expert Command (m for help): [r]

>
Create FAT32 partition
 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 the boot flags
 Command (m for help): [a]
 Partition number (1-4): [1]

>
Create Linux file system system partition
 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 the configurations 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 change 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 file system [#xe0a6f11]
>
FAT32 partition and Linux partition are formatted separately.~
In the commands shown below, “FAT32” and “EXT3” define the names of partitions. These names are just examples, and you may choose any names you prefer.~
 $ [sudo mkfs.msdos -F 32 /dev/sdc1 -n FAT32]
 mkfs.msdos 2.11 (12 Mar 2005)

>
 $ [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)
 1 95072 inodes, 389576 blocks
 19 478 blocks (5.00%) reserved for the super user
 Fir st data block=0
 Ma ximum 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:  

* Writing files into SD card [#v0919cd9]
** Placing files on FAT32 partition [#f363d48a]
>
There are several restrictions on the instillation of '''X-Loader (MLO)''' on the SD card. The restrictions are shown below.
- After formatting FAT32 partition, MLO is placed first.
- Put it at the top directory inside the partition.

>
 $ cd ~/bc10/x-load-bc10/
 $ sudo cp MLO /media/FAT32/ 
Other files do not have any restrictions. Just copy the files to the SD card.
 $ cd ~/bc10/u-boot-bc10/
 $ sudo cp u-boot.bin /media/FAT32/
 $ cd ~/bc10/bc10-rowboat-kernel/arch/arm/boot/
 $ sudo cp uImage /media/FAT32/
If you have made mistakes on this process, or any process are not succeeded, please redo from the section of creating F32 partition.

** Put files on EXT3 partition [#zf034ce1]
>
There are no specific regulations on  how to place the files. '''bc10-image/''' can copied to EXT3 partition of the SD card.
 $ cd ~/bc10/out/target/product/bc10/bc10-image/
 $ sudo cp -a * /media/EXT3/
This is the end of copying the bootable image to a SD card.~
Please do '''sync''' first, then, unmount the SD card.
 $ sudo sync
 $ umount /media/EXT3
 $ umount /media/FAT32

* Booting from SD card [#l3ca8110]
>
Insert the prepared SD card into the SD card slot of bc10. Then, turn on the power supply. At the first time, Android takes long time for booting since it creates'''SQLite''' configuration DB and Dalvik Executable (.dex) file and writes on the hard drive.~

>
This is the end of the creating the bootable image of Android 2.3.2_r1 for bc10.~

* Remarks [#uaf4bd8b]
** Allocation of buttons [#va20d1e3]
bc10 does have 7 buttons at both sides. Please In Figure A, the configuration of buttons is identified. (In the picture, the enclosure of bc10 is a prototype.)
>
 1. Menu
 2. Back
 3. Home
 4. Up
 5. Left
 6. Right
 7. Down

>
#ref(keypad_android.jpg);


** boot.scr [#m8f61a0e]
>
As updating '''u-boot-bc10''', the configuration, which AMOLED is treated as the initial value of display device, has been located at the directory under '''u-boot-bc10/include/configs/omap3_bc10.h'''. Because of this configuration, the location of '''boot.scr''' has not been predetermined, yet the same content of the configuration is coped to '''boot.scr''', and used for booting bc10. As copying the content, the configuration of '''u-boot.bin''' replaces the content of '''boot.scr'''. The content of configuration of '''boot.scr''', which AMOLED is considered as the initial value of display device, is shown below.~
 $ 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'  ''' is originally written as a single sentence. To type in the
  command, please type as a single line command.
 
 $ mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n ./boot.script -d ./boot.script ./boot.scr &> /dev/null

>
To connect to an external LDE display via MDMI-DVI connector, please change the section of '''omapdss.def_disp=lcd''' to '''omapdss_disp=dvi'''. Then, set up the resolution. The highest resolution we have confirmed here is 1024 x 768.~
 if fatload mmc 0 84000000 uImage
 then
   echo ***** Kernel: /dev/mmcblk0p1/uImage.bin *****
  fi
 setenv bootargs 'mem=256M androidboot.console=ttyS2 console=tty0  
 console=ttyS2,115200n8 root=/dev/mmcblk0p2 init=/init rootwait 
 omapfb.mode=dvi:1024x768MR-24@60 omapdss.def_disp=dvi'
  bootm 84000000
  (Caution) From '''setenv bootargs''' to '''disp=lcd'  ''' is originally written as a single sentence. To type in the
  command, please type as a single line command.

>
To fond the detail information of '''omapfb.mode''' and '''omapdss''', please look at the file, which is located under kernel source file, '''kernel/Documentation/arm/OMAP/DSS'''.

* Reference [#ef6c627d]
>
- How to install SGX
-- [[rowboat ConfigureAndBuild>http://code.google.com/p/rowboat/wiki/ConfigureAndBuild#Install_the_drivers_in_Target_filesystem]]
- About USB Wifi
-- [[[Armadillo:06309] Re: About Wireless LAN, which Armadillo-440 is compatible with (Mailing List):http://lists.atmark-techno.com/pipermail/armadillo/2010-December/006309.html]]

* Revision History [#z20db28a]
>
2011/04/01 This article is initially published

Front page   Edit Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   RSS of recent changes