NFS Server setup

八月 4, 2010

NFS Server


$> sudo apt-get install portmap nfs-kernel-server


edit /etc/exports, and export shares by $> sudo exportfs -ra Restarting Services

$> sudo /etc/init.d/portmap restart
$> sudo /etc/init.d/nfs-kernel-server restart
note 1: you can checkout nfs daemon log by cat /var/log/syslog to see what is going on.
note 2: if you keep getting "refused mount request from xxxx for xxx: illegal port xxxxx", add insecure option to nfs share in /etc/exports
$> showmount localhost -e

NFS Client


$> sudo apt-get install portmap nfs-common


Add the following line to /etc/hosts.deny
portmap : ALL
add the following line to /etc/hosts.allow: //serverip =
portmap :
mount nfs shares
$ > mount -t nfs /local/path
if you want to mount nfs share on boot, adding mount option to /etc/fstab /local/path nfs rw,hard,intr 0 0

Cross Compile Toolchain

七月 13, 2010

Cross Compile toolchain includes

Programming Tools:

GCC, Binutil

Debugging support and simulator

GNU Debuger, GDB Simulator

Target Libraries

C Library (GNU libc, uClibc), Kernel Header (different kernel version)

// Cross Compile Toolchain from Code Sourcery

arm-none-eabi- (ARM architecture, for non specific arm processor, eabi)

arm-none-linux-gnueabi- (ARM Architecture, for non specific arm processor ARMv4, with linux kernel header, gnu libc)

arm-uclinuxeabi- (ARM Architecture, uClibc, with linux kernel header)

// Android Cross Compile toolchain

Android comes with their own cross compile tool chain, and it was built without c library or kernel header. (which they use bionic C and they have their kernel header in their repository)

Ignore .DS_Store in Android Open Source Repository

一月 13, 2010

$> find . -name .DS_Store -exec rm {} \;

$>echo .DS_Store >.gitignore

$>git config --global core.excludesfile = ./.gitignore

TI OMAP3 3530 resources download

一月 3, 2010

OMAP3 Digital Video Software Development Kit [DVSDK]


OMAP3 Linux Platform Support Package [PSP]

OMAPZOOM2 Development GitWeb


Enable Dalvik JIT feature

十二月 8, 2009

by creating a file in your AOSP root which includes the
line “WITH_JIT := true".

Android System Service how-to

十二月 4, 2009



//Add library that application can link against


<library name="android.awt"  file="/system/framework/android.awt.jar" />
Modify services/java/com/android/server/
@Modify ServerThread:run method, adding our service to ServiceManager
try {
Log.i(TAG, “Starting Your Service.");
ServiceManager.addService(Context.YOUR_SERVICE, new YourService(context));
} catch (Throwable e) {
Log.e(TAG, “Failure starting Your Service", e);
Modify  core/java/android/content/
@add service constant string to context class
public static final String WIMAX_SERVICE = “wimax";
Modify core/java/android/app/
@add class field to contain your service
private static YourManager sYourManager;
@change getSystemService ( ) method to return your service instance
if (YOUR_SERVICE.equals(name)) {
return getYourManager();
@add class method to retrieve IBinder stub from ServiceManager
private YourManager getYourManager()
synchronized (sSync) {
if (sYourManager == null) {
IBinder b = ServiceManager.getService(YOUR_SERVICE);
IYourManager service = IYourManager.Stub.asInterface(b);
sYourManager = new YourManager(service, mMainThread.getHandler());
return sYourManager;
Update current.xml by execute following commands
make update-api

Handler 與 HandlerThread 原理

十二月 2, 2009

在Android 程式裡 我們常用Handler來做 跨Thread的訊息溝通

Handler 允許你對 與Hanlder相互關聯的Thread MessageQueue,進行 “傳送" 及 “處理訊息(Message) 或 將可執行(Runable)的程序公布至這個Thread的MessageQueue, 待稍候 由這個Thread 來執行Runable 的內容.

當一個Handler被新建時…Handler 與 新建這個Handler的Thead MessageQueue 產生綁定,之後這個Handler 就會將訊息與可執行(Runable)的程序 傳送至這個Thread 的 MessageQueue

以下為Handler類別 常用的方法列表…post方法是將可執行的Runable 物件加入MessageQueue, 而send 方法 則為將訊息加入MessageQueue,

class Handler {

public interface Callback {
public boolean handleMessage(Message msg);

//將這個Handler 與建立這個Handler的Thread的MessageQueue 產生連結,當訊息自這個MessageQueue被Dispatch後 由這個handler的handleMessage(Message msg); 處理

public Handler();

//將這個Handler 與建立這個Handler的Thread的MessageQueue 產生連結,當訊息自這個MessageQueue被Dispatch後 由callback object的handleMessage方法處理

public Handler(Callback callback);

//將這個Handler 連結至 looper 的MessageQueue (Looper 只能跟Thread 並存), 當訊息自這個MessageQueue被Dispatch後 由這個handler的handleMessage(Message msg); 處理
public Handler(Looper looper);

//將這個Handler 連結至 looper 的MessageQueue (Looper 只能跟Thread 並存),當訊息自這個MessageQueue被Dispatch後 由callback object的handleMessage方法處理
public Handler(Looper looper, Callback callback);

//用來處理與這個Handler關聯Message Queue 的 non post message,在extend handler 假如你需要處理訊息 則override handleMessage
public void handleMessage(Message msg);

//Looper 自MessageQueue內取出 Message 後 假如這個訊息 由這個handler 所產生… 此dispatchMessage 就會被呼叫.
//當它為一般訊息時 呼叫handleMessage或與constructor傳進來的MessageCallback:handleMessage
//若為post message則執行message內的callback (從 post傳進的 runnable)

public void dispatchMessage(Message msg);

//將Runnable object 包裝成postMessage 並丟到這個Handler 連結的 MessageQueue
postAtTime(Runnable, long);
postDelayed(Runnable, long);

sendMessageAtTime(Message, long);
sendMessageDelayed(Message, long);


class Looper {
public static final void prepare(); //新增一個looper instance至ThreadLocal
public static final Looper myLooper(); //從ThreadLocal 取回looper instance

public static final void loop(); //取回與這個Thread 關聯的looper, 並於迴圈內 取得MessageQueue 裡的訊息 並dispatch
public void quit(); //送出一個空訊息給Message 代表結束looper 迴圈

public static final MessageQueue myQueue(); 取得與這個Thread 關聯的MessageQueue
public Thread getThread(); 取得與這個looper 關聯的 Thread


class HandlerThread extends Thread{

public void run(); //呼叫Looper.prepare 新增Looper 至 Thread, 並呼叫Looper.loop 執行 MessageQueue


Porting udev to android

十二月 1, 2009


how to config android kernel

十一月 30, 2009

1. Make sure you have uboot-mkimage installed

$ sudo apt-get install uboot-mkimage

2. Set Cross Compile toolchain to path

export PATH=${PATH}:/"path to android source"/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin

3. Configure kernel

make menuconfig ARCH=arm

4. Compile kernel

make uImage ARCH=arm CROSS_COMPILE=arm-eabi-





How to load ramdisk.img

1.Compile in to kernel

Uncompress ramdisk.img to kernel root dir


2.Write to nand flash partition (bootimage type)


How to clone android kernel and check out kernel branches

十一月 30, 2009

//clone whole git repository from android common kernel repository

git clone git:// kernel

//show remote repository If you wanted to see remote branches:

git branch -r

//Check remote branch

git checkout -b android-2.6.29 origin/android-2.6.29

//A convenient way of check out remote branch

git checkout –track -t origin/android-2.6.29

// import build commands
source build/