星期一, 1月 25, 2010

Android keylayout

system/usr/keylayout/qwerty.kl

#keycode FUNC ???
59(F1) MENU

星期日, 1月 24, 2010

Modify Android Pixelflinger to support ATMEL BGR555

I try to trace the libpixelflinger source code. However, it seems to be a troublesom work.

----
/system/core/libpixelflinger/scanline.cpp
/system/core/include/libpixelflinger/format.h
/system/core/libpixelflinger/format.cpp
/system/core/libpixelflinger/buferr.cpp
/system/core/libpixelflinger/codeflinger/texturing.cpp

/bootable/recovery/minui/graphics.c

/frameworks/base/libs/surfaceflinger/BlurFilter.cpp
/frameworks/base/libs/surfaceflinger/LayoutBase.cpp
/frameworks/base/libs/surfaceflinger/LayerBlur.cpp
/frameworks/base/libs/surfaceflinger/Layer.cpp

/frameworks/base/opengl/include/GLES/gl.h
/frameworks/base/opengl/include/GLES2/gl2.h
/frameworks/base/opengl/libagl/mipmap.cpp
/frameworks/base/opengl/libagl/egl.cpp
/frameworks/base/opengl/libagl/texture.cpp

星期五, 1月 22, 2010

Android Battery Driver

1. Create driver/power/fack_battery.c
2. Modify the driver/power/Makefile
power_supply-objs := power_supply_core.o

power_supply-objs += fack_battery.o


[NOTE] Muse Enable Linux Kernel Power Management

Reference

[1] Rockie Cheng's Blog

星期二, 1月 19, 2010

Android root file system

1. Download and Compile unyaffs
gcc -o unyaffs unyaffs.c

2. ramdisk.img

mkdir android_rootfs
cd android_rootfs
cp ~/android-sdk-linux_86/platforms/android-2.1/images/ramdisk.img ramdisk.img.gz
gzip -d ramdisk.img.gz
cpio -i -F ramdisk.img

3. system.img and userdata.img
cd system
~/unyaffs/unyaffs ~/android-sdk-linux_86/platforms/android-2.1/images/system.img
cd ../data
~/unyaffs/unyaffs ~/android-sdk-linux_86/platforms/android-2.1/images/userdata.img
cd ..

4. device
sudo mknod dev/console c 5 1
sudo mknod
dev/null c 1 3
sudo mknod dev/tty2 c 4 2
sudo mknod
dev/tty3 c 4 3
sudo mknod
dev/tty4 c 4 4
sudo mknod dev/fb0 c 29 0

5. Board Dependent
sed 's/goldfish/AT91SAM9261-EK/g' init.goldfish.rc > init.AT91SAM9261-EK.rc
mv system/etc/init.goldfish.sh system/etc/init.AT91SAM9261-EK.sh

6. Modify init.rc for NFS Boot by commenting out mount commands
mount rootfs rootfs / ro remount

mount yaffs2 mtd@system /system
mount yaffs2 mtd@system /system ro remount
mount yaffs2 mtd@userdata /data nosuid nodev
mount yaffs2 mtd@cache /cache nosuid nodev

cp init.rc init.rc.bak
sed -e 's/mount rootfs/#mount rootfs/g' init.rc.bak > init.rc.tmp
sed -e 's/mount yaffs2/#mount yaffs2/g' init.rc.tmp > init.rc



References
[1] Android on OMAP, http://elinux.org/Android_on_OMAP
[2] Unyaff, http://code.google.com/p/unyaffs/

星期一, 1月 18, 2010

Android Frame Buffer Driver for AT91SAM9261

1. Android frame buffer need support double-buffering. The default AT91SAM9261 Linux config use internal SRAM as frame buffer. However, the internal SRAM capacity is only 160KB, which is insufficient to support 320x240x16-bit double-buffering. You need to disable the option by:
make ARCH=arm menuconfig
Device Driver --->
Graphic Support --->
Support for frame buffer devices --->
AT91/AT32 LCD Controller support
[ ] Frame Buffer in internal SRAM

2.
Modify the Frame buffer driver (drivers/video/atmel_lcdfb.c), here is the modified atmel_lcdfb.c
2.1 Allocate double buffer:
ret = fb_find_mode(&info->var, info, NULL, info->monspecs.modedb,
info->monspecs.modedb_len, info->monspecs.modedb,
sinfo->default_bpp);
info->var.yres_virtual = info->var.yres*2;


2.2 Modify atmel_lcdfb_set_par

please refer to the reference [3]

2.3 Transform RGB565 to BGR555 (A stupid method)
* Allocate SRAM Frame Buffer for LCD Controller
* Cover FrameBuffer(Android View) to SRAM FrameBuffer(LCDC View)

Reference
[1]
Android Platform Development Kit
[2] Linux Frame Buffer Driver
[3] Patch Framebuffer Driver of PrimeCell Color LCD Controller with Double-Buffering to Support Android’s Page-Flipping

星期五, 1月 15, 2010

Android need JDK5

1.in /etc/apt/sources.list append:
deb http://run.hit.edu.cn/ubuntu/ jaunty main restricted universe multiverse
deb-src http://run.hit.edu.cn/ubuntu/ jaunty main restricted universe multiverse
deb http://run.hit.edu.cn/ubuntu/ jaunty-updates main restricted universe multiverse
deb-src http://run.hit.edu.cn/ubuntu/ jaunty-updates main restricted universe multiverse
deb http://run.hit.edu.cn/ubuntu/ jaunty-backports main restricted universe multiverse
deb-src http://run.hit.edu.cn/ubuntu/ jaunty-backports main restricted universe multiverse
deb http://run.hit.edu.cn/ubuntu/ jaunty-security main restricted universe multiverse
deb-src http://run.hit.edu.cn/ubuntu/ jaunty-security main restricted universe multiverse

2. sudo apt-get udpate

3. sudo apt-get install sun-java5-jdk

星期四, 1月 14, 2010

Install Android SDK on Ubuntu 9.10

1. Install Eclipse
sudo apt-get install eclipse

2. Install Eclipse ADT
Follow the instructions, you may have this problem.

3. Adding Android SDK Component
Follow the instructions, you may need you click the options:
Settings > Misc > "Force https://... sources to be fetched using http://"


4. I had tried to port SDK 1.5, 1.6, 2.1, All of them works.

星期三, 1月 13, 2010

Build Android Linux Kernel for AT91SAM9261-EK

1. Get the Source and Prebuilt Toolchain
mkdir android_project
cd android_project
git clone git://android.git.kernel.org/kernel/common.git
git clone git://android.git.kernel.org/platform/prebuilt.git
cd common

2. Apply Linux 2.6.27 Patches for AT91
zcat 2.6.27-at91.patch.gz | patch -p1

3. Configure Linux using default 2.6.27 configuration at91sam9261ek_defconfig
cp at91sam9261ek_defconfig .config

4. Android-dependent Configuration
CONFIG_ASHMEM=y
CONFIG_ARM_THUMB=y

5. Build Linux Kernel
make ARCH=arm oldconfig
make ARCH=arm CROSS_COMPILE=/home/zhong/android_project/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-

6. Create U-Boot Image
sudo apt-get install uboot-mkimage
mkimage -A arm -O linux -T kernel -C none -a 0x22200000 -e 0x22200040 -n 'android-linux' -d arch/arm/boot/zImage uImage


7. U-Boot command
setenv bootcmd 'tftp 0x22200000 uImage; bootm 0x22200000'


* 0x22200000 is the DRAM address where the Image is loaded to.

References
[1] Andriod Opensource Project
[2] Linux4SAM
[3] AT91 Linux 2.6 Patches
[4] lianxijian's Blog

星期一, 1月 11, 2010

Linux NFS root file system

1. Install
sudo apt-get install nfs-common nfs-kernel-server
(if you can not find the package, please update /etc/apt/sources.list)

2. Setup
sudo vi /etc/exports
/nfsroot *(rw,async,no_root_squash)
[NOTE] no space after *

3. Restart NFS Server
sudo /etc/init.d/nfs-kernel-server start

4. Using Uboot set Linux Kernel argument
setenv bootargs 'root=dev/nfs nfsroot=192.168.1.100:/nfsroot'
setenv nfsserver 192.168.1.100
setenv netmask 255.255.255.0
saveenv

Reference
Checko' Blog

星期三, 1月 06, 2010

Busybox-1.15.3

1. Install Required Package
sudo apt-get install libncurses5-dev

2. Busy Configuration
make menuconfig
2.1.
Busybox Settings --->
Build Options --->
Cross Compiler prefix (/cross/usr/bin/arm-linux-)
2.2.
BusyBox Settings --->
Build Options --->
Build BusyBox as a static binary (no shared libs)

3. Make and Install
make ARCH=arm
make install
This will generate a directory "_install"

4. Create console and null Device
cd _install
mkdir dev
cd dev
sudo mknod console c 5 1
sudo mknod null c 1 3

sudo mknod tty2 c 4 2
sudo mknod tty3 c 4 3
sudo mknod tty4 c 4 4

5. /etc/init.d/rcS
mkdir etc
mkdir etc/init.d
vi etc/init.d/rcS
chmod +x etc/init.d/rcS

星期二, 12月 29, 2009

Build ARM Cross Compiler (arm-linux)

Main Packages:
1. linux kernel headers
2. binutils
3. gcc
4. glibc
5. glibc-ports

Problems:
  1. glibc-2.11 needs cpuid.h
  2. glibc-2.10.1 only supports as,ld version 2.13-2.19: apply the patch
  3. --with-sysroot will cause the problem
  4. glibc: cannot find -lgcc_eh, modify Makeconfig.

Reference
[1] clfs-sysroot, http://cross-lfs.org/view/clfs-sysroot/

星期一, 9月 14, 2009

Suffer vt. 遭受, 經歷

Suffer from vi. 受苦, 患病
These algorithm suffer from the problem of external fragmentation.

星期五, 3月 27, 2009

Smoothsort

Edsger W. Dijkstrak 在1981年提出來的Sorting方法 ,
就是和 Dijkstra's Shorest Path Alogirthm 同一人 ,

Smoothsort算是Heap Sort的變形,
Heap Sort的演算法的複雜度平均是 O(nlogn),
Smoothsort複雜度的Worst Case也是O(nlogn), 但是在某種Case的時後可以是 O(n)
實作起來要有點數學基礎, 演算法的基礎是Leonardo number, 花了一些時間才弄懂
下面是Leonardo number的Binary Tree表示法,

詳細的演算法等我弄懂一點才貼出來,

有興趣請參考Wiki, EWD796a,

星期一, 3月 23, 2009

安裝SystemC

http://scream.csie.ncku.edu.tw/WWW/images/ESL/SystemC/systemc_setup.pdf

星期一, 1月 19, 2009

[英文寫作] Respectively

Respectively, adv.
個別, 分別

例句一:
Mary and Anne were respectively 12 and 16 years old.

例句二:
The brothers were called Felix and Max, respectively.

星期三, 11月 19, 2008

Verilog Generated Instatiation

In some case, we require variable number of instances
A example in Standrad: Ripple Adder

module addergen1 (co, sum, a, b, ci);
parameter SIZE = 4;
output [SIZE-1:0] sum;
output co;
input [SIZE-1:0] a, b;
input ci;
wire [SIZE :0] c;

genvar i;

assign c[0] = ci;

// Generated instance names are:
// xor gates: bit[0].g1 bit[1].g1 bit[2].g1 bit[3].g1
// bit[0].g2 bit[1].g2 bit[2].g2 bit[3].g2
// and gates: bit[0].g3 bit[1].g3 bit[2].g3 bit[3].g3
// bit[0].g4 bit[1].g4 bit[2].g4 bit[3].g4
// or gates: bit[0].g5 bit[1].g5 bit[2].g5 bit[3].g5
// Generated instances are connected with
// generated nets: bit[0].t1 bit[1].t1 bit[2].t1 bit[3].t1
// bit[0].t2 bit[1].t2 bit[2].t2 bit[3].t2
// bit[0].t3 bit[1].t3 bit[2].t3 bit[3].t3

generate
for(i=0; i<SIZE; i=i+1) begin:bit
wire t1, t2, t3; // generated net declaration
xor g1 ( t1, a[i], b[i]);
xor g2 ( sum[i], t1, c[i]);
and g3 ( t2, a[i], b[i]);
and g4 ( t3, t1, c[i]);
or g5 ( c[i+1], t2, t3);
end
endgenerate

assign co = c[SIZE];

endmodule

星期五, 5月 09, 2008

VC++ 使用 OpenMP

1) /openmp
2) vcompd.dll not find?
#include "omp.h"

平行化的三種方式
parallel、sections、for

星期一, 4月 21, 2008

VMM Detection

VMM (Virtual Machine Management) 的目的是要架構一虛擬的平台

在真實硬體上未完備之前來讓軟體能在上面執行, 或者能讓一台機器來模擬其它硬體平台

但是接下來會衍生一個問題, VMM能做到完全不被上層執行的軟體發現嗎?

作者引用了另一篇HOTOS的會議論文 --Compatibility is not Transparency: VMM Detection Myths and Realities, 文中的結論是不太可能作到這點

關鍵在於"時間"..... <待續>

星期六, 4月 19, 2008

StreamIt: Multicore Programming Lanaguage

CPU發展的趨勢了幾乎已經確定是Manycore而不是Better core
單一晶片中可能有8個, 16個, 32個... 甚至上千個核心
但是面對如此強大的硬體資源, 傳統的程式語言(Programming Language)可以掌握嗎?
傳統程式語言使採取循序(Sequential)觀點來面對程式
之後有執行緒(Thread)的概念出現,
執行緒的概念是要在單一記憶體空間中同時處理有兩件以上的事情
但執行緒之間有同步以及共享記憶體的問題, 這會造成程式設計師很難撰寫及除錯

StreamIt是MIT在2002年開發的程式語言,
StreamIt採用元件概念來寫程式, 一支程式是由許多Filter構成~
每個Filter會處理輸入串流(Stream), 然後產生輸出串流
每個Filter都是平行在處理自己的串流, 彼此沒有共享資料, 可以很容易達到最佳化的效能
MIT目前有在自校的課程教授StreamIt, 應用的平台是Sony PS3的Cell Processor