Search Google

Tuesday, December 26, 2006

泡咖啡...好難阿><

現在時間2006/12/26 4:12AM...
為什麼我現在還醒著呢?!姑且讓我把故事說完吧.

話說上個星期實驗室的設備新添增了"咖啡機"&"電磁爐"兩項.
電磁爐早在我上星期五回台北的時候就已經被拿去煮湯圓,所以經過證實可以正常使用~
咖啡機則到今天才被組裝起來,組裝好後我性沖沖的跑到學校對面的Starbucks買了傳說中
沖泡後會有"淡淡酒香"的"新阿拉伯摩卡豆"...所費不柴花了我五百大洋,比其他的豆子還貴$100!

一開始照著說明書上的比例放入水&咖啡豆(一杯250C.C的水+6g/約一匙的咖啡豆),
經過一陣稀哩嘩啦,乒拎乓啷,轟囃的聲響之後第一杯自己沖泡的咖啡終於完成了!
喝起來...跟喝熱開水沒兩樣><
經過不斷的試驗 --> 不停的損耗那$500元一包的咖啡豆,最後大家一致決定用五匙咖啡豆配上
約550C.C的水,心想這下應該夠濃了吧!
沒想到沖泡出來的咖啡雖然不像第一泡一樣"清淡"卻也不遠矣><
嚐起來像....加水稀釋過的烏龍茶~"~
傳說中"淡淡的酒香"跑哪去了?!?!?!

結論: 經過一番激烈的討論,到現在大家都還不確定到底是機器的問題還是我們技術的問題~
不過照著說明書沖出來的咖啡居然跟熱開水沒兩樣還蠻令人傻眼的 =.=

flat binary中的reloc從何而來? -- irc log

20:24 < cyu021> hi, I am studying how a flat binary is loaded into memory for its execution
20:24 < cyu021> and I found this statement "relocs = ntohl(hdr->reloc_count);"
20:24 < cyu021> I back trace the code and found hdr->reloc_count was obtain straight from the binary file
20:25 < cyu021> So my question is: how is "reloc_count" determined during compile time ?
20:28 < Phasip> cyu021, what struct is hdr?
20:29 < cyu021> Phasip: "hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */"
20:30 < cyu021> so it's a pointer points to struct flat_hdr
21:34 < Phasip> dunno cyu021 =/
22:06 < robfitz> cyu021: Did you see http://www.beyondlogic.org/uClinux/bflt.htm ?
22:06 < robfitz> cyu021: Also have a look at bfd/elf32-bfin.c in the binutils source.
00:59 < cyu021> robfitz: thanks, I will take a good look at that before throwing out another question :-)

Sunday, December 24, 2006

我錯怪八方燴了

為了慶祝聖誕節繼續上班上課,昨天花了將近四個小時的時間搭火車到花蓮提前慶祝!
一路在車上楚於昏睡的狀態,睡了醒,醒了睡...好不容易在12:40分左右抵達了花蓮火車站.
因為情資方面出了點問題--台鐵本來預計12:52才會到的,
所以等了十多分鐘後終於看到欣怡開著她的solio(好像是這麼拼的)出現.
也因為一路上都在昏睡並沒有消耗到什麼體力,因此並沒有餓的感覺.
於是我們先在花蓮市區內散步+幫伯母採買洗面乳,
途中還遇到了欣怡帶的兩個女學生(帶著一附很想八卦但是確強忍住的表情),
之後才驅車前往美崙"大"飯店吃傳說中的"早中餐+下午茶" buffet,
在看到該五星級大飯店的菜色之後我馬上發覺原來前幾天我錯怪了國賓飯店的八方燴!!!
美崙的buffet沒有一樣菜根八方燴一樣的(飲料除外><),
菜色大部分由麵食類組合而成,於是我們兩個人當場達成以後再也不會到該飯店用餐的共識...
不過這樣也好啦,因為實在是沒什麼東西好拿的,
所以減少起來拿菜的次數也間接增加了一些談話的時間.
而且兩個人的花費還不到八方燴一個人的價格(可能是時段不同吧?!)
雖然菜色差了點,但是美崙的造景還真不錯 --> 在一片還算寬廣的草原上有個小造景瀑布.
我們當然不免俗的在飯店的後花園留下足跡.
恩,好像有點離題了!
拉哩拉雜的說了一堆,重點是...我錯怪八方燴了~"~
原來飯店的buffet都是這個樣子的.
除此之外,並沒有任何鄉民想知道的八卦!

Sunday, December 17, 2006

screen的用法

今天終於學到該如何善用screen強大的功能了!
懶得做summary,只好祈禱原po的blog長命百歲 :-)

===== Update @ 2007-11-12 =====
上面的那個連結已經死了,不過倒是在透過Jserv的blog連到Orzlab的blog之後看到更好的解說,
全文包含了使用screen + irssi + irc。

Thursday, December 14, 2006

國賓飯店的八方燴

八方燴吃的是西餐buffet
東西樣式過少,價錢也偏高(一個人八百多)!!!
雖然環境好氣氛佳,但是真的需要氣氛的話吃buffet似乎也不太對?!

結論 -- 實驗室有錢的好處就是能夠增廣見聞 ><

Monday, December 04, 2006

結束了...

今天打完了系運桌球的最後一場比賽...
對手是WIRE lab,賽前看到WIRE lab裡面有去年來幫我們打的同學.
當時想應該還好,比原本打聽到全隊都是系隊校隊的陣容比起來似乎好打不少.
只是沒想到最後我們還是4:0落敗,重點是12場全敗><
我打的第一點成績是11:9, 11:7, 11:9
對方的確是攻守俱佳,我自己則是反手失誤不少,
加上平常跟自己人打的時候差不多都是三球就結束了,
所以在對方銅牆鐵壁的防守之下很多球都是自己失誤.
本來覺得有希望可以打進冠軍賽甚至拿到冠軍的,
結果落的連前四強都沒進.
--> 有機會應該多跟別人打,球路看多了應該對增加勝率也有幫助.

只是中午跟老闆吃飯的時候出現以下的對話
老闆:"今年打的這個樣子,明年該怎麼改進?"
我說:"明年是學弟的事啦!"
學弟:"老師問你明年怎麼改進阿?"
老闆:"我暗示的這麼明顯還不知道!"
.........
我不想打明年的系運了啦!我要畢業... =.=

Friday, December 01, 2006

在遠端連線中輸入中文 & windows與x-window之間copy & paste文字

之前使用Xming + Putty遠端連線到Linux機器上工作,
除了兩件事情之外一切都還算順利:
1) 無法在本機的windows與遠端的Linux x-window之間剪貼文字
2) 無法在遠端開啟的x-window中輸入中文

目前1)已經找到問題所在,並且完美的解決了,以下是網路上善心人士協助我找到的解決方案

Hi James,

Maybe, I found the solution of your problem.

If you use Xming to connect via XDMCP to a server which uses gdm, there is a
problem with gdm.
You must add (or modify) this section in the gdm.conf file
(or /etc/gdm/custom.conf) :

[daemon]
KillInitClients=false

And next, restart gdm with gdm-restart

Regards,
Frederic

至於2)...
原來遵照scim manual中的說明就可辦到!
把以下的設定寫進.bashrc:
XMODIFIERS="@im=SCIM"
export XMODIFIERS
GTK_IM_MODULE="xim"
export GTK_IM_MODULE
scim -d

Wednesday, November 22, 2006

利用另一個vmdk擴充現有vm image的使用空間

有鑒於透過samba mount win32的FAT32會導致某些linux的指令產生錯誤(eg. 執行tar所使用的utime),決定來研究一下將額外的vm image (.vmdk) format成為ext3格式,然後再透過samba mount起來使用的可能性.

聽起來有點繞口...用個流程來解釋好了:
1. windows中的vm image執行linux <-- vm_image_01
2. 在windows中利用vmware再建立新的vm image <-- vm_image_02
3. 將vm_image_02 format成ext3格式
4. 在vm_image_01中的linux也安裝一套vmware (為了使用vmware-mount.pl一定得裝)
5. 在windows中將裝有vm_image_02的目錄設為共享並允許其他人更改
6. 進入vm_image_01的linux中使用samba將存有vm_image_02的windows目錄mount起來
7. 接著使用vmware-mount.pl將vm_image_02 mount起來
8. 大功告成,恭喜各位觀眾可以在不碰vm_image_01的情況下增加使用空間 :-)

有關第(7)步地全文請參照這篇

方法二
后来在/usr/bin/下发现了vmware-mount.pl,研究了一下

进入虚拟机文件所在的目录

vmware-mount.pl -p “Ubuntu 64-bit.vmdk”

在列表中找virutal disk的partition编号,然后就可以mount
sudo vmware-mount.pl “Ubuntu 64-bit.vmdk” 1 -t ext3 /media/vmware
现在是可以高速读写,哇哈哈,然后重新进入虚拟系统看了一下,一切正常

以上的作法只允許root對這個partition寫入資料.
也可以用sudo vmware-mount.pl “Ubuntu 64-bit.vmdk” 1 -t ext3 -o rw /media/vmware來讓這個新的partition可以被一般使用者寫入.

Monday, November 20, 2006

time sync -- ntpdate

#ntpdate -u 0.pool.ntp.org

寫入crontab:
#crontab -e
30/* * * * * /usr/sbin/ntpdate -u 0.pool.ntp.org

--> 每三十分鐘sync一次

Sunday, November 19, 2006

路上巧遇藍小慧...

今天下午跟河馬到西門町,走走逛逛,打完撞球,吃完飯之後站在大電視牆前面努力的把珍珠奶茶喝完準備上捷運的時候,突然聽到旁邊有個還蠻耳熟的聲音在講電話,轉過頭一看...才發現原來那是藍小慧!!!

沒想到回台灣四年完全沒有聯絡的人就這樣在西門町的電視牆前面相遇了~~他在半年前回台灣,現在也在台灣工作,大家聊了十幾二十分鐘之後互留了電話,他約了朋友(又是一個剛從NZ回來的人,叫做Stanley)吃飯,而我跟我的前室友則往捷運站前進.

結論是...地球真的很小!

ps.今天撞球打得蠻順的,手感還不錯 :-)

Friday, November 17, 2006

mirror a web site with wget

http://www.boutell.com/newfaq/creating/mirroring.html

一言以蔽之...
wget -m -k -K -E http://url/of/web/site

重點是要mirror這個站,他逐行解釋asm解釋Linux跳進start_kernel之前做的事,是不可多得的好站阿!
不過訪客人數卻意外的低...

重新回頭玩ubuntu...

不錯的手札,尤其可以參考字型的部份.

雖然找不到locale.gen,但是使用locale-gen zh_TW即可直接產生big5的locale.

mount samba drive (windows的共享目錄):
編輯/etc/fstab -->
[network folder] [mount point] [file type] [mount at startup],[use as root],[remote username],[remote password],[file access rights],[directory access rights] 0 0

eg.
//rookery/storage /mnt/rookery smbfs auto,uid="root",username=guest,password="",fmask=777,dmask=777 0 0

當然,要使用smbfs之前要先裝... --> apt-get install smbfs

如果想要透過samba把Linux下的folder與windows機器分享,要記得在
/etc/samba/smb.conf的[global]下面加上以下三行:

display charset = BIG5
unix charset = BIG5
dos charset = CP950

這樣子windows的網路磁碟機連線後才能看到中文檔名,想看到中文內容的話應該要把locale設為zh_TW.BIG5

Saturday, November 11, 2006

原來我老豆這麼厲害!

上個星期我爸去參加全國輕質骨材會議(第八屆)暨兩岸輕質骨材會議(第二屆),



原本想說我爸應該只是去當聽眾, 看看有沒有機會找到合作對象, 沒想到今天回家的時候我媽開心的說"你爸爸拿到優良論文獎!!!"

可見當年考試都考第一名不是說假的~


一問之下才知道原來爸爸跟台灣的一個教授合作研究燒製輕質骨材的窯爐, 論文那位教授寫, 實驗及報告都是我爸親自上陣.

這就是愛台灣啦!!!


聽說我爸報完之後引起台下一陣轟動, 我爸說他從原本默默無名變成現在輕質骨材界大家討論的焦點之一. 他的窯爐辦到了大陸同胞五十年來辦不到的事情--將不同燒製階段的溫度做明顯的區分, 比如說燒製輕質股才需要經過四個階段, 其中預熱與高溫段的溫差斜率能夠達到90度角, 對於輕質骨材界來說這是生產優良建材的必備條件, 只不過目前還沒有一座窯爐能辦到, 再加上他們還找不到有辦法耐到那麼高溫(1200度C)的材料來做窯殼, 所以沒辦法跳脫傳統的加溫方式.

因為我爸之前做過燒製磁磚建材與電子零件的窯爐, 燒製溫度動輒上千度, 所以經由這樣子跨領域的結合之後一座適合燒製輕質骨材的窯爐就這麼誕生了!!! 果然現在做什麼事情都要multi-dicipline了><, 也只有multi-dicipline才有辦法在某一個領域提出一個創新並且能夠造成impact的解法~ 以上就是我身為2005年年度review machine的看法.

最後, 希望我那世界無敵optima的Just in time Device Scheduler能夠順利被accept...

Friday, November 10, 2006

就是有人愛雞婆

今天一早被老闆的電話叫醒,因為他沒有辦法寄信到特定的mail server,請我"figure out what went wrong". 打開老闆轉寄過來的退信通知,上頭大剌剌的寫著"Client host [xx.xx.xx.xx] blocked using dnsbl.njabl.org; 1078224004 (in reply to RCPT TO command)",當下就申請將我們的ip從block名單上移除,然後在他們的網頁上晃晃. 不晃還好,一晃倒是看到了這篇, 文中居然使用帶有威脅的語氣說

If you run an open relay, do not intend to secure it, insist that we not test your system, and send us anything we consider to be threats or harassment, we may exclude your IP from testing, but it will be permanently added to our list.

又不是每個架mail server的人都是專家, 你今天block他的ip讓他的信寄不出去已經是妨礙人身自由, 垃圾信那麼多, 怎麼防? 用content filter就好啦, 沒事block人家ip幹麻. 把別人的ip加到list中還說
We do not block email. We just provide a tool for network/system/mail administrators to use to protect their mail servers from email abuse.

根本就是戒刀殺人而已... 感覺上很像美國人想當世界警察的那種樣子 <-- 神經病!
今天檢查過所有外寄郵件都需要經過saslauthd的認證, 加上postfix本身就不會成為open relay, 我實在搞不懂為什麼會被定義為open relay還被加到list中? 總之目前mail server的ip已經從名單中移除, 希望我們的mail server不要再被擋, 不然我又要被指派去處理><

Thursday, November 02, 2006

好用的vim script

前幾天看到有人在vim下面使用script讓它看起來像是Windows下面的IDE。
好奇之下昨天跑去翻了一下www.vim.org的script list,發現了幾個好用的script。
1. TabBar
2. winmanager

(1)以tab的形式把目前所開啟的buffer都顯示出來,方便管理buffers,當開啟許多檔案的時候(eg. trace code)就顯得非常好用。
(2)將vim的畫面切割出一小塊空間用來顯示目錄&檔案,在browser files的時候也比較方便,不需要一再的使用:!ls或是跳到另外一個console下。

當find遇上grep~

很久沒有trace code,今天重新開始trace code。。。
不過立刻遇到的問題是忘了怎麼用find & grep!
find & grep分開來都會用,但是合在一起就忘了該怎麼組合><
經過一番嘗試之後終於拾回記憶:

find . -name pattern1 -exec grep -n pattern2 {} \; -print

pattern1 --> 指定檔案
pattern2 --> 指定要搜尋的字串

Tuesday, October 31, 2006

我懷疑Gmail。。。

我懷疑Gmail並沒有替每個使用者分配他們所宣稱的磁碟空間大小!
eg. 他們說每個人有277xMB,其實每個人實際上卻沒有那麼多的空間。
因為剛才(五分鐘前)寫email寫到一半的時候想先存個draft,沒想到卻出現了下面的錯誤訊息。。。


不過現在可以存了,看來他們或許是給每個人一個基數,等到你用超過基數後再檢查你是否超過系統設定的上限,如果沒有超過就動態分配空間給你。

Thursday, October 26, 2006

ESWEEK (Trip to Korea) -- Day 6

今天是我們在韓國的最後一天,昨天晚上因為太晚的關係,
所以放老闆鳥(他本來約我們吃宵夜), 早上終於與老闆相遇。
Morning session聽到一篇由德國\&美國共同合作的papaer。
那篇paper居然有辦法將hard real-time apply到一般的system,
他說他利用program trace\&分析的方法得到WCET,
宣稱能夠精確的得到每個program會被interrupted/preempted幾次!
Anyway,有時間再仔細把paper仔細拜讀一下。

與老闆一起吃過午餐之後,我們終於有機會採購禮物~
很遺憾的。。。並沒有買到傳說中的狗肉罐頭><

重點是下午我們在Sejong Hotel門口等待機場巴士的時候,

看到一個女生也在等巴士,就在我們眼光交會三次之後。。。
我終於鼓起勇氣與那個女生聊天。
原來他是全日航的空姐,這次休假五天到韓國玩,
聊了大約十多分鐘,巴士也到了。
八十分鐘後抵達仁川機場,就在這個時候我請他幫我\&Punk拍照,
接下來當然請路人幫我們拍了一張合照 :-)
所以各位鄉民請放心,絕對有真相!有興趣的人請來信索取 :-P

接下來當然是用要拿照片給他當作交換資料的藉口,
我先留了名字與email,最讓我沒想到的是。。。
他留了名字與地址之後居然連手機都留給了我!!!
看來這次的韓國之旅還真是奇妙,在韓國待五天,
最後居然還要到一個日本空姐的聯絡方法><

看來這次韓國之旅也算不算是徒勞無功 :-D

Monday, October 23, 2006

ESWEEK (Trip to Korea) -- Day 4

今天總算開始EMSOFT的行程,也是第一天轉鬧鐘。
誰知道人算不如天算,下飛機的時候忘記把手機的時間也往後調一個小時,
因此今天在Punk過來敲門之前都以為我七點就起床了~
也因此就在conference的第一天遲到了將近半個小時><


一整天聽下來除了認識一個在MIPS工作的台灣人(圖中最右邊那位)之外可以算是毫無收穫。。。

EMSOFT幾乎被dataflow, deadlock, modeling給佔據~
偏偏我的數學又不好。。。完全就是被壓著打 :-(
不過倒是有三個sessions跟本實驗室的研究領域完全相符,
一個是lexel的wireless sensor,一個是ryan的flash memory,看來2006年年度review machine
的預測錯誤,另一個洨安的是deadlock。
讓我們恭喜以上三位得獎的同學~~
至於low power則集中在hardware design,軟體幾乎是沒戲唱。
Real-time...醒醒吧,孩子!

對了,原來那個在MIPS工作的人居然是"廖士偉"的同學!
就是去年到日本幫他報paper的那個在Intel U.S.工作的王者~
看來要趕快藉這個機會重新與他恢復連繫 :-)

這就來寫信給Dr. Liao...

Sunday, October 22, 2006

ESWEEK (Trip to Korea) -- Day 3

今天是我有生以來第一次參加集會遊行,
只不過地點是在韓國。。。
早上我們在房間內認真的做research,
一直到中午的時候才出門往景福宮方向前進,
等我們抵達的時候已經下午一點多了,
我們找了一家看起來像是當地人會去吃的餐廳,
既然都到了以人參雞著名的地方,
我們當然是點了人參雞作為午餐 :-)
人參雞顧名思義當然由小雞與人參組成~
他們將小雞的內臟完全掏空,放入糯米,
搭配放有湯頭、蔥、蒜、人參的小甕之中蒸煮,
配菜除了小菜盤之外還有一小杯人參酒。
(跳過吃的部份。。。反正就是很好吃就對了)


吃飯的時候遇到了一個韓國警察,
他很和善的問我們從哪來,
我們也問他為什麼今天這附近這麼多警察(至少有20輛遊覽車配有防暴盾牌的警力)。
原來是因為今天有遊行抗議韓國即將與美國簽訂自由貿易協定。
於是飯後我們將鄉民精神發揮的淋漓盡致~
從集會一開始就在旁邊猛拍照。。。
當然也經歷了領導人的信心+精神喊話、誓師授旗儀式。
連最後他們拿著旗幟走上街頭我們都參了一腳!!!


途中看到有一堆警察集合在一起的時候我們就會拍照,
依照慣例,警方總是會揮揮手叫我們不准拍照。
但是Ryan & Punk仍舊是藝高人膽大的偷拍了幾張 ^^


走到後來實在是很累,於是我們轉進"鐘閣"地區逛了一下相似於西門町的街道。
晚上回到明洞的餐廳吃烤肉+傳說中的海鮮煎餅。
吃完之後我們還是覺吃人參雞比較划算~
一樣花一萬元,吃人參雞比較爽+飽 ^^

這三天走下來發現在台灣買的旅遊導覽寫的太不仔細了!
每次都說搭地鐵到xx站yy號出口後走zz分鐘~
也沒有說往哪個方向走,鬼才知道往哪走zz分鐘><
連美食介紹也有問題,明明說東大門有賣海鮮煎餅小路邊攤,
可是昨天找了一個晚上只看到一家,而且還只是煎餅。。。沒有海鮮><
既然今天在明洞吃到,也就不跟他計較了 :-)

總之這三天走了很多路,坐了很多站的地鐵,還蠻有趣的。
雖然沒有去太多景點,但是我們卻充份的融入當地文化。
eg. 昨天到戰爭紀念館看人家舉行傳統韓國婚禮+今天跟當地人一起抗議 :-P
自助旅行的好處就是想走就走,超自由 :-D

要來去查看明天conference幾點開始了。。

ESWEEK -- 韓國之旅 -- Day 2

今天早上九點半起床,
Ryan說他睡得很好雖然晚上被吵醒了三次><
早上十一點出發前往會場-Lotte Hotel探堪路線,
路途中發現韓國的地鐵系統遍布整個漢城地區還蠻方便的,
不過地鐵站內的動線設計的非常差,
當月臺分佈在軌道兩邊的地方常常要走上好一大段路程才有辦法轉車~~


抵達樂天市場時已經中午了,
當我們要點餐的時候才赫然發現他們點餐的地方並沒有圖片可以讓我們指指點點!
於是聰明的Punk拿出數位相機,
走到有圖示的地方把菜名拍下來再拿到點餐處讓小姐下菜單。


下午我們走遍了Lotte商圈,
又依著旅遊手冊的介紹到東大門尋找傳說中的海鮮煎餅,
很遺憾的我們並沒有找到~~
於是在東大門附近隨便吃了點東西便啟程返回明洞。
回到明洞後才發現原來旅館附近就有一堆商店在賣海鮮煎餅!

今天是晚餐時間去逛明洞,
與昨天半夜十二點多去逛所看到的情景相去甚遠,
相較之下今天熱鬧許多,
也吃了一支1000Won的30公分高冰淇淋 :-)

回到房間之後才發現。。。
原來旅館並沒有幫我們清洗昨天使用過的碗盤><
於是我只好卷起袖子清理一下,
因為晚上還要煮宵夜呢 \verb+^^+

最後,
今天遇到最令人生氣的事情是。。。
合勤那號稱有AP功能的無線網路卡居然沒有用 :-(
我跟Ryan是了半天就是沒有用,
一定要寫個投訴信到合勤好好抱怨一下!!!

今天走了一堆的路,
腳好酸阿,
所以現在吃點泡麵應該不為過吧 :-P

吃麵之前總結一下今天做的重要事項:
買悠由卡
搞清楚前往會場的路線
會搭韓國地鐵
發現zyair g220的AP功能不能用

ESWEEK -- 韓國之旅 -- Day 1

今天我,Ryan,與Punk於晚間9點半抵達韓國仁川機場。

飛機上看到了一個韓國正妹,雖然眼睛看起來有點水餃眼,但是整體來說還
蠻可愛的 :-)
在機場經過一番詢問之後終於確定搭乘605-1號公車前往首爾明洞地區。
途中遇到了一位非常熱心的"祖國同胞",他說著一口流暢的韓文幫我們問路,
在公車上Ryan也完全將與陌生人攀談的技能發揮的淋漓盡致,與祖國同胞相談甚歡。
祖國同胞完全承襲了"解放台灣"的思想,但是他的論點卻又有幾分道理!

以下是祖國同胞對臺海關係的看法:
戰略因素:中國要成為真正的霸主之前一定需要台灣,只有透過台灣,
中國才有辦法直接與海洋接觸,也因為如此,中國更不可能讓台灣獨立。
不要說獨立,讓美國的航空母艦守護臺海都不太能忍受。
經濟因素:中國已經嚴然成為全球經濟成長的支柱,對目前的中國來說,台商跟其他
外資沒什麼兩樣,不過卻有著同文同種的親切感,因此對台商提供各式個
樣的優惠。
政治因素:將來可以尋目前香港的作法,讓台灣目前的體制繼續運作,不過比照大英
帝國的作法,總統只存在大陸,讓台灣目前的行政體系,只是最高行政長
官變成總理。

抵達地鐵明洞站之後找了兩個韓國妹問路,其中一個還蠻不錯的,蠻可愛的,
手摸起來細細的,目測也頗"兇",穿著帆步鞋大概到我鼻子的高度,
因為他們要去的地方跟我們旅館在同一個方向,於是在他們幫我們打電話給旅館
確定位置之後便幫我們帶路,原來我們住的旅館(Han SuitesHotel)走路大約
五到十分鐘。

原先我們定了一間雙人房,一間單人房,不過到了之後發現雙人房其實足以容納
我們3個人,但是因為旅館的規定加上我們是透過旅行社定的房,所以無法臨時將
單人房退掉。。。
不過櫃台的先生還蠻有趣的,離開之前一定要跟他合影 ^^

我們放好行李之後便隨即出門熟悉地理環境,回旅館的途中買了韓國泡麵數包讓
Punk一展手藝,大家吃的不易樂乎,看來回台灣之後要每天跟翰翰跑步減肥去了!
最後大家決定把用過的鍋碗瓢盆就放在桌子與流理台上,看看明天旅館會不會幫
我們換一套新的><
希望明天回來已經有新的餐具可以用,不需要自己再洗了 :-)

最後,有線網路一天收費2000 Won,還好我買的usb無線網卡有AP功能,可以讓我跟
Ryan同時上網 :-D

Sunday, October 08, 2006

[測試] blog via email

聽說可以透過email更新blog。。。
這就來測試一下 :-)

--
This is a UTF-8 formatted mail
-----------------------------------------------
James C.-C.Yu

Saturday, October 07, 2006

歲月如梭

忽然發現離上次更新blog已經有四個月,想當初還在為參加比賽寫paper。
轉眼間,比賽結束了,也運氣很好的找到了可以寫論文的題目(感謝Edward學長)。
現在就為過去四個月的缺席做個簡短的報告好了~

1. 參加"6th International Low Power Design Contest"失利,獲勝隊伍果然都是做跟硬體相關的東西,軟體在low power界似乎還沒抬頭?!

2. 發現vmware + Linux的新玩法,開啟xdmcp支援,使用Xming進行遠端桌面之後的效能似乎比單純使用vmware + Linux要來得好一點,唯一的缺點是Xming目前似乎還沒有辦法在中文電腦中支援讓Linux與Windows使用同一個剪貼簿,因此必須手動開啟文字檔將文字從Linux傳到Windows系統中,反之亦然。這個問題已經回報Xming作者,目前正queue在bug list中!

3. 看學長用了Vista RC版之後發現Vista只是比較漂亮的XP,應該說擁有Mac OSX介面的Windows XP。。。看了之後覺的非常失望,奉勸大家還是乖乖使用Win XP就好,不要花冤枉錢升級硬體了><

4. 好不容易終於找到了可以打嘴炮的論文題目,目前總算是進入嘴炮模式,該準備開始寫程式跑模擬了!

5. 過去四個月好像沒做什麼事。。。時間確像風一般的流逝~~

恭喜Tim上了Cheers雜誌

今天在看雜誌的時候赫然發現Tim上了Cheers (快樂工作人)雜誌!
一下子在雜誌中看到跟自己住在一起三、四年的人上雜誌還頗不習慣。
因此特別在這裡恭喜Mr. Timothy Wu/巫介庭先生榮獲2006年的"快樂工作人獎" :-)
發完文之後我也要努力讓自己成為一個快樂工作人~~

Sunday, June 25, 2006

讓 Cygwin 顯示中文

讓 Cygwin 顯示中文

vi ~/.inputrc

取消註解以下幾行:

set meta-flag on
set convert-meta off
set input-meta on
set output-meta on

vi ~/.bashrc

加入以下資料:

alias ls='ls -hF --show-control-chars --color=tty'

Friday, June 09, 2006

尋找支援Linux的AD資料擷取卡

產品簡介:
http://www.adlinktech.com/PD/web/PD_detail.php?cKind=FN&pid=390&seq=3&id=3&sid=19

data sheet之一:
http://www.adlinktech.com/PD/marketing/Datasheet/D2K-DASK+X/D2K-DASK+X_Datasheet_1.pdf
single-point digital input,single-point digital output,各有幾個channel?

Thursday, June 08, 2006

原來samba可以設定remote user...

今天在設定vmware上linux的samba時就是一直無法把資料夾mount起來~
搞了很久,確定sampasswd過,甚至連security都設成share了還是失敗
最後在無意間看到smbpasswd可以加上"-U"參數創造remote user,想說
姑且一試~沒想到就這麼將資料夾成功的mount起來了!!!

bye bye vmware!

想要用vmware player卻不知到怎麼樣create image的人可以參考一下下面這個link
的第21篇回文 http://www.hackaday.com/entry/1234000153064739/
重點節錄:
You can use QEMU-img.exe to create VMDK(VMare virtual disk files meaning you
don't need to download the browser image. Also I think this will create files
that can be used as ide drives.
結論:
有了QEMU + vmware player就可以不花錢使用user friendly的virtual machine。
補充:
QEMU也有gui介面了。。。 http://www.davereyn.co.uk/download.htm

為了預防網站掛掉,自己手動copy一份:
21. Posted Oct 25, 2005, 2:04 AM ET by Rhys
Hey, Incase you don't read slashdot? You can use QEMU-img.exe to create
VMDK(VMare virtual disk files meaning you don't need to download the browser
image. Also I think this will create files that can be used as ide drives.
Quick and easy:
1 Download the the vmplayer
2. create a vmdk disk file like this:
qemu-img.exe create -f vmdk
3.Create a vmx config file. Here are the basic options you need:
config.version = "8"
virtualHW.version = "3"
memsize = "128"
ide0:0.present = "TRUE"
ide0:0.fileName = "DiskFile.vmdk"

-------TO BOOT AN ISO----------
ide1:0.present = "TRUE"
ide1:0.fileName = "c:\debian.iso"
ide1:0.deviceType = "cdrom-image"
-----------------------------------
OR
-------TO BOOT CDROM-----------
ide1:0.present = "TRUE"
ide1:0.fileName = "auto detect"
ide1:0.deviceType = "cdrom-raw"
---------------------------------
floppy0.fileName = "A:"
ethernet0.present = "TRUE"
ethernet0.connectionType = "nat"
usb.present = "TRUE"
sound.present = "TRUE"
sound.virtualDev = "es1371"
displayName = "Debian 1"
guestOS = "other24xlinux"
nvram = "debian1.nvram"
scsi0:0.redo = ""
ethernet0.addressType = "generated"
uuid.location = "56 4d f3 a5 03 8c cb b9-ed bb 8f 10 a3 de b0 10"
uuid.bios = "56 4d f3 a5 03 8c cb b9-ed bb 8f 10 a3 de b0 10"
ide1:0.autodetect = "TRUE"
ethernet0.generatedAddress = "00:0c:29:de:b0:10"
ethernet0.generatedAddressOffset = "0"
checkpoint.vmState = ""
tools.remindInstall = "TRUE"
ide0:0.redo = ""
Now just run up the vmx file in the player. Boot the cdrom/iso and install
the os as usual.

qemu-img convert
eg. qemu-img convert -f vmdk /path/filename.vmdk -O raw /path/filename.raw

MS的registry...

我一直以為registry的值改了就算數,今天試了之後發現改了居然沒有效果。
想說登出再登入應該就可以了?但是還是無效!
最後還是要靠重新開機~~~
但是也因此學到從command window下重開機。。。
"shutdown -r -t 1",一秒鐘之後重開機。如果要關機就把"-r"換成"-s"
為什麼需要從command window reboot呢?因為我不在實驗室裡 ^^
所以我從連人的機器透過ssh連到被連的機器來確定開機完畢。
話說我一直想要用不同的port來連遠端桌面,結果還是沒辦法work ><
首先我先把port從3389改成3390(被連的跟連人的都要改),然後將兩台機器都
重新開機。再來修改71.71上的iptables,把3390這個port從71.71轉到自己的ip。
當兩台機器都開完機的時候發現遠端桌面居然失敗了。。。
想試試看改port的人可以先用兩台實體ip的電腦玩玩看~希望可以成功,不然71.71
唯一的3389 port就這麼被我佔住,我會很不好意思。。。

使用不同的port連進MS遠端桌面

1. 將被連機器上的registry:
"hklm\system\currentcontrolset\control\terminal server winstatoins\rdp-tcp"中的PortNumber改成自己想要的port
eg. 3390
2. 重開機
3. 使用實體ip的人可以跳過這一步。
到71.71上修改/etc/iptables & /etc/iptables.sh
前者是正規的設定檔,後者是hanhan or frog 為了方便寫出來的script
修改完之後執行/etc/iptables.sh (需要su access)
4. 使用client機器在連線遠端桌面時在ip後面加上:即可
eg. 140.114.71.71:3390
5. 上一篇說server & client都要改port數是錯誤的。。。
改server的port就ok

Implementation of Real Time Power Saving Scheme for Embedded Device(s)

這本log book實際上是從2005年十月開始寫的,當時想為嵌入是即時系統實做一個省電的scheduler,中間也拉哩拉雜的做了其他事情,所以拖了一陣子。 適逢嵌入是軟體聯盟舉辦了一場軟體競賽,於是在老闆的”督促”下參加了這個比賽,希望可以藉由參加比賽加快作品完成的速度。當初填寫只為了防止自己忘記一 些想法,因此記錄的非常隨性堪稱凌亂,現在會放到網頁上也只是看中了google的storage center”應該”是個頗可靠的資料存放地點,因此也不太想再多加修改。。。

Implementation of Real Time Power Saving Scheme for Embedded Device(s)

Survey the following items:

Real-Time Kernel

Refer to http://www-128.ibm.com/developerworks/cn/linux/embed/l-realtime/, RTAI is the candidate most likely to be used to implement our research topic on DVS+I/O+RT-Kernel.

I/C switch component & inverter selection

Circuit's layout provided by Microtimes

The available GPIO pins are:

J16 aka. CMOS SENSOR/SPI – next to the ethernet socket. The available pins are pin17~22 (don't program these pins to SPI). The memory mapped

J14 aka. con20 – next to the LCD/TOUCH SCREEN socket. Pin1~7 are available if they aren't programmed to function Analog to Digital conversion.

The map between these pins and memory addresses is provided as follows:

SPIMISO0 --> GPE11

SPIMISO1 --> GPG5

SPIMOSI0 --> GPE12

SPIMOSI1 --> GPG6

SPICLK0 --> GPE13

SPICLK1 --> GPG7

AIN1 -->

AIN2 -->

AIN3 -->

AIN4 -->

AIN5 -->

AIN6 -->

AIN7 -->

========== 6th Oct 2005 ==========

In s3c2410.h:

GPECON is defined as a macro, rGPECON.

GPE13 [27:26] --> 01 (configure SPICLK0 to Output)

GPE12 [25:24] --> 01 (configure SPIMOSI0 to Output)

GPE11 [23:22] --> 01 (configure SPIMISO0 to Output)

GPEDAT is defined as a macro, rGPEDAT

GPGCON is defined as a macro, rGPGCON

GPG7 [15:14] --> 01 (configure SPICLK1 to Output)

GPG6 [13:12] --> 01 (configure SPIMOSI1 to Output)

GPG5 [11:10] --> 01 (configure SPIMISO1 to Output)

GPGDAT is defined as a macro, rGPGDAT

Install Domingo, but prefer to try out the experiment with Trace32. Ask Hogan about Trace32 tomorrow.

========== 17th Oct 2005 ==========

l Cannot get Trace32 to work with Creator-s3c410, thus move on to plan B – install Domingo on the PC dedicated for experiments. [done]

l The kernel and file-system images provided by Microtime works all right, but I encounter a problem that kernel debugging with ram-boot doesn't work as described in the tutorial. [done]

l Need to find another NIC for my NB so creator can load kernel module dynamically via a crossed LAN cable. [done]

l The macros (rGPECON, rGPEDAT, rGPEUP, rGPGCON, rGPGDAT, rGPGUP) defined in s3c2410.h cannot be accessed directly in Linux kernel, kernel hangs if we access them by force. Need to try whether mmap() works as well as keep trying out the address listed in s3c2410 datasheet. [under investigation]

l Two major tasks to do:

1. Gain control of the GPIO we need. [todo]

1.1. Try to use the macros defined in linux/include/asm/io.h

2. Look into the example LCD device driver and see if I can shot it down, reinitialize it, and make it to work properly as it was. [todo]

l “make modules_install” incurs building errors... got some files short, reported this problem back to Microtime. [done]

========== 24th Oct 2005 ==========

l Start tracing Linux code (from start_kernel).

1. Macros defined in s3c2410.h is first used in s3c2410_gettimeoffset() <-- setup_timer() <-- time_init() <-- start_kernel(), can we use macros straight forward like this after memory is initialized ? [should be OK, lots of direct GPIO ops are found in module code]

2. Traced routines are kept in ~/research/ext3/logs/ConfigStopGPIO().mm

l Problem 1: Recalculate symbol failure:

Solutions –

1. Use hard copied files, and hard copies only, symbolic links simply won't work!

2. Put everything to the exact path (/usr/src/creator/)! E.g. /usr/src/creator/nfs/... ; /usr/src/creator/s3c2410/...

3. Use the src come with the CD I got today from Microtime and follow the step 1 to 6 marked in Chap3 in the book 05714-007.

l Problem 2: make modules_install failure

Error msg:

Can't open /lib/modules/2.4.18-rmk7-swl8/modules.dep for writing

make: *** [_modinst_post] Error 25

Solutions –

1. No harm is done by this error, just ignore it.

l Problem 3: Lack of creator-s3c2410-cmos.o

Solutions –

1. This obj file is included in the CD came along with the book 05714-007, we have to manually copy the file to .../nfs/ or whichever folder we prefer.

l We can create a new filesystem to replace ext2_2418_Creator2410 and hold all the modules or even build the modules into kernel so we don't need to setup a network connection between Linux host and Linux target.

l Use cross-over LAN cable to reduce the change for bad things to happen throughout the debugging process.

l The basic setup should be like:

Linux host <– LAN –> Windows host <– JTAG –> Linux target

========== 31st Oct 2005 ==========

l Problem 1: Loading symbol table, vmlinux, seems to disturb the system.

Observation –

The console responses from different loading combinations:

1. Load kernel (zImage) and filesystem (ext2_2418_Creator2410) individually with debug->load module –> Console commands work smoothly.

2. Flash filesystem into NAND flash memory and load kernel with debug->load module. All OS features are disabled/unchecked –> Booting is quickly done. Console seems to work all right, but the keyboard inputs are experiencing serious lag. For instance, I have to tap on backspace key for 14 times to get 'ls' parsed and console to print out content of current folder (it's the root folder in my case).

3. Flash filesystem into NAND flash memory and load kernel with debug->load module. One of the OS features, auto attach tasks, is enabled/checked –> Booting process slows down after message, “INIT: version 2.78 booting”, appears on console. printk() doesn't function as smoothly in 2nd observation (don't even mention the 1st observation).

4. Flash filesystem into NAND flash memory and load kernel with debug->load module. Both OS features, auto attach tasks and dynamic loaded module, are enabled/checked –> Booting process halts after message, “INIT: version 2.78 booting”, appears on console and looking for the following object files:

1. cs8900a

The console behaves similar to 3rd observation after the system finishes booting, sometimes Domingo doesn't seem to know where to locate 'ls'...

5. Flash filesystem into NAND flash memory and load kernel with debug->load module. All OS features are disabled/unchecked. Didn't load line number nor symbol –> We have the performance that we observed in the 1st observation.

Explanation –

For the system to support kernel debugging, certain functions introduced to the system might fire excessive interrupts, which causes the disturbance. Let's see how things go after trying out loading APM module dynamically.

Response from microtime

Give it more time to finish booting. (This actually works...)

l Problem 2: Cannot load creator-s3c2410-lcd.o

Solution

IRQ_TIMER1 is occupied by Linux, so we have to change LCD to use IRQ_TIMER2.

[TODO] – Case 1:

1. Initial GPIO pins in either sched_init() or time_init().

2. Modify timer_bh() to trigger certain GPIO pins and use oscilloscope to see whether the pins behave as expected.

Experiments' logs –

1. GPECON and GPGCON are initially set to 0xaaaaaaaa & 0xff95ffba by default. These two registers are changed to 0xa54aaaaa & 0xff9554ba accordingly after setting GPE[13..11] and GPG[7..5] to “Output” respectively. [Just an illusion!!!] Only the variable get changed. Also, instead of editing sched_init() or time_init(), the change should be made in function Port_Init() in linux/include/asm-arm/arch-creator-s3c2410/uncompress.h

2. Set GPE[13..11] and GPG[7..5]'s default to “logic-low” --> “0”. Turns out only JP11[17, 19, 21] (GPEDAT[11..13]) behave accordingly (the observed peak-to-peak voltage is approximately 3.3V). JP11[18, 20] (GPGDAT[5, 6]) & JP11[22] (GPGDAT[7]) stay at high and low forever respectively. It doesn't matter whether rGPxDAT is assigned a value in do_timer() or timer_bh().

Results –

We have only three GPIO (GPE[13..11]) to control the circuit externally by force. Need to find certain IC switch that can be trigger by such low voltage and is capable of holding large power when it keeps the circuit open. [Task is created on 7th Nov 2005][put to on hold list on 16th Nov 2005]

The reason GPGCON[7..5] didn't seem to be changeable is its initial setting is overwritten by a later invoked initial function, HW_kbd_init(). Thus, by modifying HW_kbd_init() both GPECON[13..11] and GPGCON[7..5] are now set to Output. [Problem solved on 10th Nov 2005]

Follow up –

Goto electronic shop and ask for “IC-245”...

Need to buy some relays/switches and voltage amplifiers.

[TODO] – Case 2:

1. Boot the system without any debugging support and load APM module dynamically with 'insmod'.

2. Go through APM module once again and participate the outcome of having such module loaded.

Experiments' logs –

1. 'insmod' and 'rmmod' work all right regardless the system run with or without debugging support. All three modules, lcd, cmos, and codec now can be successfully loaded into and unloaded from the system.

2. Still looking for the module for APM... [Issue brought up on 7th Nov 2005] But there is no such option of power management in 'make menuconfig'. Therefore, look for the registers used to control peripherals becomes an essential task to do. [Task created on 8th Nov 2005]

========== 7th Nov 2005 ==========


Two major issues to think about:

1. How much time would the computation take? How do we overcome the inaccuracy introduced by this computation delay?

2. What's the power-up and shut-down latencies for each I/O device we are going to use?

Discussion –

We can consider and convert these two overheads into a task's execution time, the system would work as long as the utilization is less than 1.

[TODO] – Case 1: [done]

1. Write down all the registers that have anything to do with peripherals controlling and find out where are they set in source.

Logs –

CPU related (registers should be configured in the following order):

  • MPLLCON[19..12], MDIV
  • MPLLCON[9..4], PDIV
  • MPLLCON[1..0], SDIV
  • ----------------------------------------
  • CLKDIVN[1], HDIVN
  • CLKDIVN[0], PDIVN
  • ----------------------------------------
  • CLKCON[3], POWER-OFF
  • ----------------------------------------
  • CLKSLOW[5], MPLL_OFF
  • CLKSLOW[4], SLOW_BIT
  • CLKSLOW[2..0], SLOW_VAL
  • ----------------------------------------
  • LOCKTIME[11..0], M_LTIME

LCD related:

  • CLKCON[5], LCDC
  • ----------------------------------------
  • LCDCON1[0], ENVID
  • ----------------------------------------
  • LCDCON5[3], PWREN

USB related:

  • LOCKTIME[23..12], U_LTIME
  • ----------------------------------------
  • UPLLCON[19..12], MDIV
  • UPLLCON[9..4], PDIV
  • UPLLCON[1..0], SDIV
  • ----------------------------------------
  • CLKCON[7], USB device
  • CLKCON[6], USB host
  • CLKSLOW[7], UCLK_ON
  • ----------------------------------------
  • PWR_REG[0], SUSPEND_EN

[TODO] – Case 2: [in progress]

1. Manage power dissipation by controlling the registers listed in case 1.

Logs –

MPLLCON and CLKDIVN can be updated with ChangeMPllValue() and ChangeClockDivider() respectively, need to find in which file these functions are exported. As a result, both of these functions are not exported at all. Thus I create an additional header file namely custom-fcn.h in linux/include/linux to export these functions and any others might become handy in later development. For rest of the registers listed case1, they are not modified or even referenced in Linux source code. I presume can either use them freely.

Creating [TODO] – Case 3.

[TODO] – Case 3: [done]

1. Try to open LCD device in init_module_drv_lcdtxt().

Logs –

The LCD controller on Creator board is HD66750; its data sheet can be found at http://gaw.ru/pdf/lcd/Chips/Hitachi/hd66750.pdf

I am using this monochrome on-board LCD to exercise manipulating Linux drivers for now, I will eventually switch to the 2.8” colored LCD.

LCD has been initialized in init_module_drv_lcdtxt(), I only need to write some characters with LCD_putchar(). Now I can test whether we need to reinitialize LCD hardware under the following circumstances:

  1. Stop feeding clock to LCD, and resume clock feeding later some time.
  2. Cut of LCD power, and continue supplying power to LCD after a period of time.

I am going to take advantage of the Fixed-Mapped linear address to prevent using additional global variables to monitor whether the LCD is powered on for the first time.

Creating [TODO] – Case 5.

[TODO] – Case 4: [on hold]

1. Purchase 74LS125 chip and test it with the 4V signal generate from GPIO along with DC power supply.

Logs –

On hold...

========== 14th Nov 2005 ==========


[TODO] – Case 5:

1. Initialize LCD hardware in init_module_drv_lcdtxt() for the first execution of insmod, and stop clock feeding and cut off power supply in cleanup_module_drv_lcdtxt(). Observe the change of hardware status closely.

Logs –

To distinguish the first execution of “insmod”, kernel must keeps a counter in global space in keeping track of the behaves of insmod. Hence, there are two things need to be done before I can keep working on this TODO case:

  1. Setup NFS so I can grant s3c2410 development board the access to lcd module without flashing Flash memory whenever I modify the module.
  • Solution

1. Do “dpkg-reconfigure portmap” and enable RPC from other computers or make sure /etc/default/portmap is empty.

2. Put the path of sharing folder into /etc/exports, and append the client's IP and access right.

3. Make sure the client has NFS suport compiled into kernel.

4. Enter the following command into client's console:

1. portmap&

2. mount 192.168.1.10:/usr/src/creator/nfs /mnt

  1. Figure out how to share variables and even functions between kernel and drivers.
  • Findings

1. Use EXPORT_SYMBOL(), but this approach will lead to a unstructured and mess coding style once we are controlling large amount of peripheral. (The major reason for not using this approach is that it doesn't seem to work.)

2. Use system call to get and set variables even data structures kept by kernel. Because the syscalls must be compiled into the core kernel image inall configurations, I will put it in kernel/ksyms.c.

3. You can also export a variable by using:

EXPORT_SYMBOL(variable_name); or

EXPORT_SYMBOL_NOVERS(variable_name);

in the file where it is defined (or anywhere this variable is accessible). Besides, you need to use -DEXPORT_SYMTAB flag for the file where you use EXPORT_SYMBOL macro. All this is inside kernel.

Then you can just declare the variable in your module code and use it.

It should be visible there.

Simply doing “insmod” and “rmmod” doesn't make any change in power dissipation. I then tried to stop feeding clock oscillator to monochrome LCD and see how it goes, it turns out ?! I lowered the operating clock frequency to 32-divided clock and let the LCD to have small amount of fixed current in the operational amplifier, and all these save about 0.2mA of total power consumption as a result.

Now I need to create a new module to control cpu operational voltage and see how much current save each combination can achieve.

Creating [TODO] – Case 6.


[TODO] – Case 6:

  1. Create a new module to change ARM's working voltage.

Logs –

Modify linux/driver/char/Config.in to insert a new entry for our cpu voltage modifying module (creator-s3c2410-cpu.o). I have successfully changed ARM's working frequency and confirmed the frequency is changed according to the value I set in the module by observing the signal on oscilliscope, but the system also turned into chaos (reboot the system is inevitable); need to work on this. Modifying either MPLLCON or CLKSLOW lead to an unstable system (hangs). [insert on 22th Nov 2005] The system is still fully functional after change in frequency takes place (observing the scope), the only problem is that UART's baud rate is changed due to changing MPLLCON also changes all the peripherals' working frequency. This leads to a conclusion that we must reset all peripherals' working frequency upon each change in MPLLCON. I add and insert the following files to the Linux source tree:

  1. /driver/char/creator-s3c2410-cpu.c
  2. 274:/driver/char/Makefile
  3. 355:/driver/char/.depend

========== 21h Nov 2005 ==========

[TODO] – Case 7:

  1. Having RTAI lecture.

Logs –

I am in a very serious trouble now... that's RTAI's patch only supports arm—pxa255, s3c2410 is not in the support list. I can control ARM's working frequency in runtime via inserting and removing kernel modules on both pxa255 and s3c2410, the only compensation is the trade off between ease of taking power/current measurement and integrating a real time scheduler into Linux. RTAI is a ready solution on pxa255, however, I must come up with a power/current measurement scheme for pxa255. On the other hand, on Microtimes's s3c2410 I can take measurements from the reserved jumpers. In addition, I have no chance to discuss the multicore issues if pxa255 becomes my implementation platform.

[TODO] – Case 8:

  1. Try out gprof for profiling the amount of time spent on each code segment.

Logs –

I can wrap up the I/O accesses with a function, so gprof can profile the amount of time spent on both CPU and IO bound operations. Take a look at the example in ~/research/ext3/timing_profil.

========== 28h Nov 2005 ==========


[TODO] – Case 9:

  1. Try out the power management and control on Xscale.

Logs –

Xscale supports the following peripherals:

  • LCD – enable/disable, mono/colored
  • SSP (Synchronized serial port) – enable/disable
  • I2C – bus, must always be on... ?!
  • UART – same as SSP ?
  • IR (Fast Infrared) – enable/disable, full/half-duplex
  • USB – support self-powered devices only
  • AC97 codec – low power mode or power off
  • I2S – direct access to memory
  • MMC (Multimedia card controller) – start/stop clock
  • NSSP (Network SSP) – enable/disable, start/stop clock

[Thought – 1]:

Implement COLORS will hopefully prove that the system is able to save same amount or even more energy without going through the cumbersome power profiling process, such a process is most likely target dependent (you have to know how much energy each instruction/function consumes) while COLORS itself is a universal solution to the problem.

[Thought – 2]:

The implementation I am doing will not compromise quality for reducing a system's power consumption. This makes my work different from any of the existing ones.

[TODO] – Case 10:

  1. Get RTAI running on PCM7230

Logs –

Contact Mike , Microtime, and Advantech for the Linux patch for ARM (PXA255 and ARM920T). Yet haven't received response from Mike and Microtime; Advantech supports PCM7230 only with Linux-2.4.19 without RTAI at the moment.

[Nov 30, 2005]

Mike sent both patch files to me today, and I use the cross-compiler available at <http://www.gtlib.gatech.edu/pub/handhelds.org/projects/toolchain/> to build kernel-2.6.7 with RTAI patch for pxa255 and encountered the 'static declaration of blah follows non-static declaration' error. Here is the solution found in RTAI mailing-list:

From h.mayer@inode.at Wed Jul 13 17:51:14 2005

From: h.mayer@inode.at (Hannes Mayer)

Date: Wed, 13 Jul 2005 18:51:14 +0200

Subject: Fedora Core 4 compile problems (maybe a gcc 4.0.0 thing)

Message-ID: <42d54682.6030003@inode.at>

Ignacio García Pérez wrote:

> Hi,

>

> Today I switched from FC3 to FC4 and found a nasty compile problem in

> RTAI-3.2. Got the bleeding edge magma source from cvs and tried, to no

> avail.

>

> /home/iggarpe/newroot/temp/magma/base/ipc/netrpc/netrpc.c:981: error:

> static declaration of ‘errno’ follows non-static declaration

> include/linux/unistd.h:4: error: previous declaration of ‘errno’ was here

>

I tried compiling 3.2 with GCC4.0 a while ago. Basically there are just a few

minor problems - I've written down some notes (no guarantee for completeness):

kernel:

******

base/config/kconfig/mconf.c:91

static struct menu *current_menu; -> struct menu *current_menu;

base/ipc/netrpc/netrpc.c:981

static int errno; -> int errno;

base/sched/sched.c:53

static int errno; -> int errno;

RTAI:

*****

# grep -R TASK_ZOMBIE *

base/sched/sched.c: lnxtsk->state = TASK_ZOMBIE;

change TASK_ZOMBIE to EXIT_ZOMBIE

Please let us know if that's everything and if it worked.

Best regards,

Hannes.

In short, simply remove the keyword, static.

Another error is “cc1: error: invalid option 'short-load-bytes'”

From: Wouter van Heyst

· To: crossgcc at sources dot redhat dot com

· Date: Mon, 17 May 2004 10:51:13 +0200

· Subject: Re: How to enable "short-load-bytes" feature of the arm-linux-gcc 3.4

· References: <003001c43bab$836cf9a0$27050a0a@jadechip.net> <40A80B58.4080500@kegel.com> <00eb01c43bb3$aef62c10$27050a0a@jadechip.net>

[3] [4] On Mon, May 17, 2004 at 10:07:11AM +0800, Pwu wrote:

> Oh, The original arm-linux-gcc's version is 2.95.3 which I get from the arm-linux.org.

>

> Thank you for your information. So should I change the kernel compile option from "-mshort-load-bytes" to "-malignment-traps"?

Yes.

Wouter van Heyst

Vidicode Datacommunicatie BV

Then the following problem:

========== My console output ==========

cyu021@debian:/usr/src/linux-2.6.7-bk6-karo-rtai$ make ARCH=arm CROSS_COMPILE=arm-linux- bzImage

make[1]: `arch/arm/kernel/asm-offsets.s' is up to date.

make[1]: `include/asm-arm/mach-types.h' is up to date.

CHK include/linux/compile.h

CC kernel/adeos.o

kernel/adeos.c:565: error: invalid lvalue in unary `&'

kernel/adeos.c:565: error: initializer element is not constant

kernel/adeos.c:565: error: (near initialization for `__ksymtab_1.value')

kernel/adeos.c:565: error: __ksymtab_1 causes a section type conflict

make[1]: *** [kernel/adeos.o] Error 1

make: *** [kernel] Error 2

========== My console output ==========

Line 565 in kernel/adeos.c looks like this:
EXPORT_SYMBOL(adp_pipelined);

and in include/asm-arm/adeos.h we have
#ifdef CONFIG_ADEOS_MODULE
extern int adp_pipelined;
#else /* !CONFIG_ADEOS_MODULE */
#define adp_pipelined 1 /* Testing this should be optimized out. */
#endif /* CONFIG_ADEOS_MODULE */

Looks like you have configured Adeos directly into the kernel (instead
as a module) but it seem that this is not supported by the pxa port (it
was not done by myself, so I don't know a lot about it).
So either change kernel/adeos.c to look like

#ifdef CONFIG_ADEOS_MODULE
EXPORT_SYMBOL(adp_pipelined);
#endif

(no guarantee that this will not break other stuff, you have to try) or
re-configure your kernel so that CONFIG_ADEOS_MODULE is set
(recommended).


Another problem:

I download the fresh zImage to PCM7230's memory and run _bootmem_, the booting sequence stuck at _Umcompressing linux kernel....._.

May take some time to fine tune the menuconfig and see if the combination works.

========== 5h Dec 2005 ==========

[TODO] – Case 10: (Continued)

Logs –

[7th Dec 2005]

Traced into function _ulg decompress_kernel()_ and found _puts("Uncompressing Linux......");_, the system seems to hang right after the code returns from gunzip() and before _puts(" done, booting the kernel.\n");_. I still haven't figured out the cause of this disaster...

The memory map between karo and pcm7230 might be different, check this out with Advantech's engineer. Try to look into any code difference with Kdiff3 before hear anything from Advantech.

[8th Dec 2005]

The defined labels specifically for Karo board in kernel-2.6.7-bk6-karo-rtai and other interesting defines are:

CONFIG_ARCH_KARO

CONFIG_KARO_AUTOCNF

CONFIG_KARO_PWR_CHG

CONFIG_KARO_DS2430

CONFIG_KARO_DS2430_EXT

CONFIG_KARO_LCD

CONFIG_KARO_LCD_640_480

CONFIG_KARO_SMC32

CONFIG_CPU_ABRT_EV5T

CONFIG_CPU_TLB_V4WBI

CONFIG_CPU_MINICACHE

CONFIG_CMDLINE="init=/linuxrc root=1f01 rootfstype=jffs2 ro console=/dev/ttyS0,115200"

CONFIG_MTD_KAR

CONFIG_BLK_DEV_RAM_SIZE=8192

CONFIG_ADEOS

CONFIG_ADEOS_CORE

CONFIG_ADEOS_THREADS


Some interesting defined labels found in Advantech 2.4.19's .config file:

CONFIG_ARCH_PXA_CERF

CONFIG_PXA_CERF

CONFIG_PXA_CERF_BOARD

CONFIG_PXA_CERF_RAM_64MB

CONFIG_PXA_CERF_FLASH_32MB

CONFIG_PXA_USB

CONFIG_PXA_USB_NETLINK

CONFIG_CMDLINE="root=/dev/ram0"

CONFIG_MTD_PXA_CERF

CONFIG_BLK_DEV_RAM_SIZE=16384

該試試看用研華的2.4.19+kilauea patch (patch-2.4.19-rmk-pxa-arm-rtha15) ?

Not working either, the patch doesn't match to Advantech's src.

對照.config & arch/arm/boot/compressed/head.S看看開機哪裡出了錯!

... on hold!

========== 12h Dec 2005 ==========

[TODO] – Case 11:

  1. Measure PreSOC board's power consumption at CPU full speed + all I/O on, CPU half speed + LCD at low state, CPU half speed + LCD & USB at low state.

Logs –

Can't measure any meaningful current readings.

FULL SPEED:

Period: 10ms (time period between two consecutive do_timer())

Change to SLOW MODE:

[SLOW_VAL: 000] Period: 113ms ~ 169ms

[SLOW_VAL: 001] Period: 226ms ~ 339ms

[SLOW_VAL: 010] Period: 452ms ~ 678ms

[SLOW_VAL: 011] Period: 1015ms ~ 1030ms

[SLOW_VAL: 100] Period: 1260ms ~ 1350ms

[SLOW_VAL: 101] Period: 1690ms ~ 1700ms

[SLOW_VAL: 110] Period: 2030ms ~ 2260ms

[SLOW_VAL: 111] Period: ~ 2370ms

[TODO] – Case 12:

  1. Find a way to measure the total power consumption.
  2. Make sure ARM920T can do DVS.
  3. Take current measurement on each DVS level.
  4. Find all DPM-able I/O devices.


Logs –

  1. Yet cannot be done.
  1. All operating mode and frequency give same current consumption
  2. same as (2)
  3. LCDs and USB have power management register, ARM920T disables other devices by stop feeding them clock signal.

========== 19h Dec 2005 ==========

[TODO] – Case 13:

打電話問中山大學在用Creator的同學(陳良弼,林麒弘,黃文凱)問問題 (07-525-4337)

  1. CPU的電流消耗量為什麼不會因改變速度/執行模式而改變?
  2. CPU只消耗1.4 mA左右的電流正常嗎?
  3. 確認Creator板子上能開關(或是已經成功開關)I/O device

Logs –

中山大學的人並沒有調整過ARM的工作頻率。

PreSOC上的量測點(TP1 & TP2)是給ARM7用的,新華已經幫我們在S3C2410上面新增了量測ARM9內部電流的量測點。用新的板子所量到的數據為:

Normal mode全速:140mA

Normal mode半速:77mA

Slow mode 全速:12mA

[TODO] – Case 14:

量測PreSOC上能量到的電流。

Logs –

file system燒入flash後無法開機,產生下列錯誤訊息:

RAMDISK: Couldn't find valid RAM disk image starting at 0.

目前是將vmlinux & file system在執行前先downloadmemory中,這樣可以正常讓Linux運作,問題交由新華處理中。

進行以下測量:

  1. ARM的核心頻率由56MHz調升至202MHz,測量總電流
  2. ARM的核心頻率由56MHz調升至202MHz,測量CPU電流

[TODO] – Case 15:

測量/估計device wakeup/shutdown latency

Logs –

尋找測量/估計的方法。

TFT-LCD:

TFT-LCD(TD035STEB1)data sheet中得知該LCDVCC5導通之後需要約40ms~120msdelay螢幕才能顯示畫面。(詢問統寶, toppoly ,)

UART:

MAX3232data sheet中得知我們所使用的UARTpower up到可以傳輸資料的時間大約為210us~220us

USB:

不做USB

Camera:

詢問宜霖, ElecVision,中。

Ethernet (CS8900A-CQ3):

尋找從standby/suspend modes切回normal mode的時間。

CS8900Asuspend/standby mode回復到mornal mode的時候會自行resetconfigure,與calibrate。通常需要10ms完成reset calibration

[TODO] – Case 16:

Trace新華提供的CCD & TFT-LCD demo code並且找出如何initialize CCD & TFT-LCD以及如何擷取/寫入資料。

並看看Linux driver是如何初始網路卡的。

看看將UART & USB斷電後事否需要重新初始。

Logs –

CCD initialization:

重點在GoCCM,直接呼叫CaptureImage_CCM()即可抓到當下鏡頭照到的畫面。再利用ColorInterpolate轉換資料格式並copypbyBmpBuffer中讓之後的程式可以將畫面outputLCD上。(關鍵部份被包在library, s3c2410_gnu_2953.a,)

TFT-LCD data feeding:

Lcd開頭的function都是給TFT-LCD使用的function,例如Lcd_Port_InitLcd_Init(),等等。主要是透過Lcd_Palette8Bit_Init()PutPixel()來初始LCD色盤及填色。(關鍵部份被包在library, s3c2410_gnu_2953.a,)

linux kernel驅動CS8900A-CQ3:

UART:

待測

Codec:

參考新華提供的linux demo,看他們如何使用codec driver in user application.

[TODO] – Case 17:

application

Logs –

大頭拍貼:需要用到CCD取景,TFT-LCD顯示,使用網路傳送照片,或是將照片儲存到USB flash drive --> 很多人排隊用1x/2x連拍。這樣整個過程將形成periodic job,在連拍的同時可以將TFT-LCDUSB,及網路卡關掉,或是切換到較不耗電模式。拍完之後在編輯相片(此時相片存在記憶體中)時只需要開啟TFT-LCD,而在傳送影像的時候只需要將USB或網路卡開啟。

櫃台人員:在人潮擁擠的時候收銀機/兌換代幣工作也會變成periodic job,掃描bar code,顯示金額,將資料回傳讓主機進行後續統計工作。

公路警察測速照相

警局犯人照相機

========== 26h Dec 2005 ==========

[TODO] – Case 18:

試著將新華提供的library, s3c2410_gnu_2953.a, include進自己寫的kernel module

Logs –

Trace Linux Makefile and see how linux uses lib.a in make modules.

Root Makefile (linux/Makefile) includes

- .config

- .depend

- arch/$(ARCH)/Makefile

- s3c2410_gnu_2953.a加入LIBS

- # Include CCM/CCD, TFT-LCD, and CODEC's function lib

- ifeq ($(CONFIG_CREATOR_S3C2410_CPU),y)

- LIBS := /usr/src/creator/examples/arm/lib/s3c2410_gnu_2953.a

- endif

- Rules.make

變更 include/linux/timex.h

- extern unsigned long volatile jiffies;

變更drivers/char/creator-s3c2410-cpu.c

- include

- include

變更 include/asm-arm/arch-creator-s3c2410/s3c2410.h

- #define IO_REG0

- #define CPLD_CTRL

注意 arch/arm/mach-creator-s3c2410/mm.c裡頭的map_desc

- 已經將VA_CREATOR_IO_BASE mapPA_CREATOR_IO_BASE了。

========== 2nd Jan 2006 ==========

[TODO] – Case 19:

Study COLORS並規劃如何將COLORS套到實際的應用上!

Logs –

Interrupt latency

Interrupt何時會發生

page fault 何時會發生 --> 無解

[TODO] – Case 20:

想辦法hack Linux,讓Linux可以達到我們需要的real-time需求。

我們需要:

  1. 使用Linux提供的drivers
  2. 一開機就執行我們設計的tasks,可以是userkernel process
  3. scheduler只會從我們所建立的task list中挑task來做,建立單純的periodic task environment
  4. 確保interrupt依照task的需要而被處理,並不是全部都處理
  5. 在執行task的時候不會產生page fault,以排除task exec time的不確定性

[QUESTION] – Case 1:

為什麼RED-Linux/kernel/timer.c#ifdef CONFIG_UTIME_TIMER_VECTORS#ifdef CONFIG_DSTREAM_KURT_PROFILE包住?

UTIME應該是獨立的個體,為什麼跟KURT有相依性?


2006 Feb-07

尋找設定interrupt controllercode

init_IRQ --> init_arch_irq (arch/arm/kernel/setup.cinit_arch_irq指向mdesc->init_irq)mdescmachine descriptor

mdesc則是在setup_architecture裏面指向__arch_info_beginmdesc structure裏面裝的質則是透過defineinclude/asm-arm/mach/arch.h中的MACHINE_START(_type,_name)寫入記憶體,MACHINE_STARTarch/arm/mach-s3c2410/arch.c中被執行到。

因此存在於mdesc中的3function pointer分別指向:

fixup --> fixup_s3c2410

map_io --> s3c2410_map_io

init_irq --> s3c2410_init_irq

所有的IRQs3c2410_init_irq中被disableds3c2410_init_irq也同時將mask/unmask function卦到irq_desc上。

s3c2410asm檔為armv版本,armo是給以前26-bit用的。

start_kernel開始一直到time_init的時候,所有的interrupt除了timer4以外都是disabled

console_init裡面只有con_init & uart_console_init會執行到。

在執行rest_init --> cpu_idle --> schedule之前,除了timer4以外的interrupt都為masked但是一旦執行完schedule,進入console之後又多了幾個interruptenabled,所以要深入schedule除了schedule tasks之外還額外做了什麼事情。

因為在rest_init呼叫cpu_idle(最後呼叫schedule結束start_kernel)之前process “init”已經先被create出來,所以一旦進入cpu_idle並呼叫schedule之後start_kernel會在執行完init(位於init/main.c --> static int init(void * unused),用cscope找的話是第57entry)之後結束(對使用者來說是進入console畫面)

init最後會呼叫execve --> sys_execve --> do_execve多次後才進入console

s3c2410_timer_interrupt中插入printkjiffies值列印在console上確認timer正常運作。

現在要搞清楚CLONE_xxx flags的意思,此外可能需要更改cpu_idle & schedule這兩個functions,才能讓電腦在兩個我們做出來的kernel threads之間切換。

在執行execve("/sbin/init",argv_init,envp_init);前插入下列的code來關閉除了timer4以外的interrupts

rINTMSK = 0xffffbfff;

rINTSUBMSK = 0x7ff;

rSRCPND = 0xffffffff;

rINTPND = 0xffffffff;

rSUBSRCPND = 0x7ff;

rEINTPND = 0x00fffff0;

printk("\nOnly timer4 interrupt is enabled, INTMSK = %x\n", rINTMSK);

2006 Feb-14

create兩個kernel threadsperiodic_01 and periodic_02,這兩個kernel threads都是在init呼叫execv之前所創造的,而且都正常執行,兩個threads目前只是單純的列印出訊息到console上。

接著在periodic_01 & periodic_02中加入多個printk並在其中穿插yield & schedule,執行的結果看起來也是正確的,兩個threadsprintk相互出現。

於是我將在schedule中試著選擇除了periodic_01 & periodic_02以外的threads執行,在create threads的時候我將"eos”寫入這兩個threadscomm field,所以判斷標準就是comm field不等於"eos”thread就被選為下一個執行的thread但是在實際執行過程中從”c = -1000”"switch_to”之間next thread被改過了,造成threads的執行順序與我逾期的不一樣。

release_kernel_lock的時候會呼叫__sti,所以timer interrupt又再度被打開,造成在schedule中又會呼叫schedule,這個部份先不理。

主要影響下一個該哪個thread執行的因素是goodness所回傳的值,所以我開始研究要如何修改goodness。現在應該把重心放在init/main.c & kernel/sched.c身上,main.c要改的地方就是create kernel thread與標示出使用eos custom schedule機制的時機,sched.c則是時做schedule機制的地方。

createkernel threads 之後將新增的全域變數,custom_sched,設成"1”以供goodness區別。在goodness中,新create出的kernel threads會被壓到最後執行。壓到最後的意思是指系統中指剩下以下11threads

init/swapperksoftirqd_CPU0,我們創造出來的兩個kernel threads,以及其他kernel threads(目前還沒有確定他們的function name)

當系統剩下這四的threads的時候表示系統一經完成開機程序,這時候再開始執行我們創造出來的threads,同時也只執行我們創造出來的threads

至於是否要重新算每個threadcount/time slice則留到稍後再考慮。

對於創造threads的部份,或許在schedule裡面呼叫kernel_thread會比較合適,

因為我們可以利用jiffies搭配上kernel_thread營造出兩個periodic jobs,實際是則上jobs執行完之後隨及結束,等到時機到的時候schedule再自行創造新的job instance給系統執行。

目前觀察到的情況是,執行過的thread似乎並不會被task_struct list中拔除,所以task_struct list越長越長,並且影響到scheduler選擇job的時間。需要檢查task_struct list的內容。即可能需要在task_struct中新增新field,並且在function的最後將這個field設起來,讓scheduler能夠根據這個field將相對應的task_structlist中拔除,這時候在想辦法將這個記憶體區塊free掉。

目前觀察到的情況是,task有被create出來,執行完的task也會從task_struct list中被移除掉,只是現在是由ksoftirqd_CPU0在執行我所create出的kernel_task。要看看到底ksoftirqd_CPU0在搞什麼鬼。

2006 Feb-22

或許將create threadschedule移到s3c2410_timer_interruptdo_timer裡面去做可以解決問題?--> Can't do, 不能在interrupt contextschedule

ksoftirqd_CPU0也是透過kernel_thread做出來的。。。,flag用的跟create init時的flag一模一樣。

光是呼叫do_exit並沒有辦法達到移除threadtask_struct

還要搭配lock_kernel, unlock_kernal, complete_and_exit(包在thread執行code), kill_proc, wait_for_completion, release_task(包在thread removal function)

因此整個架構上必須要有所調整,效法device driver(usb driver為參考對象drivers/usb.c)提供兩個daemons(D1, D2)do_timer/s3c2410_timer_interrupt中執行,D1負責注意何時需要createthreadD2負責移除執行過的thread。因為在interrupt context中無法schedule,所以我還必須要研究do_timer是在什麼時間點跳出interrupt context,在那個當下呼叫schedule


成功的將kernel thread移除,建立thread的步驟請參考usb hub driver (drivers/usb/hub.c),移除的話除了參考usb hub driver之外還要記得呼叫release_task()eg.

|| 870 eosid[0] = kernel_thread(eos_1, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGNAL);

1390 void eos_1 (void)

- 1391 {

| 1392 lock_kernel();

| 1393 printk("\nThis is eos_1: %s[%d].\n", current->comm, current->pid);

| 1394 for_each_task(tsk)

|- 1395 {

|| 1396 printk("%s[%d] ", tsk->comm, tsk->pid);

|| 1397 }

| 1398 eosrm[0] = 1;

| 1399 unlock_kernel();

| 1400 complete_and_exit(&eos1_exited, 0);

| 1401 }

1404 void del_task (void)

- 1405 {

| 1406 kill_proc(eosid[0], SIGTERM, 1);

| 1407 wait_for_completion(&eos1_exited);

| 1408 eosp = find_task_by_pid(eosid[0]);

| 1409 printk("\nRemoving: %s[%d]\n", eosp->comm, eosp->pid);

| 1410 release_task(eosp);

| 1411 }

要先把release_taskstatic宣告拿掉,然後在使用release_task的檔案中將宣告貼在檔案開頭。

2006-Mar-01

能夠建立periodic job之後把job依照priority放在active list裡面讓schedulerpriority最高的task挑出來做。目前需要看的部份有:把job插入active list的部份,scheduler_tick() function

Linux-2.4.18沒有active list。。。

struct completion是改進版的spin lock,拿來防止processmultiprocessors的系統中被異常中止(Understanding the Linux Kernel, 2nd edition, pg179)kernel thread中呼叫complete_and_exit()enablespin lock中的done變數,以便系統在移除kernel thread時呼叫wait_for_completion()時分辨該kernel thread是否已經執行過/或執行結束以便將該kernel thread移除。

為了讓我們建立的task成為real-time task,我們必須設定該process descriptorrt_priority欄位(值的範圍1~99,值越大real-time taskpriority越高)。同時可以把taskpolicy設成SCHED_FIFO,之後再加入計算SCHED_FIFO task優先權的code

重新出發~

periodic jobs最後面加上yield(),然後等時間到的時候再呼叫wake_up()job喚醒,但是應該需要修改wake_up()裡面的程式,才能讓scheduler根據我們的需求挑選job

似乎還有另外一個更快的方法。。。呼叫sleep_on_timeout()!!!

DECLARE_WAITQUEUE(wait, current);

sleep_on_timeout(&wait, ticks);

2006-Mar-08

似乎kernel_thread()運做的時候需要一些緩衝時間,如果連續呼叫兩次kernel_thread()的話(或是間隔太近),後createthread會有問題,比如說task struct裡面的資訊是錯誤的垃圾。

因此我藉由printk將資訊顯示在console上來拉長kernel_thread()之間的間隔。

例如:

|| 856 printk("\neos_thread:%d\n", eos_thread(eos_1, "eos_1", 1000));

|| 857 printk("\neos_thread:%d\n", eos_thread(eos_2, "eos_2", 2000));

eos_thread()的程式則如下:

876 int eos_thread(int (*fn)(void *), char *comm, int ms)

- 877 {

| 878 struct task_struct *tsk;

| 879 int tpid;

| 880

| 881 tpid = kernel_thread(fn, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGNAL);

| 882 tsk = find_task_by_pid(tpid);

| 883 strcpy(tsk->comm, comm);

| 884 tsk->period = ms_to_jiffies(ms);

| 885 tsk->deadline = jiffies + tsk->period;

| 886 printk("\nNew job created: %s[%d], period:%d, deadline:%d\n",

| 887 tsk->comm, tsk->pid, tsk->period, tsk->deadline);

| 888 return (tpid);

| 889 }

scheduler改成priority driven,檢查目前要switch過去的task是否為priority最高的task,如果不是的話就將next指定為priority最高的task

kernel中似乎不能用太高級的語法。

以下的會掛掉:

||| 642 //eos_finished = (tsk->period > 0) ? (eos_finished + tsk->finished):(eos_finished);

以下的OK

||| 643 if (tsk->period > nr_eos)

23- 644 {

234 645 eos_finished = eos_finished + tsk->finished;

234 646 }

完成處理RT/EOS jobsRM scheduler

S3C2410 from Microtimelittle-endian,或許要更換cross compiler

問題出在自己沒有把kernel_thread trace清楚,kernel_thread呼叫sys_clone再間接呼叫到do_fork,而do_fork是有機會呼叫到schedule的,因此我們必須在thread的開頭再初始period & deadline,初始完之後進入while(1)迴圈即可正確運作。

因為不明原因,進入while(1)之前要先將interrupt在開啟一次,這樣在呼叫mdelay()的時候jiffies才會正常更新。

2006-Apr-26

device structure加入owner_head[]*owner,用來monitor device被哪些jobs使用,目前先設定每個device最多只能有16owner

task_struct中加入in_mode,從這個field可以得知該task當時是在使用CPU還是IO

Static slack time計算方法à從最耗電的device中開始找local wait <>task,將該tasklocal wait調到與wakeup time一樣長,增加local wait的同時也將wcet & bcet做等量增加,之後再用新的wcet下去算cpu utilization,如果util超過bound,則不做變更。

如果在能夠延長local wait而且在該時間點之後還有IO access則將增加出來的部分也加到之後IO access listlocal wait當中。Update完該taskdevice request list之後如果cpu util繼續小於cpu util bound,則從最耗電的device中找下一個owner繼續相同的動作,以此類推直到cpu util超過cpu util bound或是每個device的每個owner都看過一遍。

job開始,進入與離開IO mode的時候要去查某個table(正在研究要用什麼形式儲存cpu降速資訊)以調變cpu的工作頻率。

新增check_cpu_speed() & static_dvs(),記得把code寫好,static_dvs()優先。

static_dvs(),分配slack time的時候從最耗電的device使用者中找出priority最高的job開始分配,藉此增加耗電裝置關閉的時間。等到run-time時再改成尋找下一個要使用到該裝置的job來進行dvs。因為這時候jobs根本都還沒有初始好,因此我們可以當作現在的時間是0,並且用給定的時間(每個device list中的required_by)下去運算。

2006-May-03

在調變ARM core speed的時候除了調整MPLL register之外還需要更改PWM timercounter值才能夠繼續讓timer interrupt10ms觸發一次。

2006-May-04

Linux開機時會呼叫pwm_timer_update()設定pwm counter4 buffer,讓do_timer10ms執行一次,設定counter buffer的公式為:

RESCHED_PERIOD * PCLK / ((SYS_TIMER234_PRESCALAR + 1) * SYS_TIMER4_DIVIDER * 1000)

RESCHED_PERIOD = 10

HCLK = FCLK / 2

FCLK = 202800000

SYS_TIMER_234_PRESCALAR = 202

SYS_TIMER4_DIVIDER = 4

程式碼為:

void pwm_timer_update(void)

{

rTCFG0 = (rTCFG0& ~(0xff<<8))|(sys_timer234_prescaler<<8);

rTCFG1 = (rTCFG1& ~(0xf<<16))|(sys_timer4_mux>

NowTCNTB4 = (RESCHED_PERIOD*PCLK)/

((SYS_TIMER234_PRESCALER +1)*(SYS_TIMER4_DIVIDER)*1000);

rTCNTB4 = NowTCNTB4;

rTCON = (rTCON& ~(7<<20))|(6<<20);

/* interval mode(auto reload), update TCNTB4, stop */

rTCON = (rTCON& ~(7<<20))|(5<<20);

/* interval mode, no operation, start for Timer 4 */

}

由上述公式與程式碼可知若想改變cpu speed並且保持timer interrupt10ms觸發一次,除了改變MPLLCON設定之外,還需要更新TCNTB4

因此需要建立change_cpu_speed() function同時設定MPLLCON & TCNTB4

在init/main.c中新增全域變數 rFCLK, rHCLK, rPCLK。

在task_struct中也需要新增field紀錄何時該切換cpu speed。

2006-May-05

在eos_arg中多加一個變數init_cpu_spd,用這個變數紀錄static_dvs()算出來的cpu speed,當task的第一個cpu interval用這個speed執行時,能夠使該task所需的devices在task開始的instant才啟動。因為dynamic_dvs() 並不會事先將速度算出來,因此不需要在task structure中預留位置存放這些資訊。

在job_sim()中執行eos_delay()之前(cpu interval的部分) ,如果nth_cpu_job為0,又init_cpu_spd不為0,則將cpu speed調整至init_cpu_spd。

進入使用device的狀態時呼叫change_cpu_speed()將速度調到最高速,減少device的耗電時間,而離開io mode的時候馬上呼叫dynamic_dvs()視情況決定是否要調降cpu speed以增加關閉device的機會。

change_cpu_speed(spd)
{
lookup MPLLCON's value;
calculate new PWM timer4's counter value;
set MPLLCON with new value;
set TCNTB4 with new value;
}


dynamic_dvs()

{

???

}