NFS Server setup

八月 4, 2010

NFS Server

Installation:

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

Setting:

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

Installation:

$> sudo apt-get install portmap nfs-common

Setting:

Add the following line to /etc/hosts.deny
portmap : ALL
add the following line to /etc/hosts.allow: //serverip = 192.168.1.250
portmap : 192.168.1.254
mount nfs shares
$ > mount -t nfs 192.168.1.254:/path/to/shares /local/path
if you want to mount nfs share on boot, adding mount option to /etc/fstab
192.168.1.254:/path/to/shares /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]

http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/dvsdk/DVSDK_3_00/latest/index_FDS.html

OMAP3 Graphics SDK [GFXSDK]

http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/gfxsdk/latest/index_FDS.html

OMAP3 Linux Platform Support Package [PSP]

http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/psp/index.html

OMAPZOOM2 Development GitWeb

http://dev.omapzoom.org/

OMAPZOOM2 GitWeb

http://git.omapzoom.org/

Enable Dalvik JIT feature

十二月 8, 2009

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

Android System Service how-to

十二月 4, 2009

${android-source}build/core/pathmap.mk

FRAMEWORKS_BASE_SUBDIRS := \

//Add library that application can link against

${android-source}frameworks/base/data/etc/platform.xml

<library name="android.awt"  file="/system/framework/android.awt.jar" />
Modify services/java/com/android/server/SystemServer.java
@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/Context.java
@add service constant string to context class
public static final String WIMAX_SERVICE = “wimax";
Modify core/java/android/app/ApplicationContext.java
@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
post(Runnable);
postAtTime(Runnable, long);
postDelayed(Runnable, long);

sendEmptyMessage(int);
sendMessage(Message);
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

CONFIG_HOTPLUG=y
CONFIG_UEVENT_HELPER_PATH=""
CONFIG_NET=y
CONFIG_UNIX=y
CONFIG_SYSFS=y
CONFIG_SYSFS_DEPRECATED*=n
CONFIG_PROC_FS=y
CONFIG_TMPFS=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_INOTIFY=y
CONFIG_SIGNALFD=y

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-

CONFIG_INITRAMFS_SOURCE =""

CONFIG_CMDLINE =

CONFIG_BLK_DEV_INITRD=y

———————–

How to load ramdisk.img

1.Compile in to kernel

Uncompress ramdisk.img to kernel root dir

CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE="root"
CONFIG_INITRAMFS_ROOT_UID=0
CONFIG_INITRAMFS_ROOT_GID=0

2.Write to nand flash partition (bootimage type)

http://omappedia.org/wiki/Android_Getting_Started

http://elinux.org/BeagleBoard

http://code.google.com/p/android-development-environment/wiki/Android1_6r1onBeagleBoard

CONFIG_BLK_DEV_INITRD=y

How to clone android kernel and check out kernel branches

十一月 30, 2009

//clone whole git repository from android common kernel repository

git clone git://android.git.kernel.org/kernel/common.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/envsetup.sh

//


關注

Get every new post delivered to your Inbox.