2009年11月20日 星期五

How to work with Google code

This wiki shows me the detail procedure to use git to work with Google code.
The main procedure is:
1. git svn clone --username my-gmail-name -s https://my-project.googlecode.com/svn
2. git add FILENAME
3. git commit -a
4. git svn dcommit --username jacky.tw -s https://my-project.googlecode.com/svn

參考來源: ExportingToGit - support - Exporting a project to a Git repository - Project Hosting on Google Code (在「Google 網頁註解」中檢視)

Good article to start Gstreamer plugin

If you want to study Gstreamer plugin writing tip, I would like to share this with you all.

參考來源: furseal's lair: 踏出 gstreamer plugin 的第一步 (在「Google 網頁註解」中檢視)

2009年11月8日 星期日

Howto run native Linux application on Android

Recently I am working an Embedded Linux Internal project, and use many open source tools to build cross compiler, Linux kernel, small Linux root filesystem on JK2410(Jollen Kit based on Samsung S3C2410 - ARM 920T).
From this project I learned how to build cross compiler, busybox by myself. and use such kind of tools, the static linked code also can run on Android emulator. I would like to share this knowledge from this blog.
First I used OSELAS toolchain, it must be build by ptxdist tool.
Following is the step how to build ptxdist and setup the right gcc, kernel version you want to build the toolchain. Download ptxdist-1.99.12.tgz and ptxdist-1.99.12-patches.tgz from http://www.ptxdist.org/software/ptxdist/download/v1.99/
Run command in the terminal shell:
# tar -zxf ptxdist-1.99.12.tgz
# tar -zxf ptxdist-1.99.12-patches.tgz
# ./configure --prefix=/usr/local
# make
# make install
then, download OSELAS.Toolchain-1.99.3.5.tar.bz2 from http://www.oselas.com/oselas/toolchain/download/
Run following command in the terminal shell:
# tar xf OSELAS.Toolchain-1.99.3.5.tar.bz2
# cd OSELAS.Toolchain-1.99.3.5
# ptxdist select ptxconfigs/arm-v4t-linux-gnueabi_gcc-4.3.2_glibc-2.8_binutils-2.18_kernel-2.6.31-sanitized.ptxconfig
# ptxdist go

After run "ptxdist go", the tool will get the source code, patch from Internet, and compile the right CPU architecture, gcc, glibc, binutils and kernel version as the select setting you give. You can change the ptxconfig to more match your platform requirement.
The build procedure will take 1 to 2 hours depended on your Building host computing power.
After it finished, you can find the toolchain in /opt/OSELAS.Toolchain-1.99.3/ directory, so make sure your running user have permission to write file into /opt directory.

2nd Step is build up a static linked busybox, now it have some problem to run dynamic shared code on Android, because the linker system program in Android use different technology with toolchain. I haven't let dynamic code run successfully on Android.

Get busybox-1.15.2.tar.bz2 from http://www.busybox.net/downloads/
#tar jxvf busybox-1.15.2.tar.bz2
#cd busybox-1.15.2
#make menuconfig
This step you must change the Busybox setting -> Build options
Choose Build BusyBox as a static binary (no shared libs)
and Set Cross Compiler prefix as "arm-v4t-linux-gnueabi-"
#make
Now you can see the striped busybox present in this folder

3rd Step is to prepare the Android SDK environment, you can get it from here
Please notice the link will not get the whole package, you must following this instruction to get more add-on package.
Assume you place android sdk in /opt/Google/android-sdk-linux, add "/opt/Google/android-sdk-linux/tools" in your PATH variable.
then, run following command:
#android create avd -n my_droid -t 1
#emulator -avd my_droid -shell
From now now, you can see a magic emulator Google phone is launched, and the previous terminal become a single # as prompt.
In this prompt, you are in the Android root shell, you can type "ls -l" "cd" "pwd" as normal command.
Now you also need use following command(in Host Terminal) to put busybox binary into Android emulator.
#adb push busybox /data/busybox
#adb shell chmod 755 /data/busybox

Final, switch to Android shell, and type
#/data/busybox ls -al /system

You can see the file list from the busybox binary output.

This purpose of article is just to share the toolchian buildup experience, and the native C code compatibility on Android platform. You must not to use this way to run your original application. You shall learn how to use Android NDK to build your native C/C++ library.
I am now studying this as my next step to learn more about Android platform. If you are interested on this, we can discuss this by email or other way.