2009年3月31日

QT4 with Mysql Driver on Debian lenny

#sudo apt-get install mysql-server libmysqlclient15-dev
#su -
#cd $QTDIR/src/plugins/sqldrivers/mysql
#qmake "INCLUDEPATH+=/usr/include/mysql"
"LIBS+=-L/usr/lib/mysql -lmysqlclient_r" mysql.pro
#make
#make install

then,"libqsqlmysql.so" at $QTDIR/plugins/sqldrivers/

參考資料:QT4 Doc-SQL Database Driver

2009年3月22日

Debian lenny 建立XEN虛擬機器

Environment : Debian lenny
CPU : Intel Core 2 Duo E6550

Step 1:
#apt-get install xen-hypervisor-i386 xen-tools xen-docs-3.2 xen-shell xen-utils-3.2-1 xen-utils-common libc6-xen
xen-linux-system-2.6.26-1-xen-686 linux-headers-2.6.26-1-xen-686
bridge-utils

Step 2:
檢查/boot/grub/menu.list
default=0 //對應XEN核心版本Kernel Image
重新開機以XEN核心版本Kernel開機。

Step 3:
#nano /etc/xen/xend-config.sxp
修改如下區段
#(network-script network-dummy) //註解本行
(network-script network-bridge) //增加本行
(vif-script vif-bridge)

Step 4:
設定預設GuestOS建立環境
#nano /etc/xen-tools/xen-tools.conf
dir = /home/xen
size = 8Gb
memory = 512Mb
swap = 1024Mb
fs = ext3
dist = lenny
gateway = "gateway.ip"
netmask = "netmask.ip"
broadcast = "broadcast.ip"
passwd = 1
kernel = /boot/vmlinuz-`uname -r`
initrd = /boot/initrd.img-`uname -r`
mirror = http://ftp.de.debian.org/debian/
serial_device = hvc0
disk_device = xvda

Step 5:
建立GuestOS
#xen-create-image --hostname=debian-guest01 --ip=ip --role=udev
過程會要求輸入root的密碼

Step 6:
#xm create /etc/xen/debian-guest01.cfg //啟動GuestOS(debian-guest01)
#xm list //列出虛擬機狀態
#xm console debian-guest01 //登入GuestOS

Step 7:
自動啟動GuestOS
#ln -s /etc/xen/debian-guest01.cfg /etc/xen/auto

參考資料:
Virtualization With Xen On Debian Lenny (AMD64)
Xen on Debian Etch 安裝

2009年3月21日

PXA270實驗筆記(六)

[ 關閉LCD power off ]
修改Kernel內核char/vt.c,將blankinterval設為0,如下:
static int blankinterval = 0;
//static int blankinterval = 10*60*HZ;

[ tslib編譯 ]
require package:automake libtool

執行autogen.sh後產生 configure 檔案

#./configure --prefix="path" CC=/usr/local/arm/3.4.1/bin/arm-linux-gcc --host=arm-linux --enable-inputapi=no ac_cv_func_malloc_0_nonnull=yes
#make
#make install

將 /usr/local/arm/3.4.1/arm-linux/lib 底下的libdl-2.3.2.so以及libdl.*等檔案放到"tslib_path"/lib
建立plugins資料夾,將"tslib_path"/lib/ts 中的所有檔案複製到plugins 資料夾

export QWS_MOUSE_PROTO=TPanel:/dev/ts
export TS_ROOT="tslib_path"
export LD_LIBRARY_PATH=$TS_ROOT/lib
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/ts
export TSLIB_CALIBFILE=$TS_ROOT/etc/pointercal
export TSLIB_CONFFILE=$TS_ROOT/etc/ts.conf
export TSLIB_PLUGINDIR=$TS_ROOT/plugins

在ARM上執行定點程式,將記錄下來的定點pointercal複製到/tmp/cf_card

[ Qtopia-core移植 ]
將qtopia-core-opensource-src-4.3.0.tar.gz放到/tmp/cf_card
#tar zxvf qtopia-core-opensource-src-4.3.0.tar.gz //解壓
#mv qtopia-core-opensource-src-4.3.0 qtopia-core //改名
#cd /tmp/cf_card/qtopia-core
# export QTDIR=$PWD
# export PATH=$QTDIR/bin:$PATH
# export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH

在qmouselinuxtp_qws.h里面添加
#define QT_QWS_IPAQ
#define QT_QWS_IPAQ_RAW
修改qmouselinuxtp_qws.cpp,增加
/dev/h3600_tsraw改为/dev/ts
修改qmouse_qws.cpp
把pointercal位置設為/tmp/cf_card/pointercal

#./configure -prefix /tmp/cf_card/qtopia-core -embedded arm -xplatform qws/linux-arm-g++ -qt3support -qt-zlib -qt-libpng -qt-gif -qt-libtiff -qt-libmng -qt-libjpeg -nocups -no-openssl -no-stl -qt-mouse-linuxtp -depths 4,8,16
#make
#make install
把toolchain的lib(除了libc)複製到qtopia-core/lib
打包qtopia-core為qtopia-core.tar
將qtopia-core.tar移植到板子上的/tmp/cf_card之中解開

修改file system bashrc設定
#nano -w /usr/local/fstest/target/.bashrc
將QPEDIR QTDIR PATH LD_LIBRARY_PATH的設定改為
export QPEDIR="/tmp/cf_card/qte"
export QTDIR="/tmp/cf_card/qte"
export PATH=/usr/Qtopia/demo/bin:$QPEDIR/bin:/tmp/cf_card/jamvm/bin:$PATH
export LD_LIBRARY_PATH=$QTDIR/lib:$QPEDIR/lib:/usr/Qtopia/demo/lib
export QWS_MOUSE_PROTO=linuxtp:/dev/ts

修改/usr/local/fstest/target/usr/qpe.sh
echo "qpe -qws" -> #echo "qpe -qws"
/usr/Qtopia/qtopia-free-1.7.0/bin/qpe -qws -> #/usr/Qtopia/qtopia-free-1.7.0/bin/qpe -qws

#mkcrmfs target root_tmp.cramfs //重新包裝

PXA270實驗筆記(五)

PXA270與OSGi (JSP Support)

下載equinox OSGi framework : http://download.eclipse.org/equinox/
將equinox解開之後在plugin資料夾中加入
(1)org.eclipse.equinox.http.helper
(2)org.eclipse.equinox.jsp.jstl
(3)org.eclipse.equinox.jsp.example
三個Bundle之後重新打包成tar檔。
!注意! 這三個Bundle必須以CVS方式從Equinox Incubator取得

將包好的tar檔複製到PXA270上/tmp/cf_card中,解開之後執行
#jamvm -jar /tmp/cf_card/eclipse/plugin/org/eclipse/osgi_"bundle version".jar -console

畫面範例如下:
osgi> ss

Framework is launched.

id State Bundle
0 ACTIVE org.eclipse.osgi_3.4.0.v20080605-1900

使用以下指令安裝bundle
osgi>install file:"bundle name".jar

需安裝的bundle與完成畫面如下:

osgi>ss

Framework is launched.

id State Bundle
0 ACTIVE org.eclipse.osgi_3.4.0.v20080605-1900
2 ACTIVE org.eclipse.equinox.http.jetty_1.1.0.v20080425
3 ACTIVE org.eclipse.equinox.http.servlet_1.0.100.v20080427-0830
4 ACTIVE org.apache.commons.logging_1.0.4.v20080605-1930
5 ACTIVE org.mortbay.jetty_5.1.14.v200806031611
6 ACTIVE javax.servlet_2.4.0.v200806031604
7 ACTIVE javax.servlet.jsp_2.0.0.v200806031607
8 ACTIVE org.eclipse.equinox.http.registry_1.0.100.v20080427-0830
10 ACTIVE org.eclipse.osgi.services_3.1.200.v20071203
11 ACTIVE org.eclipse.equinox.ds_1.0.0.v20080427-0830
12 ACTIVE org.eclipse.osgi.util_3.1.300.v20080303
13 ACTIVE org.eclipse.equinox.util_1.0.0.v20080414
14 ACTIVE org.eclipse.equinox.log_1.1.0.v20080414
15 ACTIVE org.apache.commons.el_1.0.0.v200806031608
16 ACTIVE org.apache.jasper_5.5.17.v200806031609
17 ACTIVE org.eclipse.equinox.jsp.jasper_1.0.100.v20080427-0830
18 ACTIVE org.eclipse.equinox.common_3.4.0.v20080421-2006
19 ACTIVE org.eclipse.equinox.registry_3.4.0.v20080516-0950
20 ACTIVE org.eclipse.equinox.jsp.jasper.registry_1.0.0.v20080427-0830
22 ACTIVE org.eclipse.equinox.http.helper_1.0.0.qualifier
24 ACTIVE org.eclipse.equinox.jsp.jstl_1.0.0
25 ACTIVE org.eclipse.equinox.jsp.examples_1.0.0
26 ACTIVE org.eclipse.equinox.jsp.jstl.examples_1.0.0

osgi>

將所有bundle啟動為active狀態,並開啟瀏覽器瀏覽http://192.168.1.12/jsp-examples/index.html

PXA270實驗筆記(四)

#nano -w /usr/local/fstest/target/usr/etc/rc.local //修改file system中的程序起始檔

加上內容(包在做好的root_tmp.cramfs):
/bin/mount -t ex2 /dev/ide/host0/bus0/target0/lun0/part1 /tmp/cf_card
/sbin/ifconfig eth0 192.168.1.12 up
/sbin/ifconfig eth1 192.168.141.131 up
/bin/route add default gw 192.168.141.254 eth1

重新以mkcramfs包裝為root_tmp.cramfs,並重新燒錄。

!注意! 重新燒錄時請在u-boot命令列先執行protect off all與erase all清除flash

[x86] 編譯GNU classpath,Jikes及Jam VM過程:
-tmp
|-cf_card
|-jamvm
|-jamvm-1.5.1.tar.gz
|-classpath-0.97.2.tar.gz
|-jikes-1.22.tar.bz2
|-classpath
|-jikes

GNU classpath
#apt-get install gconf2 libgconf2-dev zlib-bin zlib1g-dev libgcj8-1-awt
#mkdir /tmp/cf_card/jamvm
#cd /tmp/cf_card/jamvm
#tar zxvf jamvm-1.5.1.tar.gz
#tar zxvf classpath-0.97.2.tar.gz
#tar jxvf jikes-1.22.tar.bz2
#cd classpath-0.97.2
#./configure --prefix=/tmp/cf_card/jamvm/classpath --disable-plugin
#make
#make install

Jikes
#./configure --prefix=/tmp/cf_card/jamvm/jikes
#make; make install

Jam VM
#cd /tmp/cf_card/jamvm/jamvm-1.5.1
#./configure --prefix=/tmp/cf_card/jamvm --with-classpath-install-dir=/tmp/cf_card/jamvm/classpath #make
#make install

#rm -rf /tmp/cf_card/jamvm/jamvm-1.5.1.tar.gz
#rm -rf /tmp/cf_card/jamvm/classpath-0.97.2.tar.gz
#rm -rf /tmp/cf_card/jamvm/jikes-1.22.tar.bz2

[arm] 編譯GNU classpath及Jam VM過程:
-tmp
---|-cf_card
---------|-jamvm
---------------|-jamvm-1.5.1.tar.gz
---------------|-classpath-0.97.2.tar.gz
---------------|-classpath

GNU classpath
#apt-get install gconf2 libgconf2-dev zlib-bin zlib1g-dev libgcj8-1-awt //安裝需要套件
#mkdir /tmp/cf_card/jamvm
#cd /tmp/cf_card/jamvm
#tar zxvf jamvm-1.5.1.tar.gz
#tar zxvf classpath-0.97.2.tar.gz
#tar jxvf jikes-1.22.tar.bz2
#cd classpath-0.97.2
#./configure --host=arm-linux --target=arm-linux --prefix=/tmp/cf_card/jamvm/classpath --disable-plugin --disable-gtk-peer --disable-gconf-peer --enable-Werror --enable-local-sockets
--disable-plugin 關閉Mozilla Plugin Support
--disable-gtk-peer 關閉gtk支援
--disable-gconf-peer 關閉gconf支援
--enable-jni 支援jni ( 重要,要加上 )
--enable-static library庫連結方式為static

#make
#make install

Jam VM
#cd /tmp/cf_card/jamvm/jamvm-1.5.1
#CC=/usr/local/arm/3.4.1/bin/arm-linux-gcc ./configure --host=arm-linux --target=arm-linux --prefix=/tmp/cf_card/jamvm --with-classpath-install-dir=/tmp/cf_card/jamvm/classpath --disable-zip

--with-classpath-install-dir 引用的GNU classpath路徑
--disable-zip 關閉使用zlib壓縮/解壓縮支援

#make
#make install

把jamvm/classpath/share/classpath/glibj.zip解壓縮在所在目錄
#cd /tmp/cf_card/jamvm/classpath/share/classpath/
#unzip glibj.zip //原因為需要抓取lib檔但是無法解析zip格式

#rm -rf /tmp/cf_card/jamvm/jamvm-1.5.1.tar.gz
#rm -rf /tmp/cf_card/jamvm/classpath-0.97.2.tar.gz

將完成的jamvm資料夾利用網路或USB隨身碟複製到PXA270上的/tmp/cf_card之下,或是打包為tar檔再重送到板子上解開