星期二, 2月 28, 2006

/proc/modules 的內容生產者..

查到 kernel/module.c 中 get_module_list( ) 註解說明call ed by /proc filesystem 。
裡面 可以看到將kernel module_list (linking list) 的內容一一copy到user space,傳回。
其中module 的" Used" 一項是 struct module.uc.usecount 的內容。

因為有不明原因module一load就是Used=63,所以一直rmmod 不掉。
這一部份是由module.c中的delete_module( ) 加入pritk( )找出來的,因為MOD_IN_USE 所以沒法delete
接著在所有module.c 修改到usecount的地方都加上printk message,找找看++是不是比--多。

fbset and framebuffer driver ..

fbset --> ioctl( ) --> driver/video/fbmem.c fb_ioctl( ) --> fpops.fb_set_var( )

這個fpops就是由device driver table取得的driver ops。
到driver source去找...

C function : getopt

標頭檔: unistd.h ( 也有單純的 getopt.h )

原型:
int getopt(int argc, char * const argv[], const char *optstring);
說明:
用來分析命令列參數,開頭的兩個argument剛好跟 program argument一樣。
參數 optstring 是有效選項(字母)。如 " a:bf"。代表要接受的option有 -a, -b, -f。
其中option a的後面是":"號,代表-a option後還有參數(例如-aext2)。
getopt提供兩個global variable : optarg,optopt。用來輔助getopt這個function。
像a:這樣的參數,getopt會將-a後面的字串放到optarg中。
範例:
#include <stdio.h>
#include <unistd.h>

int main(int argc, char **argv)
{
int ch;

while((ch=getopt(argc,argv,"a:cf"))!=-1)
switch(ch)
{
case 'a':
printf("choose a: %s\n",optarg);
break;
case 'c':
printf("option c\n");
break;
case 'f':
printf("option f\n");
break;
}
}

星期一, 2月 27, 2006

from devfs to dev

因為廠商的code是用dev,不是devfs,所以要把devfs改為dev..

先將linux kernel config中,filesystem 的dev filesystem 支援刪除。
在build romfs 前,用genrommkdev和device.list產生 genromfs使用的device 列表(ref: 前一篇)。

build romfs.
boot : 出現
Warnning : unable to open an initial console.
之後就沒反應了。
查到這一段message是由init/main.c中顯示的,是open /dev/console 失敗的message。

查/dev/console的major number 是 154,到driver/char下找到target board的serial hardware driver。MAJOR number是25x(不是154)。
查其他的serial driver,註冊用TTY_MAJOR這個define,所以修改serial hardware source code,把MAJOR NUMBER 定義為TTY_MAJOR。

修改後rebuild kernel,download,boot --->OK! 可以進入

create romfs : genromfs and genrommkdev

romfs因為是read only,所以不能像ext2 fs一樣,mount loop 然後edit內容。
所以要用genromfs這一個程式來產生image。

使用genromfs時,需要的參數有:
-f 生成的romfs image檔名
-d 用這個目錄作source
-V 指定這個image的volume name

但是要包含dev node時怎麼辦? 又不能用mknode產生。

genromfs 在解析source目錄時,會將'@'開頭的檔案作特別處理。當作dev node。
配合這樣的動作,genromfs的source 中提供一個script,由device list產生一堆@開頭的檔案。
這個script就是genrommkdev.

實驗:
  • 先create一個source 目錄 see
    mkdir see
  • 在see裏create一些以@開頭的檔案
    touch @hda1,b,3,1
  • 用genromfs create一個see的romfs
    genromfs -f seeimg see
  • OK, mount進來看看
    mout -o loop -t ext2 seeimg see
  • 可以看到@hda1,b,3,1已經變成dev inode了 major num = 3, minor num = 1
genrommkdev使用的dev list有一定格式:
/dev/hda1 b 3 1
/dev/tty1 c 4 1
使用方法是:
genrommkdev < devices.list | sh
就會依照device.list的內容產生一堆@開頭的file。
* 要注意dev 目錄要先create好
*要注意device.list內只能有device list,不能有#開頭的comment和space。

星期五, 2月 24, 2006

Google又有新服務: Google Page Creator

? 很奇怪,沒有link...

而且已經不能註冊了....T_T... 只有註冊到一個帳號..

中文的書籤

http://www.hemidemi.com/

就是像Furl, del.icio.us 這樣的東西,不過是中文介面的。
(不知道會不會backup page...)

已經註冊..

星期四, 2月 23, 2006

SIP Account at ekiga.net

因為看到Gnome desktop會內建VOIP client,由ekiga.net 提供服務,所以先去註冊一個account。

sip:checko@ekiga.net

pchome 買的ASUS 8 port switch hub

499元.
盒子,還送22張網路沖印卷
DSC01048

裡面是: adaptor + hub + manual
DSC01049

正面的樣子
DSC01051
背面的樣子..
DSC01052

效能還好,用FileZilla ftp -- prpftpd 傳送,可以到12MB = 96Mb..
也不會熱,比起上一次在燦坤買的Zyxel ES105 5 port switch hub.
Zyxel 會熱。
但是Zyxel size小得多了..

星期三, 2月 22, 2006

gcc options -Wmissing-declarations -Wmissing-prototypes

-W 是Enable Warnning的意思。後面加上選項:
  • -Wmissing-declaration
    尚未宣告就直接定義Global function時產生警告。
    這個功能用來偵測忘記在 .h 中宣告function.
    如果發現,就會有:
    no previous prototype for '?'
  • -Wmissing-prototypes
    尚未宣告就直接定義的Global variable時 產生警告。
    用來偵測 忘記在 .h 中宣告variable.
  • -Wchar-subscripts
    當char 被用作array的index時,告警。
  • -Werr
    把所有Warnning 當作錯誤。這樣就會中斷build過程。

Signal List

Linux 系統使用Signal作為IPC(的一種)。
使用
$ kill -l
可以列出系統支援的Signal有哪些。

SIGHUP 1 Exit Hangup (ref termio(7I))
SIGINT 2 Exit Interrupt (ref termio(7I))
SIGQUIT 3 Core Quit (ref termio(7I))
SIGILL 4 Core Illegal Instruction
SIGTRAP 5 Core Trace or breakpoint trap
SIGABRT 6 Core Abort
SIGEMT 7 Core Emulation trap
SIGFPE 8 Core Arithmetic exception
SIGKILL 9 Exit Kill
SIGBUS 10 Core Bus error--a misaligned address error
SIGSEGV 11 Core Segmentation fault, an address reference boundary error
SIGSYS 12 Core Bad system call
SIGPIPE 13 Exit Broken pipe
SIGALRM 14 Exit Alarm clock
SIGTERM 15 Exit Terminated
SIGUSR1 16 Exit User defined signal 1
SIGUSR2 17 Exit User defined signal 2
SIGCHLD 18 Ignore Child process status changed
SIGPWR 19 Ignore Power fail or restart
SIGWINCH 20 Ignore Window size change
SIGURG 21 Ignore Urgent socket condition
SIGPOLL 22 Exit Pollable event (ref streamio(7I))
SIGSTOP 23 Stop Stop (cannot be caught or ignored)
SIGTSTP 24 Stop Stop (job control, e.g., CTRL-z))
SIGCONT 25 Ignore Continued
SIGTTIN 26 Stop Stopped--tty input (ref termio(7I))
SIGTTOU 27 Stop Stopped--tty output (ref termio(7I)) SIGVTALRM 28 Exit Virtual timer expired
SIGPROF 29 Exit Profiling timer expired
SIGXCPU 30 Core CPU time limit exceeded (ref getrlimit(2)) SIGXFSZ 31 Core File size limit exceeded (ref getrlimit(2)) SIGWAITING 32 Ignore Concurrency signal used by threads library
SIGLWP 33 Ignore Inter-LWP signal used by threads library SIGFREEZE 34 Ignore Checkpoint suspend
SIGTHAW 35 Ignore Checkpoint resume
SIGCANCEL 36 Ignore Cancellation signal used by threads library
SIGLOST 37 Ignore Resource lost
SIGRTMIN 38 Exit Highest priority real-time signal
SIGRTMAX 45 Exit Lowest priority real-time signal

廠商名錄 - Oregan - embedded system browser

從SigmaDesign網站找到的 embedded system browser 軟體公司。
自己發展的browser和flashplayer(據稱效能比macromedia 快3倍)。
瀏覽器相容性最高,可以支援ajax 中所需要的技術。



TONY YANG - Business Manager

Oregan Networks Ltd

P.O. BOX 10204 Sindian Taipei County 23199

Taiwan (R.O.C.)

Mobile:

+886 963 112 518

Direct:

+886 2 8665 3740

skype:

tony--yang

Web:

http://www.oregan.net

星期二, 2月 21, 2006

Some Video Acronym

  • VBI
    Vertical Blanking Interval
  • TeleTex
    將資訊置於VBI 中送出
  • CVBS
    "Composite Video Baseband Signal" or "Composite Video, Blanking and Syncronization".
  • SCART
    一種connector的標準,歐洲比較常用。內含Analog RGB video/S video, composite Video, analog stereo.
  • Composite Video
    原來黑電視時代,信號只有gray level,後來彩色化,增加了RGB,所以就利用color space轉換,將RGB轉為Luminace (Y), Hue and Saturation。因為人類對Luminace 比較敏感,所以Luminace用0-4.2MHz來傳遞,Hue 和Saturnation就用3.58MHz sub-band來傳遞。這樣的信號就叫Composite Video.

星期一, 2月 20, 2006

Linux Devfs (Device File System) FAQ

和原有的char,block device不一樣,利用devfs,kernel可以用"name"而不是major, minor number來註冊device。device會自動出現在/dev中。

devfs有兩個特性:
name space和mout --- 完全部知道在講甚麼.

Why do it

Major/Minor number allocatin

以往的dev 設計必須要有一個unique major/minor number,所以新設計的device必須要向kernel mantain人員註冊一個major/minor number,以免被其他人使用(或與已有的device重複)。這樣很麻煩。
devfs將major/minor number改由"檔名"的方式。利用device driver註冊的名字來access。只要driver的writer選擇一格符合自己device特性的名字就可以。

/dev mamagement
以往major/minor的設計方式,需要kernel module和/dev system中有相同的對應(也就是說同要變更一個device major/minor number,同時要變更kernel module的註冊表和/dev 的node內容。這樣很麻煩。
devfs就不需要。

/dev growth
以往的/dev系統,不論系統中有沒有這個device,該device 的major/minor number都不能被其他device使用,這樣讓/dev下的data變得很大,也讓kernel 的module table變得很大。

devfs 不使用major/minor number,當device module呼叫devfs_register( ),這個module的entry name將會被附加到內部device table 後。系統會去/dev檢查這個module的entry是否已經存在,如果沒有,會由file_operation create一個inode。
所以devfs下,/dev內的device是avaiable的device,和古老的/dev系統不同,古老的/dev系統包含的是所有的device,不論目前喜統有沒有這個device。

Read-only root filesystem

以前的/dev是掛在root filesystem下,所以當使用readonly root filesystem時,要變更device node的owership是不可能的,除非用script create ramdisc,把/dev copy 過去,再unmount /dev,把ramdisk /dev mount進來。
devfs就不必這樣作。


Non-Unix root filesystem

Non-Unix filesystem不支援block, char special file,和symbolic link。這樣甚至要mount一個ramdisk 內的dev到/dev都不行。(因為Non-Unix filesystem不支援dev filesystem)。


How it works

Registering device entries

每個device都要call devfs_register( ),這個function call會將device name,file operation pointer加到kernel 的 device entry table中。
device 也可以remove,將自己從device table中刪除。
註冊的devicec會自動出現在已經mount的devfs中。

Inod lookup

在device table中尋找某個entry(device)時,如果沒找到,會呼叫devfsd,還是找不到,會return一個負的entry值,接著VFS就會呼叫create( )或是mknode( )。

Manually creating device nodes

用mknod( ) method可以在devfs下create一個 inode。如果那個device還不存在,也可以。
user可以對預先存在的node設定權限,這樣當device真的註冊後,權限會繼續存在。不會被overwrite。

Chroot( ) goals --- 完全看不懂在幹嘛

Operation issues

給沒耐心的人看的..

至少要看一下這部份,否則系統可能不會boot...

Devfsd

System Libraries

/etc/security

XFree86

Disble devpts

Unsupported drivers

/dev/mouse

The Kernel

kerel config file中
set CONFIG_EXPERIMENTAL=y
CONFIG_DEVFS_FS=y
CONFIG_DEVFS_MOUNT=y
rebuild kernel。boot後,/dev會自動 mount進來

Use Mobile Phone to Cook an Egg..

用手機煮蛋
這是"這裡"的文章,我沒試過,因為沒有免費的電話...
直接來:

需要兩隻手機(A跟B),和門號,其他要準備的東西還有:
1.煮蛋杯(架)。不可以用金屬的。要用塑膠或瓷器等絕緣材質的才行。
2.收音機,音響也可以。
3.一個平坦的桌面,用來放置這些東西。

步驟:

1.將新鮮雞蛋放在煮蛋杯上。
2.打開收音機或音響,調整到適當的音量。(聽得到又不炒人)。
3.將手機A,放在煮蛋杯的0.5 inch的位置(這個距離會影響煮蛋的時間,可以多作幾次實驗)。
4.手機A打電話給手機B。將手機B放在煮蛋杯相反的位置。
5.手機B接聽A打來的電話(要小心不要移動了位置)。
6因為有開啟音響,手機A,B都會收到音樂。所以A和B等於是在通話狀態。
7. 烹煮時間:和手機的功率有關。一對2 wattt的手機約需要3 min才能者熟一個蛋。

真的嗎?
那手機打太久,腦子不就都"熟"了?

星期四, 2月 16, 2006

free VMWare Server and VMWare player

不知道是不是Xen 的關係,VMWare也推出兩個Free的product : player 跟Server。
當然,GSX Server還是要付費的。

Player 比較好找,在VMWare的網站上就可以看到link。功能也比較簡單。只能用來run vmware的vm image。不能create image。也不能修改VM的設定。

Server比較難找,要到product - Server下,看到download mark。進去才行,然後會要填一些資料,才能Download。

Install Server時,需要用註冊時,VMWare寄的confirm mail中的Serial Number作註冊(啟動)。

Server,Player都不能和Workstation 共存再同一台機器上。

因為Player不能Create VM,所以VMWare網站提供一個pre installed VM image讓customer download。

星期三, 2月 15, 2006

ViewML (Fltk, libwww) in the old Linux (Redhat 7.1)

為了ViewML特地裝了Redhat 7.1。
拿Fltk 1.0.11來build --> OK!!! (這在Debian 3.1 是有Error的!!!)。
測試test下的application也沒問題。

拿ViewML來build。說沒有libwwwconf。所以要build libwww。
libwww-5.2.8 build OK. make install 也OK!

ViewML :
make
一樣,先是找不到config.h然後 fltk下include path還是都錯! 根本就跟Debian 3.1下的狀況一樣!!!


拿Viewml-0.22來試試:
configure 的script有些問題,所以要手動修改configure出來的makeinclude檔案

加入fltk source 到include path
加入libwww/include到include path
修改LD path,libwww的path多include。

其實 --with-fltk 改到fltk source的path,不是fltk install 的path就可以解決一些fltk include的問題。
./configure --enable-static --with-libwwwconfig=/home/charles/libwww/bin --with-fltk=/home/charles/fltk-1.0.11

再修改makeinclude,在INCLUDE PATH中加入/home/charles/libwww/include,讓他找到xmlparser.h.

結果:出現
/usr/lib/libtiff.a(tif_jpeg.o): In function `TIFFjpeg_create_compress':
tif_jpeg.o(.text+0x101): undefined reference to `jpeg_CreateCompress'
/usr/lib/libtiff.a(tif_jpeg.o): In function `TIFFjpeg_set_defaults':
......
查,是沒有link jpeg library的關係(!@#$)。
修 改makeinclude,在library部份加入-ljpeg。這部份error消失,剩下..
/home/charles/libwww/lib/libwwwapp.a(HTInit.o): In function `HTConverterInit':
/home/charles/w3c-libwww-5.2.8/Library/src/HTInit.c:84: undefined reference to `HTXML_new'
/home/charles/w3c-libwww-5.2.8/Library/src/HTInit.c:85: undefined reference to `HTXML_new'
這個google的結果是config用了"without-expat",但是我configure沒 家這個參設呀。到libwww/lib下
$ ar t libwwwxml.a
查一下libwwwxml包含的module有出現HTXML.o -- 這是含HTXML_new的module。用libwww-conf --libs看看。也有加入"-lwwwxml"。
將libwwwxml的module解出來,看看裡面的symbol table..
$ ar x libwwwxml.a
$ nm HTXML.o
有出現HTML_new..

So ?

因為是Libwww的source reference到的所以換個新版的libwww試試....從5.2.8升級到5.4.0
一樣config 和install後,重新configure viewml-0.22。修改makeinclude,加入"-ljpeg"。
make ---- ? include path要加入 xmlparser.h所在目錄的問題沒了。
結果: 還是一樣有XTHML_new 問題。

check reference 的source code : HTinit.c,發現是在定義expat時才會compile in。
所以 ? 重新config libwww , 加入--without-expat。

再make clean, make viewml-0.22。

OK!!





作個結論好了:

viewml-0.22 版 : 沒有include par.h 問題
viewml makeinclude library option 加上 -ljpeg : 解決 TIFF jpeg_Compress問題。
viewml configure --with-fltk=是fltk source code的path,不是install的path : 解決config.h 問題
viewml configure --enable-static : 解決libwww.so 沒有load問題。
libwww-5.4.0 版 : 沒有xmlparser.h 問題
libwww configure --without-expat : 解決 HTXML_new 問題
fltk-1.0.11 : 呃。忘了。但是用fltk1.1.0的話,buildviewml-0.22有"unsolved external " Error.
(雖然fltk-1.0.11的test demo有些不能run,但是fltk-1.1.0的demo都OK)


重點是 gcc 是2.96, Libc, Libc++ 也是?

Install Redhat 7.1 on VMWare

前言:
因為據說ViewML是在2001的Linux環境build成功。所以想在舊系統試試。


沒什麼特殊的,就是redhat 6.1, 6.2 都不能裝 (redhat 6.x不支援這麼"新"的cpu)。
所以裝redhat 7.1 (這些舊版的iso 事從cle download的,參考以前的post)。

要install vwmare-tools後 X 才會正常,X 還是要裝,但是在選 login method時,要選 Text。

裝完後,選VM的install VMWare Tools。
# mount /mnt/cdrom 
VMWare tools就在/mnt/cdrom中。copy, untar,follow INSTALL 的說明。run 完script。就可以啟動X
# startx
附帶提一下:
redhat 7.1 的gcc version是2.96



抱怨一下:redhat的package安裝管理不太方便,要"找","安裝"和"相依"都不容易 操作。還是Debian方便,一切都是自動的。
還好用VMWare安裝蠻快的,發現沒有動作的,就重新裝一次...:P

星期二, 2月 14, 2006

ViewML on Debian

只好先從ViewML on Debain 開始。..
fltk使用1.1.0版。從source code build。不使用debain 的deb.
./configure --with-fltk=/home/charles/ref/libfltk1.1.0 --prefix=/home/charles/viewmlap
先作configure --- 這個當然OK囉。

make --- 問題就很多了。
先是config.h 找不到==>作一個假的 :
$ touch src/kdecore/config.h
接著是qstringl.h 的compile error : 這是因為namespace的問題 ==>在qstring.h中加入
using namespace std;
接著是 "沒有transform( )" function。這大概是因為algo.h 太舊,改為
#include <algorithm>
找不到par.h,google了一下。有人也問過這個問題。當然是沒有人回答。--->刪!

cmath : acosf, asinf not declared.-->google一下,發現是compiler 以為要使用C99 的header。

Fltk on Debian 3.1

原來用apt-get install 的方式,但是這樣沒有install source 和demo test program,所以改由source build。
從fltk.org 下載source,原先想用svn co 1.0.7 版,但是fltk.org上svn 用的link 已經失效。只好用download的。

1.0.10 ==> link fluid error : resolved reference to new(unsigned)
2.0.X ==> link test proram error
1.1.0 ==> OK !! (難怪Debian 上的版本是1.1)
$ ./configure --prefix=/home/charles/ref/libfltk1.1.0
$ make
$ make install
這樣完成後source folder的test folder裏有很多demo program可以執行。
fluid folder裏好像是gui design tool。

Legency RedHat ISO download site

舊版Redhat Linux iso 檔下載站: CLE
ftp://cle.linux.org.tw
redhat 的path是/pub2/iso/RedHat

Another Photo Gallery -- Zoto

像Flickr一樣的網站,免費,也可以外連。也有分Free和Buy 兩種account。
Free account 的space limit是2G. 張數是 ?



使用介面和Flickr很像。也有很方便的外連link產生器。

可惜的是upload client 要用到3901 port。所以很多firewall 都出不去,只好用web upload



現在推薦一人就可以增加100M的quota喔。----- 那就去register 一性的Email account。一個一個推薦吧。

星期一, 2月 13, 2006

紀錄一下,opensource 的手機 : Moto E680 A760 : OpenEZX

http://www.openezx.org/ 主頁,進入畫面,Wiki (資料很少)
http://www.motorolafans.com/ 這個是舊的,最古老的moto phone 網站
http://sourceforge.net/projects/e680/ E680 的kernel source (在SourceForge)
http://sourceforge.net/projects/a760 A760的kernel source (在SourceForge)

A760 ebay 約 5,000,
E680 要6500~10,000 (range 很大)

所以... 拿來當玩具,還是有點不合算....但是比起當初花NT 6000 買iPaq3630---這個應該還可以接受。

Go On - ViewML

前篇,前前篇和前前前篇已經將ViewML需要的flnx和libwww都cross-build好了,現在要正式build ViewML :

一樣,run setcrosstool.sh,設定好CC,CXX,AR...for cross tool.
Config :
./configure --host=i686-pc-linux-gnu --with-microwin=/home/charles/magsi/armutils_2.5.91.0/build_arm/microwin/src --with-fltk=/home/charles/magsi/libfltk --with-libwwwconf=/home/charles/magsi/libwww/bin --prefix=/home/charles/magsi/viewmlap
其中 --with-libwwwconf= 要指向libwww-config 這個檔案所在的path。
make出現error,找不到config.h
這是因為有define HAVE_CONFIG_H。但是在viewml中找不到config.h。
這個option是libwww-conf引入的。因為libwww-conf有用。
  1. Century (ViewML的sponser) Engineer 回覆是g++ 相容性問題。將來會修改。
  2. 這一篇 有說,viewml 需要fltk的config . 會不會同理可證,也就是fltk/config.h ?
  3. 或是在網路上有很多FreeBSD的ViewML port,裡面有config的patch - 其實就是給一個假的config.h.
  4. USERNET 上的文章,有:修正kdecore/kurl.h 的config.h 為linux/config.h
由1, 4來看,使用4的作法試試

星期五, 2月 10, 2006

cross compile libjpeg

上次說到...好不容易flnx 的fluid 目錄的"unrecognizeable insn" 問題已經解決,出現的是 "cannot find -ljpeg" 問題。所以要cross build libjpeg ....
使用的source 是 jpegsrc.v6b.tar.gz (jpeg-6b).

解開後,裡面有install.doc :
.....Configure has some other features that are useful if you are cross-compiling
or working in a network of multiple machine types; but if you need those
features, you probably already know how to use them.
也就是說,cross compile的人就自求多福吧...
run setcrosstool.sh,開始config :
先 決定library 要install 的位置-- 猜大概是在/home/charles/magsi/armutils_2.5.91.0/build_arm/uClibc-0.9.26 (不能加lib喔,因為會安裝include 和lib, makefile 會自動加上lib和include 兩個path name)。
$ source setcrosstool.sh
$ ./configure --prefix=/home/charles/magsi/armutils_2.5.91.0/build_arm/uClibc-0.9.26
$ make
$ make install-lib

完成。
到uClibc-0.9.26/lib 下已經看到ibjpeg.a

結果用arm-elf-g++ build時,uClibc-0.9.26/lib 好像不是default lib path。
所以又config 一次,重新指定 --prefix=/home/charles/magsi/libjpeg6b。

---記得make install-lib 前,要把libjpegb6/include 和bin都mkdir好。

星期四, 2月 09, 2006

arm-elf-g++ use STLport

因為使用uClibc,所以沒有STL可以使用。只好download STLport-4.5.3 來用。
這樣build c++的code時,command是:
arm-elf-g++ tiostream.cpp -o tiostream -I/home/charles/magsi/armutils_2.5.91.0/build_arm/STLport-4.5.3/stlport -Wl,-elf2flt="-s32768"
也就是加入STLport的include path就可以。

很奇怪的是,第一次build時,build OK,但是執行時一直出現execution error。
後來到demo code中將build message log下來,看一下compile , link option。照著作,OK。
再一步一步刪除option,最後還是回到和第一次make一樣的option。

真是奇怪呀!

flnx - cross compile for arm

前,前一篇已經做到好像OK(碰到recognizeable insn error )。因為cross compile libwww 好像OK。所以現在拿flnx-0.17再來試試。

有 關cross compile flnx, INSTALL file section b 有特別說明cross compile的procedure,重點就是在設定compile tool 變數,為了方便,可以先寫出下面的shell script(setcrosstool.sh) :
export AR=arm-elf-ar
export AS=arm-elf-as
export CC=arm-elf-gcc
export CXX=arm-elf-c++
export GXX=arm-elf-g++
export LD=arm-elf-ld
export NM=arm-elf-nm
export RANLIB=arm-elf-ranlib
export STRIP=arm-elf-strip
先run 這一個script :
 $ source setcrosstool.sh
再run configure,因為使用uClibc,沒有支援STL,STL使用STLport-4.5.3。要將STLport的include path加到CXXFLAGS中。 這個動作沒辦法在config時指定,所以要部份作:

confugre --- 修改makeinclude --- make
configure時可以 指定的是microwin 的src path(with-microwin)和安裝的path(prefix).
./configure --with-microwin=/home/charles/magsi/armutils_2.5.91.0/build_arm/microwin/src --prefix=/home/charles/sigma/libflnx --host=i686-pc-linux-gnu
會產生makeinclude。
接著修改makeinclude: 在CXXFLAG中加入以下option
-Dlinux  : 修正
-I/home/charles/magsi/armutils_2.5.91.0/build_arm/STLport-4.5.3/include : 修正"cannot find iostream.h"
-I/home/charles/magsi/armutils_2.5.91.0/build_arm/STLport-4.5.3/stlport : 修正 "cannot find stdlib.h"
在LDLIBS和GLIBS都 加入以下options
-L/home/charles/sigma/libjpeg6b/lib :修正"cannot find -ljpeg"
就可以開始make.
最先出現問題應該都是"unrecognizeable insn"問題,從error message中找到問題的function,找function的local variable中有沒有宣告size過大的array,把size改小。

接著會出現link 時發生resolved external : rint.
這是因為uClibc 的libm沒有加入s_rint.c這個module,修改uClibc/libm/Makefile,把s_rint.c加入source list中,rebuild uClibc.

還會發生一次"unrecognized insn" error,這次是new太多變數,因為test program,所以直接刪掉那些太多的button就可以。

flnx build OK!!

如果要測試test下的program,還要修改下test/Makefile,在 "cxx: " 的rule加上 -Wl,-elf2flt="-s32768" ,才會strip down成uClinux的flt 執行檔格式。

test program時,要記得先啟動nano-X

還沒install ---
$ make install
strip: Unable to recognise the format of the input file fluid
查一下fluid/Makefile,這是因為install 使用x86的strip tool :strip,要修改為cross 的: arm-elf-strip.

OK.

但是還是不行,應該是要改 link command,加入elf2flt,轉換成flat binary file。
修改fluid/Makefile,在$(PROGRAM) : $(OBJ) 的build rule加上
 -Wl,-elf2flt="-s32768"
刪掉install :的rule中刪掉strip 這個command。
fluid,重新make。make install。(會有error,因為include和lib都已經有了,所以error是應該的)。

make install 後,會在install folder(這個例子是libflnx)下有bin, include, lib三個folder。
bin內是一個demo program。可以執行(好像是一個editor..)。

patch and diff - how to make patch

diff 用來產生 差異檔 (patch file)
patch 利用差異檔將源檔案修改為新檔。



diff

diff -u oldfile newfile 
option "-u" 代表 採用universal
diff會將結果輸出到console,所以要存檔的話,用管線符號重導到新檔。
diff -u oldfile newfile > patchfile
diff可以用來對整個目錄或是單一檔案動作。
對目錄動作時要這注意,有時候新目錄會增加新檔,所以diff時要加上"-N" option.

"-N" option 意旨:若舊檔不存在,就當原來該檔案是Null file.
若是沒有"-N" option。diff 只會標示"有一個新檔",但是不會將新檔內容輸出。

比較目錄還要加上"-r" option,代表"recursive".
所以一般diff 目錄用:
 diff -Nur olddir newdir %gt; patchfile



patch

patch [option] orgfile patchfile
會將 orgfile的內容改為patch後的內容,但是"檔名"不變喔。
所以只改一個file時,用這樣的patch比較方便(option 不用)。

patch 目錄的話有一點麻煩,要將diff檔放在目錄的上一層(否則也會被patch)。
然後到目錄下...
$ patch -p1 < ../patch_file.diff
-p1 option 忽略diff file中的一階path。

星期三, 2月 08, 2006

reopen - ViewML, libwww and flnx

上一次的build (http://checko.blogspot.com/2006/01/viewml-open-source-web-browser-for.html) 已經寫不下去。所以由 :http://my.clubhi.com/bbs/661523/messages/21263.html 來看,用一些比較舊的版本(flnx-0.16.tar.gz
viewml-0.22.tar.gz)來試試(或許可以避掉 " unrecognizeable insn" 的compiler 問題。

先紀錄一下上次做到的階段:
  • libwww - cross configure 要修改的部份已經了解(再確認long double的意思就可以)
  • flnx - make fuild 時碰到 "unrecognizeable insn" error : 無解(改source或upgrade to 2.96 )
  • viewml - config 部份似乎ok - 缺libwww config 讀取部份.
從ftp site 各package 的 timetag來看。
libwww 應該是最穩定的--- 只有一版 2000/08/22
其他viewml 和 flnx 的最後三版,似乎對應著開發時間-- 是不是要一對一的使用?


所以,還是從最stable的libwww開始build --

上一篇提到的 long double 選項是yes還是no : 拿 pc 作reference :
double : 8
long double : 12
===> for long double 的選項是yes.
用arm-elf-gcc run出來的
double : 8
long double : 8
所以選項應該要是no
難怪configure 的test program是:exit (sizeof(long double) < ( sizeof(double) )
修 改好configure script ..開始configure :
$ CC=arm-elf-gcc CXX=arm-elf-g++ NM=arm-elf-nm AR=arm-elf-ar ./configure --host=i686-pc-linux-gnu --prefix=/home/charles/sigma/libwww --disable-shared 2>&1 | tee output
OK.
接著
make 
成功!沒有任何error. 再
make install
完成!
重點就在指定CC,CXX,NM,AR等tool和修改configure 這個script讓她可以產生cross-compile Makefile.
以下附上configure script的patch,copy 後rename為到w3c-libwww-5.2.8 的目錄下,用
$ patch configure configure.arm.patch
就可以.
--- configure 1999-04-14 05:17:07.000000000 +0800
+++ configureLibwww 2006-02-09 10:04:43.000000000 +0800
@@ -1,5 +1,6 @@
#! /bin/sh

+# modified by charles - for cross compile in arm
# From configure.in Id: configure.in,v 1.77 1999/04/13 00:33:22 frystyk Exp


@@ -6000,7 +6001,8 @@
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+# { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } -- charleschangethis
+ ac_cv_sizeof_char=1
else
cat > conftest.$ac_ext <<EOF
#line 6007 "configure"
@@ -6039,7 +6041,8 @@
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+# { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } charleschangethis
+ ac_cv_sizeof_char_p=4
else
cat > conftest.$ac_ext <<EOF
#line 6046 "configure"
@@ -6078,7 +6081,8 @@
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+# { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } charleschangethis
+ ac_cv_sizeof_int=4
else
cat > conftest.$ac_ext <<EOF
#line 6085 "configure"
@@ -6117,7 +6121,8 @@
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+# { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } charleschangethis
+ ac_cv_sizeof_long=4
else
cat > conftest.$ac_ext <<EOF
#line 6124 "configure"
@@ -6156,7 +6161,8 @@
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+# { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } charleschangethis
+ ac_cv_c_long_time_t=yes
else
cat > conftest.$ac_ext <<EOF
#line 6163 "configure"
@@ -6194,7 +6200,8 @@
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+# { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } charleschangethis
+ ac_cv_c_long_size_t=yes
else
cat > conftest.$ac_ext <<EOF
#line 6201 "configure"
@@ -6353,7 +6360,8 @@
rm -f conftest*
if test $ac_cv_c_bigendian = unknown; then
if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+# { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } charleschangethis
+ ac_cv_c_bigendian=no
else
cat > conftest.$ac_ext <<EOF
#line 6360 "configure"
@@ -6419,7 +6427,8 @@

else
if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+# { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } charleschangethis
+ ac_cv_c_char_unsigned=no
else
cat > conftest.$ac_ext <<EOF
#line 6426 "configure"
@@ -6464,7 +6473,8 @@
ac_cv_c_long_double=yes
else
if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+# { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } charleschangethis
+ ac_cv_c_long_double=no
else
cat > conftest.$ac_ext <<EOF
#line 6471 "configure"
..

奇怪的gnu g++ : include stl header

好奇怪,雖然
#include <iostream>
也可以,但是使用
cout
會出現"undeclared name" Error。
所以要用
#include <iostream.h>
但是compile時卻又出現warnning,建議不要使用.h字尾....



還有...

stdlib.h 這一個header file,在STLport和 libc 中都有。但是STLport的stdlib.h 卻沒有東西(都是comment),所以include path (-I option) 若是將STLport include path 先寫,stdlib.h 會include 到STLport的版本,導致 stdlib.h 中的function 都不能使用。



原來是因為自己的c++程度不夠的關係。
這是namespace:iostream的宣告:
namespace std{
extern istream cin;
extern ostream cout;
....
}
所以在引用所有iostream內宣告的變數名稱時,都要加上name: std。
也就是說,source code要改成:
int main()
{
std::cout << "Hello";
}
或是在code中加入
using namespace std;

c++ 的namespace是為了防止name-pollution,也就是防止很多.C, .h 宣告出同樣的variable/class/method name。

有宣告namespace的變數,實際reference時都要在前面加上name ::

星期二, 2月 07, 2006

g++和arm-elf-g++的不同

g++ version : 3.3.5
arm-elf-g++ : 2.95.3
在以下狀況時,arm-elf-g++ OK,但是g++不行。

就是argument default value 設定。
2.95.3 允許宣告(也就是.H)和實體(也就是.CXX)中的argument都作argument default value設定(當然,要一樣):
 void foo(int bar=0)
但是3.3.5的話就不允許。只准宣告(.H)作。

這是在make flnx時發現的,因為一直出線這個Error : Fl_Animator.H,CXX default value specified。
後來發現是因為compile 一直用到g++,而不是arm-elf-g++。

正確指定arm-elf-g++後,這個error 消失。
(也就是使用autoconfig 一直發生的問題,一定要重新untar source ,將CXX=arm-elf-g++ 設好後run ./configure,才能真正指定CXX)

星期一, 2月 06, 2006

幾個embedded browser 廠商 和browser 的option

廠商

Feymann(飛漫) 的 mSpider - http://www.minigui.com/product/mspider.shtml
明確寫出支援EM86xx (但是要使用minigui)
另外還有依據Dillo 開發的eDillo Embedded Browser.

UNICOI system 的WebPilot
未說明支援EM86xx(甚至支不支援uclinux都不知道)

TUXIA http://www.tuxia.com/SettopBox.htm 的NanoZilla (已改名NxZilla)
提供一些patch,讓Mozilla能在NanoX上build
NxZilla好像已經GPLed(在SourceForge中 http://nxzilla.sourceforge.net/)


從ubuntulite copy來的browser survey : http://www.ubuntulite.org/wiki/index.php/Internet_applications

這篇文章說ViewML 的architechure不怎麼好:
..... It has a very ugly wrapper to convert the kde and qt calls to flt k....
還 事先在debian下build試試..
./configure --prefix=/home/charles/ref/ap
出現找不到libww-conf的error,所以要 install
$ aptitude install libwww-dev
之後再config 就OK。
還要安裝fltk:
$ aptitude install libfltk-dev
install (會用libfltk1.1-dev)。之後make --- 一樣!一樣的error message。
看來viewml 真的是 虛有其名 呀。

用debian patch的0.21試試.. config問題不見了,但是一樣找不到qstring。
修改一下src/Makefile.new。將src/fltk加入include path。
make 找到qstring。但是說qstring中使用的幾個include file已經out of date。所以
有一大堆error出現...

看 來ViewML最後出現的時間大概是2001,之後再也沒有人可以run了,developer在mailinglist中complain gcc/g++ 的developer的backward-compatability 做的不好。可能就是這樣,他也沒有再修改ViewML了。

可惜ViewML依然是目前low foolpriint browser中最有名的。
也最不能用的 :P

Wiki 有很好的browser 比較
這是對KHTML 的說明.

Goobuntu - Google's Desktop Operation System

說是Operation System 可能不太恰當,應該是Linux的Desktop Environment。

是基於ubuntu 的桌面系統,從 公佈的不太可能是真的的screenshot來看。
是一個桌面管理,上面只有一些Google提供的應用程式(或是利用Google服務的 application interface)。

google前一陣子公佈要協助openoffice,做出網路版本的openoffice。
blogger,Hello(雖然做得不太好),gmail,googletalk已經是不用說了。
google有自己的video 版權格式與播放軟體。
把這些包在ubuntu中,放在一個strip down的linux kernel上,就OK了。

google買下各地廢棄的網路骨幹。
google提供LA免費Wifi Access。
所以送一個免費的pc可以run這些application對一般用戶來說應該是可以接受。

這應該算是網路作業系統吧。

Google也有加入One Laptop Per Child 喔 ($100 laptop計畫)

What kind of 'Smart' are you?

做完測驗後...












Socially Smart


As a socially smart person, you are best with others in real-life situations. This type of intelligence is closely linked to being 'street smart.' Theories and such are not much concern: the things that matter tend to be those which you can see, feel, touch - what you can really experience. This knowledge comes to you both out of a natural knowledge, as well as learning from the situations you find yourself in.


80% applied intelligence
0% learned intelligence
















Take this quiz at QuizGalaxy.com

自動翻譯的bookmark

一些自動翻譯的bookmark :
日翻中
英翻中
法翻中
德翻中
義翻中
荷翻中
俄翻中
韓翻中


英翻中
英翻中
中翻英
英轉簡中
把這些一個一個加入書籤靜可以使用

星期六, 2月 04, 2006

關於Python 的documentation

安裝完python後,都會自動安裝documentation,其中包含有Library reference ,裡面有所有python的module 說明。

文件內容先以大項目分類,再列出分類中的module。然後每個module列出class,function call。
所以使用時要記得import 該項module後才能使用。

以Timer為例,屬於treading module,所以在try 他的sample code前,要加上
from threading import *
不然,就是
import threading
但是在引用Timer( )class時要加上threading.Timer( )

星期四, 2月 02, 2006

2006 生肖運勢 === from 台灣妙妙妙


財運不理想,破財連連,每個月都會有不同的事。
事業 驛馬星動,起伏變化很大,不建議跳槽。 如果想,要 換到遠方。
健康 有精神鬱悶現象,鬱鬱寡歡。
婚姻平平,沒有因緣。年內結婚無望。
9, 10月 注意錢財。 可能會有大的,要諸事小
身帶 黃水晶蓮花。



財物易被竊。
事業 步步高升,成為 老闆。領導者
健康 注意傳染軟並
為另一半會花錢財。
2, 7 月房小偷

將小圓鏡放入紅色錦囊 放入皮包。


財源滾滾,為子女花錢,(或寵物)。小心子女敗家(刷報卡)。
事業一路發,身關
健康,不測之災。要多預防
感情 小心分手的情況。感情運平平。
3 - 大破財(因子女)
5 - 血光
8 - 病痛
紫水晶,放入紅錦囊,隨身帶。



財運旺,有偏財運。
事業: 多方有成。
不探病沒問題。
適合結婚
9 - 爛桃花
10 - 血光
帶綠色玉石或水晶。

貧窮的叔母...

貧窮的叔母,大概就是.."不被重視"吧。

星期三, 2月 01, 2006

Sony 的GPL source code reposit

SONY 在很多地方也用了GPL的軟體,
但是他有follow GPL,release source code喔:

http://www.sony.net/Products/Linux/notice.html

網誌存檔