bc9

Summary

This article shows how to set up an Android development environment. The article argues mainly for android-1.5, but the method
can be applicable to other versions of Android. The development environment either uses the pre-build VMware virtual machine file,
bc9-android-sdk—release20090801.vmx or build a development environment on VMware. Also, the virtual machine can be replaced
with Linux environment in general. (Caution: the version of Linux may differ. It is highly dependent on the version of Android-sdk.)

Some information listed here may similar to the information of bc9/Software/android/android-1.5r3. This page is aimed at providing
an overview of the process. To seek farther detail information, please visit bc9/Software/android/android-1.5r3.

VMware

The configuration of the VMware for bc9-android-sdk is shown below.

  • Version: VMware 6.5 compatible
  • Disk Space: Virtual Disk 20G (the space is divided into 2G)
  • number of CPUs: 1
  • Memory: 512 M
    • To increase the number of CPU and the size of memory, change numvcpus and memsize at the configuration file of VMware
      virtual machine.
  • Network: bridge network
  • OS
    • Ubuntu 8.04.3 LTS (install 8.04.2 first, then update it)
    • The setting of Applications basically remains in default, but the exceptions are shown shown below.
      • symbolic link at /bin/sh changes form dash to bash'''.
        sudo dpkg-reconfigure dash
      • Remove the games, such gnome-games and others.
        sudo apt-get remove gnome-cards-data gnome-games gnome-games-data libggzmod4
      • ssh, htp, vim, lv, nautilus-open-terminal, adbe flash 10, adobe acroread are addionally installed.
      • vmware-tools have already been installed.
      • default resolution is set up for 1280x768.
      • By configuration of network, address is obtained by dhcp.
      • user and password for the pre-build image are beat and beatcraft, respectively.

android (Android Open Source project)

Please look at URL below for the information of repo and other requirements. Please follow the instructions of the build process.

Initialization

Make a directory, which is called android-sdk-1.5r3, and whose location is under /home/beat/. Initialize repo'''.

$ cd ~/
$ mkdir android-sdk-1.5_r3
$ repo init -u git://android.git.kernel.org/platform/manifest.git -b android-sdk-1.5_r3

Adding information for extra source code

The original source code does not contain all requirements of bc9. Obtain the extra source code, adding extra
information for needed source code. After initializing repo, create local_manifest.xml at .repo.
local_manifest.xml allows downloading extra source code for bc9.

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
       <project path="kernel" name="kernel/common" revision="refs/heads/android-2.6.29"/>
       <project path="external/alsa-lib" name="platform/external/alsa-lib"/> 
      <project path="hardware/alsa_sound" name="platform/hardware/alsa_sound"/>
</manifest>

Obtain source code

After the configuration described above is completed, obtain the source code by repo sync.

$ repo sync

Modification of source files

After repo sync is finished, modify obtained source code. The changes are shown below.

  • Add alsa Change Android.mk, which is located at android-sdk-1.5_r3/external/alsa-lib/Android.mk.
    --- Android.mk.orig     2009-07-09 07:05:41.000000000 -0700
    +++ Android.mk  2009-07-09 07:05:48.000000000 -0700
    @@ -55,7 +55,7 @@
            -fPIC -DPIC -D_POSIX_SOURCE \
            -DALSA_CONFIG_DIR=\"/system/usr/share/alsa\" \
            -DALSA_PLUGIN_DIR=\"/system/usr/lib/alsa-lib\" \
    -       -DALSA_DEVICE_DIRECTORY=\"/dev/snd/\"
    +       -DALSA_DEVICE_DIRECTORY=\"/dev/\"
     LOCAL_SRC_FILES := $(sort $(call all-c-files-under, src))
    
    - Change the content of BoardConfig.mk
    To use ALSA for audio hardware library, change the content of BoardConfig.mk. This file is located at
    android-sdk-1.5r3/build/target/board/generic/BoardConfig.mk.
    # config.mk
    #
    # Product-specific compile-time definitions.
    #
    # The generic product target doesn't have any hardware-specific pieces.
    TARGET_NO_BOOTLOADER := true
    TARGET_NO_KERNEL := true
    TARGET_NO_RADIOIMAGE := true
    HAVE_HTC_AUDIO_DRIVER := true
    BOARD_USES_ALSA_AUDIO := true
    #BOARD_USES_GENERIC_AUDIO := true&#12288;&#8251; comment out 
  • Apply a patch on power management
    $ cd android-sdk-1.5_r3
    $ patch -p1 < ../dummy-battery.patch
    Patch is available from here.

Build

The adjustment of source code is over. Now start building.

$ cd android-sdk-1.5_r3
$ make

OpenWnn

At the previous build, OpenWnn is not build. OpenWnn of android-sdk-1.5r3 branch is not built since landscape becomes effective.
To prevent this happening, shift the branch of android-sdk-1.5_r3/packages/inputmethods/OpenWnn/.

$ cd android-sdk-1.5_r3/packages/inputmethods/OpenWnn
$ git checkout korg/cupcake-release

After shifting the branch, make software keyboard effective as landscape is displayed.

$ vim android-sdk-1.5_r3/packages/inputmethods/OpenWnn/src/jp/co/omronsoft/openwnn/JAJP/DefaultSoftKeyboardJAJP.java

At the line 843 “Create the keyboard for landscape mode” and below, let all keylist,which is located in createKeyboardsLandscape,
effective. After this modification is completed, add OpenWnn and build agin.

$ cd abdroid-sdk-1.5_r3/build/
$ source envsetup.sh
$ cd abdroid-sdk-1.5_r3/packages/inputmethods/OpenWnn
$ mm

After executing these command lines, the lib files for OpenWnn are built inside OpenWnn.apk and under the directory of
'''android-sdk-1.5r3/out/target/product/generic/system/lib/.

egg file

Change the name of the file from AudioPackage2.mk to Android.mk. Then, make android as shown below.

$ cp AudioPackage2.mk Android.mk 
$ cd android-sdk-1.5_r3/build/
$ source envsetup.sh 
$ cd android-sdk-1.5_r3/frameworks/base/data/sounds
$ mm 

The audio files are copied under the directory of android-sdk-1.5_r3/out/target/product/generic/system/media/audio/.

Creating rootfilesystem

As the build process of android has succeeded, place these files under the directory of android-root.

$ cd ~/
$ mkdir android-root
$ cp -a ~/android-sdk-1.5_r3/out/target/product/generic/root/* ~/android-root/
$ cp -a ~/android-sdk-1.5_r3/out/target/product/generic/system/* ~/android-root/system/

Edit init.rc

The extra code is added at android-root/init.rc, and the location in which these additional lines of code are placed is right
before on boot.

    chmod 0666 /dev/bc9_leds
       
   setprop alsa.mixer.playback.master Master
   setprop alsa.mixer.capture.master Capture
   setprop alsa.mixer.playback.earpiece Master
   setprop alsa.mixer.capture.earpiece Capture
   setprop alsa.mixer.playback.headset Master
   setprop alsa.mixer.playback.speaker Master
   chmod 0777 /dev/pcmC0D0c
   chmod 0777 /dev/pcmC0D0p
   chmod 0777 /dev/controlC0
   chmod 0777 /dev/timer
   chown root audio /dev/controlC
   chown root audio /dev/pcmC0D0c
   chown root audio /dev/pcmC0D0p
   chown root audio /dev/timer
 
   on boot
   # basic network init

Also, put comment out (#) on the lines of code, which start with mount yaffs2.....

Modify default.prop

The lines of code shown below are attached to the end of android-root/default.prop.

net.eth0.dns1=208.66.222.222
net.dns1=208.67.222.222

Create asound.state

Create asound.state and asound.conf in the directory of android/system/etc/. The code below is asound.state,
which is generated by alsamixer as OpenEmbedded is booted on bc9.

state.Gumstix {
   control.1 {
       comment.access 'read write'
       comment.type INTEGER
       comment.count 1
       comment.range '0 - 4'
       iface MIXER
       name 'Tone Control - Bass'
       value 0 
   }
   control.2 {
       comment.access 'read write'
       comment.type INTEGER
       comment.count 1
       comment.range '0 - 2'
       iface MIXER
       name 'Tone Control - Treble'
       value 0 
   }
   control.3 {
       comment.access 'read write'
       comment.type BOOLEAN
       comment.count 1
       iface MIXER
       name 'Headphone Playback Switch'
       value true
   }
   control.4 {
       comment.access 'read write'
       comment.type BOOLEAN
       comment.count 1
       iface MIXER
       name De-emphasis
       value false
   }
   control.5 {
       comment.access 'read write'
       comment.type BOOLEAN
       comment.count 1
       iface MIXER
       name 'DC Filter'
       value true
   }
   control.6 {
       comment.access 'read write'
       comment.type BOOLEAN
       comment.count 1
       iface MIXER
       name 'Hi-pass Filter'
       value true 
   }
   control.7 {
       comment.access 'read write'
       comment.type BOOLEAN
       comment.count 1
       iface MIXER
       name 'ADC Filter'
       value true
   }
   control.8 {
       comment.access 'read write'
       comment.type BOOLEAN
       comment.count 1
       iface MIXER
       name 'Master Playback Switch'
       value true
   }
   control.9 {
       comment.access 'read write'
       comment.type INTEGER
       comment.count 2
       comment.range '0 - 63'
       iface MIXER
       name 'Master Playback Volume'
       value.0 63
       value.1 63
   }
   control.10 {
       comment.access 'read write'
       comment.type ENUMERATED
       comment.count 2
       comment.item.0 Mic
       comment.item.1 CD
       comment.item.2 Video
       comment.item.3 Aux
       comment.item.4 Line
       comment.item.5 Mix
       comment.item.6 'Mix Mono'
       comment.item.7 Phone
       iface MIXER
       name 'Capture Source'
       value.0 Mic
       value.1 Mic
   }
   control.11 {
       comment.access 'read write'
       comment.type BOOLEAN
       comment.count 1
       iface MIXER
       name 'Capture Switch'
       value true 
  }
  control.12 {
       comment.access 'read write'
       comment.type INTEGER
       comment.count 2
       comment.range '0 - 15'
       iface MIXER
       name 'Capture Volume'
       value.0 15
       value.1 15
   }
   control.13 {
       comment.access 'read write'
       comment.type BOOLEAN
       comment.count 1
       iface MIXER
       name 'Loudness (bass boost)'
       value false
   }
}

Create asound.conf

asound.conf is created from asound.state

ctl.AndroidPlayback {
	type hw
	card 0
}

ctl.AndroidRecord {
	type hw
	card 0
}

pcm.AndroidPlayback {
	type hooks
	slave.pcm {
		type hw
		card 0
		device 0
	}
	hooks.0 {
		type ctl_elems
		hook_args [
			{ name 'Tone Control - Bass'	   value 0           } 
			{ name 'Tone Control - Treble'	   value 0           } 
			{ name 'Headphone Playback Switch' value true	     }
			{ name 'De-emphasis'		   value false	     }
			{ name 'DC Filter'		   value true	     }
			{ name 'Hi-pass Filter'		   value true	     }
			{ name 'ADC Filter'		   value true	     }
			{ name 'Master Playback Switch'	   value true	     }
			{ name 'Master Playback Volume'	   value [ 55 55 ]   }
			{ name 'Capture Source'		   value [ Mic Mic ] }
			{ name 'Capture Switch'		   value true	     }
			{ name 'Capture Volume'		   value [ 15 15 ]   }
			{ name 'Loudness (bass boost)'	   value false	     }
		]
	}
}

pcm.AndroidPlayback_Speaker_normal {
	type hooks
	slave.pcm {
		type hw
		card 0
		device 0
	}
	hooks.0 {
		type ctl_elems
		hook_args [
			{ name 'Tone Control - Bass'       value 0	     }
			{ name 'Tone Control - Treble'     value 0	     }
			{ name 'Headphone Playback Switch' value true	     }
			{ name 'De-emphasis'		   value false	     }
			{ name 'DC Filter'		   value true	     }
			{ name 'Hi-pass Filter'	           value true	     }
			{ name 'ADC Filter'		   value true        }
			{ name 'Master Playback Switch'	   value true	     }
			{ name 'Master Playback Volume'	   value [ 55 55 ]   }
			{ name 'Capture Source'		   value [ Mic Mic ] }
			{ name 'Capture Switch'		   value true	     }
			{ name 'Capture Volume'		   value [ 15 15 ]   }
			{ name 'Loudness (bass boost)'	   value false	     }
		]
	}
}
pcm.AndroidPlayback_Speaker {
	type hooks
	slave.pcm {
		type hw
		card 0
		device 0
	}
	hooks.0 {
		type ctl_elems
		hook_args [
			{ name 'Tone Control - Bass'       value 0	     }
			{ name 'Tone Control - Treble'     value 0	     }
			{ name 'Headphone Playback Switch' value true	     }
			{ name 'De-emphasis'		   value false	     }
			{ name 'DC Filter'		   value true	     }
			{ name 'Hi-pass Filter'	           value true	     }
			{ name 'ADC Filter'		   value true        }
			{ name 'Master Playback Switch'	   value true	     }
			{ name 'Master Playback Volume'	   value [ 55 55 ]   }
			{ name 'Capture Source'		   value [ Mic Mic ] }
			{ name 'Capture Switch'		   value true	     }
			{ name 'Capture Volume'		   value [ 15 15 ]   }
			{ name 'Loudness (bass boost)'	   value false	     }
		]
	}
}

pcm.AndroidPlayback_Headset {
	type hooks
	slave.pcm {
		type hw
		card 0
		device 0
	}
	hooks.0 {
		type ctl_elems
		hook_args [
			{ name 'Tone Control - Bass'       value 0	     }
			{ name 'Tone Control - Treble'     value 0	     }
			{ name 'Headphone Playback Switch' value true	     }
			{ name 'De-emphasis'		   value false	     }
			{ name 'DC Filter'		   value true	     }
			{ name 'Hi-pass Filter'	           value true	     }
			{ name 'ADC Filter'		   value true        }
			{ name 'Master Playback Switch'	   value true	     }
			{ name 'Master Playback Volume'	   value [ 55 55 ]   }
			{ name 'Capture Source'		   value [ Mic Mic ] }
			{ name 'Capture Switch'		   value true	     }
			{ name 'Capture Volume'		   value [ 15 15 ]   }
			{ name 'Loudness (bass boost)'	   value false	     }
		]
	}
}

pcm.AndroidPlayback_Speaker_incall {
	type hooks
	slave.pcm {
		type hw
		card 0
		device 0
	}
	hooks.0 {
		type ctl_elems
		hook_args [
			{ name 'Tone Control - Bass'       value 0	     }
			{ name 'Tone Control - Treble'     value 0	     }
			{ name 'Headphone Playback Switch' value true	     }
			{ name 'De-emphasis'		   value false	     }
			{ name 'DC Filter'		   value true	     }
			{ name 'Hi-pass Filter'	           value true	     }
			{ name 'ADC Filter'		   value true        }
			{ name 'Master Playback Switch'	   value true	     }
			{ name 'Master Playback Volume'	   value [ 55 55 ]   }
			{ name 'Capture Source'		   value [ Mic Mic ] }
			{ name 'Capture Switch'		   value true	     }
			{ name 'Capture Volume'		   value [ 15 15 ]   }
			{ name 'Loudness (bass boost)'	   value false	     }
		]
	}
}

pcm.AndroidPlayback_Headset_incall {
	type hooks
	slave.pcm {
		type hw
		card 0
		device 0
	}
	hooks.0 {
		type ctl_elems
		hook_args [
			{ name 'Tone Control - Bass'       value 0	     }
			{ name 'Tone Control - Treble'     value 0	     }
			{ name 'Headphone Playback Switch' value true	     }
			{ name 'De-emphasis'		   value false	     }
			{ name 'DC Filter'		   value true	     }
			{ name 'Hi-pass Filter'	           value true	     }
			{ name 'ADC Filter'		   value true        }
			{ name 'Master Playback Switch'	   value true	     }
			{ name 'Master Playback Volume'	   value [ 55 55 ]   }
			{ name 'Capture Source'		   value [ Mic Mic ] }
			{ name 'Capture Switch'		   value true	     }
			{ name 'Capture Volume'		   value [ 15 15 ]   }
			{ name 'Loudness (bass boost)'	   value false	     }
		]
	}
}

pcm.AndroidPlayback_Earpiece_incall {
	type hooks
	slave.pcm {
		type hw
		card 0
		device 0
	}
	hooks.0 {
		type ctl_elems
		hook_args [
			{ name 'Tone Control - Bass'       value 0	     }
			{ name 'Tone Control - Treble'     value 0	     }
			{ name 'Headphone Playback Switch' value true	     }
			{ name 'De-emphasis'		   value false	     }
			{ name 'DC Filter'		   value true	     }
			{ name 'Hi-pass Filter'	           value true	     }
			{ name 'ADC Filter'		   value true        }
			{ name 'Master Playback Switch'	   value true	     }
			{ name 'Master Playback Volume'	   value [ 55 55 ]   }
			{ name 'Capture Source'		   value [ Mic Mic ] }
			{ name 'Capture Switch'		   value true	     }
			{ name 'Capture Volume'		   value [ 15 15 ]   }
			{ name 'Loudness (bass boost)'	   value false	     }
		]
	}
}

pcm.AndroidPlayback_Bluetooth {
	type hooks
	slave.pcm {
		type hw
		card 0
		device 0
	}
	hooks.0 {
		type ctl_elems
		hook_args [
			{ name 'Tone Control - Bass'       value 0	     }
			{ name 'Tone Control - Treble'     value 0	     }
			{ name 'Headphone Playback Switch' value true	     }
			{ name 'De-emphasis'		   value false	     }
			{ name 'DC Filter'		   value true	     }
			{ name 'Hi-pass Filter'	           value true	     }
			{ name 'ADC Filter'		   value true        }
			{ name 'Master Playback Switch'	   value true	     }
			{ name 'Master Playback Volume'	   value [ 55 55 ]   }
			{ name 'Capture Source'		   value [ Mic Mic ] }
			{ name 'Capture Switch'		   value true	     }
			{ name 'Capture Volume'		   value [ 15 15 ]   }
			{ name 'Loudness (bass boost)'	   value false	     }
		]
	}
}

pcm.AndroidRecord_Microphone {
	type hooks
	slave.pcm {
		type hw
		card 0
		device 0
	}
	hooks.0 {
		type ctl_elems
		hook_args [
			{ name 'Tone Control - Bass'       value 0	     }
			{ name 'Tone Control - Treble'     value 0	     }
			{ name 'Headphone Playback Switch' value true	     }
			{ name 'De-emphasis'		   value false	     }
			{ name 'DC Filter'		   value true	     }
			{ name 'Hi-pass Filter'	           value true	     }
			{ name 'ADC Filter'		   value true        }
			{ name 'Master Playback Switch'	   value true	     }
			{ name 'Master Playback Volume'	   value [ 55 55 ]   }
			{ name 'Capture Source'		   value [ Mic Mic ] }
			{ name 'Capture Switch'		   value true	     }
			{ name 'Capture Volume'		   value [ 15 15 ]   }
			{ name 'Loudness (bass boost)'	   value false	     }
		]
	}
}

Generate vold.conf

vold manages the mount of SD card. vold takes directions from a configuration file. The configuration file is needed to
be created and placed at the directory shown below.

$ vi android-root/system/etc/vold.conf

This is how to write the configuration file.

## vold configuration file for bc9
volume_sdcard {
  media_path     /devices/platform/pxa2xx-mci.0/mmc_host/mmc0
  media_type     mmc
  mount_point    /sdcard
  ums_path       /devices/platform/usb_mass_storage/lun0
}

Key assignment

bc9 does have three buttons. From the top, F1, F2, and F3 are already assigned. These keys appoint to act as HOME,
MENU, and BACK buttons of Android, respectively.

qwerty.kl manages the key board of Android. Edit this file, which is located at android-root/system/usr/keylayout.
This is how to change the file.

--- qwerty.kl-orig      2009-07-02 20:28:21.000000000 +0900
+++ qwerty.kl   2009-07-02 20:29:42.000000000 +0900
@@ -11,18 +11,18 @@ key 10    9
 key 11    0
 key 158   BACK              WAKE_DROPPED
 key 230   SOFT_RIGHT        WAKE
-key 60    SOFT_RIGHT        WAKE
+key 60    MENU              WAKE
 key 107   ENDCALL           WAKE_DROPPED
 key 62    ENDCALL           WAKE_DROPPED
 key 229   MENU              WAKE_DROPPED
 key 139   MENU              WAKE_DROPPED
-key 59    MENU              WAKE_DROPPED
+key 59    HOME              WAKE
 key 127   SEARCH            WAKE_DROPPED
 key 217   SEARCH            WAKE_DROPPED
 key 228   POUND
 key 227   STAR
 key 231   CALL              WAKE_DROPPED
-key 61    CALL              WAKE_DROPPED
+key 61    BACK              WAKE
 key 232   DPAD_CENTER       WAKE_DROPPED
 key 108   DPAD_DOWN         WAKE_DROPPED
 key 103   DPAD_UP           WAKE_DROPPED

android-SDK

Install Android 1.5 SDK, Release 3. For the details of installation, please visit at http://developer.android.com/sdk/android-1.5.html.
After the installation is completed, ADB, emulator and other software are used.

eclipse

Follow the instruction listed at Installing the Android ASK, install Eclipse 3.4.2 and the plugins for android development.

Linux kernel source

androi-2.6.29 kernel is used. Adding local_manifest to android-sdk-1.5_r3, this kernel is obtained. Creating kernel_work directly is create
at the /home/beat/, kernel is copied there. Then, the kernel is renamed to linux-android-2.639. Patches for bc9 are installed.

$ cd /home/beat/kernel_work/linux-android-2.6.29/
$ mv ../patch-kernel-2.6.29.4-bc9/patch-all.sh .
$ mv ../patch-kernel-2.6.29.4-bc9/*.patch .
$ ./patch-all.sh

After all 17 patches are installed, change the name of kernel. Change the name of kernel for the distinguishing
between before and after applying the patches.

$ mv linux-android-2.6.29 linux-android-2.6.29-bc9-r3

cross toolchain

The cross toolchain of gumstix-oe which is built with bc9-oe-sdk is copied at /home/beat/kernel/cross.
At /home/beat/kernel_work/envsetup.sh, make ARM cross compile work. Then, the cross build of the
kernel is completed.


Front page   Edit Freeze Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   RSS of recent changes
Last-modified: 2010-11-02 (Tue) 11:39:23 (2848d)