2007/03/30

PSIP_section structure


Syntax Bits Format
PSIP_section() {
table_id 8 uimsbf
section_syntax_indicator 1 '1'
private_indicator 1 '1'
reserved 2 '11'
section_length 12 uimsbf
table_id_extension 16 uimsbf
reserved 2 '11'
version_number 5 uimsbf
current_next_indicator 1 bslbf
section_number 8 uimsbf
last_section_number 8 uimsbf
protocol_version 8 uimsbf
PSIP_table_data() *
CRC_32 32 rpchof
}

ATSC abbreviate



ATSC 常用字縮寫表
ATSC Advanced Television Systems Committee
bslbf bit serial, leftmost bit first
BMP basic multilingual plane
CAT Conditional Access Table
CRC cyclic redundancy check
CTCT cable virtual channel table
DCC directed channel change
DCCRR DCC capable DTV reference receiver
DCCSCT DCC selection code table
DET data event table
DTV digital television
EPG electronic program guide
EIT event information table
EMM entitlement management message
ETM extended text message
ETT extended text table
PGS global positioning system
PSIP program and system information protocol
MGT master guide table
MPAA motion picture association of america
MPEG moving picture experts group
NVOD near video on demand
OOB out of band
PAT program association table
PCR program clock reference
PES packetized elementary stream
PID packet identifier
PMT program map table - the collection of all the TS_program_map_section()s
PTC physical transmission channel
SCTE society of cable telecommunications engineers
SI system information
STD system target decoder
STT system time table
rpchof remainder polynomial coefficients, highest order first
RRT rating region table
TVCT terrestrial virtual channel table
UTC coordinated universal time
uimsbf unsigned integer, most significant bit first
VCT virtual channel table. used in reference to either TVCT or CVCT

The testing report for the GUI of TI TVP9007 EVB

The testing report for the GUI of TI TVP9007 EVB

  • serious
    1. There is an unused menu item, "Download RRT" should be removed.
    2. The "Time Zone" just only 4 area, P, M, C, E. There are 7 time zone for America, so suggest that we should complete the all Time Zone. Maybe the the four Time Zone P, M, C, E for north america is sufficient.
    3. The menu display exist a bug when return to main menu from v-chip submenu. The v-chip focus menu button overley with unfocus menu button. The other three menu items do not exist such a bug. (當從 v-chip 子選單返回主選單時,會因為要顯示 v-chip 在「focus」狀態造成跟 v-chip 的 unfocus 狀態的選單圖樣重疊)
    4. There is a bug exist in timeout to disappear the menu. When the menu operation stop at entering the password for v-chip submenu and wait it timeout, the menu disappear. Press "Menu" again, will cannot keyin the correct password. It need let it fail and keyin again. (當停在輸入密碼以便進入 v-chip 選單時,若輸入不完全,例如只輸入三碼,等到 timeout 會造成選單消失,若再按 Menu 再按 v-chip 輸入密碼時,無法有效輸入密碼,會顯示密碼無效,必須重新輸入正確密碼才行). This bug may be come from timeout policy, system will remember the menu status but not clean it for the smart menu operation. This bug may cause the system crashed.

  • Suggestion
    1. The menu operating experience is not consistent, such as when press "left" in submenu will equal to exit but not in main menu.
    2. There is no any icon in menu item.
    3. Transparency mode just "On" and "Off" status.
    4. The layout of menu button is not cosy for the vision.

2007/03/27

專利 The patent and the cost

這邊不是要談專利有多重要。而是一個感嘆。一個產品,專利可能就占成本的一半。這邊講的成本,又專指硬體成本,至於軟體部份,通常被忽略不計。可憐的 programmer.

到底軟體能有什麼專利?尤其在 open source 架構下能有什麼賣點?一直在用 open source 的我其實對專利沒什麼好感,但是看來似乎需要好好思索一下。目前,知道跟專利最有關的,當然很多,但是最明顯的,就屬 GUI 本身了。唉,難。難的是要去搞清專利才能設計的話,可以說是不用搞設計了。

語系 locale

綜合最近....當然是很久以來被問到跟語系有關的問題,這邊稍微整理一下。因為網路上有其他更好的文章,我只是整理一下而已。

首先,要看中文一定要有能力顯示中文的 terminal, 例如 gnome-terminal, 早期比較受歡迎的是 crxvt 或者是修改過的 rxvt。 這一點恐怕有些人會以為怎麼會這麼麻煩,一般的 console mode 是看不到中文的,不過這問題並非 linux 才有的,早期的倚天中文就是為了解決這問題的。現在的 linux 下有很多,可以參考 中文 HOWTO一文。

除剛前說的顯示中文的 terminal 外,還要有字型,不同的環境所需要的不一樣,若是採 TrueType 字型,當然要有相應的字型與字型管理程式。而 console 的點陣字型也是必備的。這我就不多說。一般的字型管理程式是 fontconfig, 還有其他的,也請見正式文章。若您採用 fontconfig, 那命令就應該是 fc-list 可以查到現有的字型列表,而 fc-cache 則會重新掃瞄字型,這對你安裝新字型有用,而安裝字型可能要改的東西應該也都在 /etc/fonts 下可以追蹤到更多。

除了這三項,通常還跟「設定有關」。這所謂的設定有很多面向要兼顧,首先,字型管理程式的設定, shell env 的設定,X 的設定等等。有些也跟像 gtk, QT 等的設定有關,例如可能要找 /etc/gtk-2.0 下的設定檔。總之,得視情況而定。一般最常見的設定就是 locale這個命令所見的那幾個。譬如底下命令可以將環境變數設定成 Big5:
export LANG=zh_TW.Big5 LANGUAGE=zh_TW.Big5 LC_ALL=zh_TW.Big5
另外 X 本身也有字型的設定問題,例如 FontPath, font server 等。應用程式本身也有相關設定,譬如 firefox 也需要相應設定。

上面說到這些環境變數,您可以將之放到 /etc/profile, /etc/X11/Xsession.d 等等,總之,若還是有問題,請確定以上三項是否都做到了。

2007/03/23

看不到即時畫面? the problem from cache and proxy

最近因為公司 proxy server 突然具備了實用,讓某些網頁看不到更新的時即畫面,這問題我知道,因此很容易解決,若您以瀏覽器當 UI 或者也會遇到畫面是舊的狀況,可以試試將 url 最後加上 ?, 原理上是 proxy server 會認為以 ? 結尾的網頁是「臨時」的,不會將之存檔。若有的 proxy server 也將這個存檔,那沒關係,只需要在 ? 之後加上不同的亂數或者無意義的字串,只要每次都不一樣也就可以達到效果,原因是每次的 url 都不一樣,這樣就可以每次都抓到新的頁面。

也許您會懷疑,加上問號,甚至加上東西,這樣還能抓到你要的頁面嗎?這問題其實您試試就知道了。這解法其實有時 cache 來自瀏覽器本身,有時設定不暫存也會發生看不到即時頁面,此時用這辦法一樣也能解決。

現在把 url 舉個例:
http://xxxx.xx.xx/?
http://xx.xx.xx.xx/?123
http://xx.xx.xx.xx/?311123459388373737

2007/03/22

The stability of embedded system: 嵌入式系統可靠性發想

在做嵌入式系統時,總會遇到幾個問題,先列舉如下:
一、正常操作下系統是否穩定不當機?
二、正常操作下系統是否反應夠快速?
三、不當操作會不會導致系統不穩或不能執行,甚至造成不能開機?
四、是否允許不正常操作,例如快速連續按按鍵或者在隨時(尤其錄影時)切斷電源?
五、能不能 cost down?

其實問題大大小小很多,這邊要講的是系統更新問題。系統更新有時是必要的,尤其在研發當中,但是研發當中通常不會一起考慮穩定性,也就是更新失敗。像 PC/NB 主機板有做雙 BIOS, 我覺得嵌入式系統也應該做此考量,其中有一個永遠唯讀的部份,它起動後能做的不多,可以是做系統更新或/且做 debug/test就可以。這樣的部份可以不必載入所有硬體的驅動程式,也不必全功能。甚至可以不必有 console, 只需搭配像 reset 即可達到。但是它必須判斷當系統更新失敗時的處置。

至於主系統部份,也建議類似 unionfs 那樣,把主系統做成唯讀的,可以是像 cramfs 採壓縮的方式,而把需要寫入的部份寫入到另一塊區域。採用 unionfs 的好處是,它可以做到沒寫入前,只有唯讀部份,當要存檔才改為寫入可讀寫區。如此一來,當要系統還原的時候就很容易,而系統更新也可以只更新唯讀區。

綜合以上所述,大約如下分割系統:
- default boot area, 約需 1M
- read only area, 做主系統,大小視需要而定
- read-writable, 做設定存檔用,大小通常不大於 1M.

採用這塊 default boot area 會增加儲存空間的需求,但是能讓系統更穩定。而採用後面的架構,則讓系統預設值可以儲存,而且不必另行放在可讀寫區,也不必事先占用該區,算是可以縮小系統儲存空間。甚至降低系統更新的頻率與區域,繼而增加系統的可靠與穩定性。

2007/03/21

the important things for embedded system 嵌入式系統需要考慮的三件事

我在看Three Embedded Software Techniques時看到的,在做嵌入式系統時有三項技術可以拿來測量系統,因而知道系統效能,並且據以改進。
一、 interrupt latency: 知道它可以知道像「按了可樂鈕到可樂掉出來需要多久」。有些論文討論如何降低 latency time, 請自行查閱。
二、計算 cpu loading: 通常最主要的是計算 cpu 在做 task swap 時耗了多少工夫,文中也有討論一個技巧。
三、降低 program size 並改進程式效率: 這一點是最常見的。

在設計系統時至少該考量這三件事。

2007/03/20

Nucleus OS - Web server 篇

Nucleus 的 web server 特別之處大約如下,其餘就跟一般 web server 能做的差不多:
. 把 HTML 以 C 來編譯,嵌入檔案系統中,減少空間用量
. 需要一支 windows AP 來做上面的事

Necleus OS - shell help message

Necleus 的 shell 感覺比較像一個 AP, 提供的命令如下:
ts [name] - Display Task Status [task name]
ms [name] - Display Mailbox Status [mailbox name]
qs [name] - Display Queue Status [queue name]
ps [name] - Display Pipe Status [pipe name]
ss [name] - Display Semaphore Status [semaphore name]
es [name] - Display Display Event Status [event group name]
si [name] - Display Signal Status [task name]
ti [name] - Display Timer Status [timer name]
pm [name] - Display Partition Status [partition name]
dm [name] - Display Dynamic Memory Status [memory name]
m [a] - Display Memory [(H)address]
sm a - Set Memory a = (H)address
help - Display this menu again

光看上面的 help 就可以知道,這個 shell 沒什麼大用處, 不過暫時要 debug 恐怕也離不開吧。

if, switch 怎麼讓成績等級的判斷最快?

有人不想用 if 來判斷成績等級,以為用 switch 會比較快。哦,對了,先說說問題:

假設要寫一個算學生成績的程式:
100~91 : A
90 ~81 : B
80 ~71 : C
...
10 ~ 0 : J

首先,就編譯器的眼光來看,我猜用十個 if 來寫應該是非常快的了。當然,要改成 if elseif 來寫當然會更有效率一點。這邊是指類似:
if (G <= 100 &&amp; G >= 91) g = 'A';
...
else if (G<= 10 &&amp; G>=0) g = 'J';


改成:

if (G >= 91) g = 'A';
else if (G >= 81) g = 'B';
...
else if (G >= 11) g = 'I';
else g = 'J';


上面假設成績最高 100, 最低 0

然而若要照原來那個朋友要的,改成 switch 的話,基本上,是可以做到,但是即使經過轉換改成 switch, 以編譯器的眼光來看,switch 是較慢的,最佳化也是類似上面的寫法。

不過底下提供另一個寫法,不保證較快,但是需要點腦袋來思考:
g = 9 - (int)((G-1)/10) + 65;

g = 74 - (int)((G-1)/10);

一個整數除法與兩個減法。或許可以跟 if 比效率吧!

另外,還有一個寫法,若純粹想要讓人頭昏的話還不錯用:

g = (110-G)/10 | 0x40;

這個的演化來自於 74 - x == 64 + (10-x) == (10-x) | 0x40
最後的答案是把 10 搬到分子,整數除法跟浮點除法不一樣,整數除法要看成「一段範圍」的除法取整數,因此搬到分子的時候是 109 而非 100, 這一點留給看官花點時間想想。

LiveCD comparison: knoppix v.s. geexbox

先前貼了兩篇文章比較 Knoppix, GeeXboX LiveCD 的建立,現在稍微整理一下其異同:

第一階段壓縮系統時,Knoppix 用 mkisofs + create_compressed_fs, 因此要解開它必須配合 cloop 或者採用 extrace_compressed_fs 來將 KNOPPIX 解開成 iso 檔。而 GeeXboX 則採用 mkzftree 先把系統內所有檔案壓縮過。單一這一點來說,最後產生的壓縮效率明顯地 KNOPPIX 會優於 GeeXboX。我以最後結果來說,有一個 GeeXboX 壓縮完的可開機 LiveCD 檔案大小為 8945664, 而改採 Knoppix 的方式壓製完的結果為 8722432. 改善 2.5% (註:其實也不高啦)

GeeXboX 將常用的系統命令整理成一個 bin.tar.lzma, 採用 lzma 壓縮,效率比 gzip -9 要好得多,比較如下:
原大小約 13486080, 經 lzma 壓縮後為 4272857, 而 gzip -9 為 5615782, 就算是採用 bzip2 壓縮(註: 這樣無法給 kernel 用)也只得到 5438745. 壓縮率 lzma 約 68.3%, gzip 約 58.4%

類似於 GeeXboX 整理成 bin.tar.lzma, Knoppix 則整理出一個 KNOPPIX,這是採 cloop 的方式掛載,請見 create_compressed_fs 與 extract_compressed_fs. 若拿 GeeXboX 來實驗,採用此方式壓縮出來的大小為 5742650, 單純就效果來看還不如 GeeXboX, 壓縮率為 57.4%

GeeXboX 的 initrd 已經是個小型嵌入式系統了,雖然擺的東西並不多,但是並不會被取代。Knoppix 卻不然,initrd 算是掛載 CDROM 用的,最後會整個被揚棄。另外,GeeXboX 採用 genext2fs 來產生 initrd,而 KNOPPIX 則事先製作好的 minirt.gz, 兩者要掛載時都需先 gunzip 解壓再 mount 即可。

Knoppix 的 script 寫的比較有彈性,例如會在啟動時看看硬碟中是否已經安裝了 KNOPPIX, 若是則由它啟動。而 GeeXboX 則以 LiveCD 為導向,會把整個系統載入記憶體後退出 cdrom.

前面說過,若是大系統,或許 Knoppix 的方式較簡便,但是以小型系統來說,GeeXboX 卻更值得學習。

2007/03/19

UTF-8 to big5 轉碼程式

底下貼上修改自上一篇,utf-8 轉 big5 的程式片斷。


#!/usr/bin/perl
use Encode;
binmode(STDIN, ':encoding(big5)');
binmode(STDOUT, ':encoding(big5)');
binmode(STDERR, ':encoding(big5)');

use Cwd;
my $cwd = getcwd;

@ls = `LC_ALL=zh_TW.Big5 LANGUAGE=zh_TW.Big5 LANG=zh_TW.Big5 /bin/ls -1R --hide="[a-z]*[0-9]*.*" .`;
$last_dir = ".";
foreach my $file (@ls) {
chomp $file;
$big5 = encode("cp950", $file);
if ($big5 =~ m/:$/) {
chop $big5;
$last_dir = "$big5";
}
elsif ($file ne $big5) {
chdir $last_dir;
rename $file, $big5;
chdir $cwd;
}
}

2007/03/15

filename big5 to utf8 - 檔名轉換編碼

若你也有跟我一樣想把系統上的檔名從 big5 編碼轉成 utf8 的編碼,也許會對這篇有興趣。當然這篇的內容對反過來應用一樣有用。我直接貼一個片斷,您可以存成像 b2u.pl 然後執行。值得注意的是,若您的檔案樹是兩種編碼混合,那這個命令有點危險,通常這狀況不會發生。另外,此命令會把執行時所在命令下所有子目錄內所有檔案全部更改編碼,請確定這不會造成您的困擾,或許您必須確定要更改的目錄,然後 cd 過去再下此命令:
#!/usr/bin/perl
use Encode;
binmode(STDIN, ':encoding(utf8)');
binmode(STDOUT, ':encoding(utf8)');
binmode(STDERR, ':encoding(utf8)');

use Cwd;
my $cwd = getcwd;

@ls = `LC_ALL=zh_TW.UTF-8 LANGUAGE=zh_TW.UTF-8 LANG=zh_TW.UTF-8 /bin/ls -1R --hide="[a-z]*[0-9]*.*" .`;
$last_dir = ".";
foreach my $file (@ls) {
chomp $file;
$utf8 = decode("cp950", $file);
if ($utf8 =~ m/:$/) {
chop $utf8;
$last_dir = "$utf8";
}
elsif ($file ne $utf8) {
chdir $last_dir;
rename $file, $utf8;
chdir $cwd;
}
}

GeeXboX LiveCD iso 的建立

首先,你得看看 scripts 下的東西。其中最主要的兩個是 gentree 與 iso.

gentree 除了會建立目錄樹外,還會安裝核心、initrd, boot loader 等,以便 iso 建立開機光碟, 因此有興趣的人得先研究它。

根據 gentree, 或者也可以自行拆開 bin.tar.lzma, 可以發現其實 bin.tar.lzma 名不符實。這個檔有點像 KNOPPIX 的 KNOPPIX 這個壓縮檔,可以說是一個小型系統。只是它們倆還是不一樣。KNOPPIX 的 initrd 沒什麼鳥用,而 GeeXboX 的 initrd 則具備一個原始系統,之後解開的 bin.tar.lzma 則相當於再架於其上並沒有取代它。其設計理念相當於:
把最基本備配放在 initrd, 讓 initrd 儘可能小,事實上我手上的 initrd.gz 大小為 385458, 非常的小而美。加上 vmlinuz 2972912,整個可以動的系統為 3358370。當然,加上應用程式,我的 bin.tar.lzma 4180250, 這是沒有中文字型與額外的 codec, firmware的大小。也就是說整個應用程式才 4M 而已。真的是非常精美。

不知道有沒有注意到一件事,bin.tar.lzma 將系統以 lzma 壓縮,這可以大大降低它的大小,而且它採用複製到記憶體加速執行效率的方式進行,而不像 cramfs 或 KNOPPIX. 基本上以作業方式來說較占記憶體,但是整體發行大小則較小。

另外有一點,GeeXboX 的 initrd 可以單獨成立。這在 KNOPPIX 則不太一樣。而 bin.tar.lzma 的地位既然跟 KNOPPIX 這個壓縮檔地位一樣,但是其產生方式則完全不同。產生的語法為:
tar cf - -C $INSTALL lib usr/bin usr/lib | lzma e $INSTALL/bin.tar.lzma -si -a2


接下來產生開機光碟的方式在 iso 檔裡可看到如下一段命令:
mkzftree $BUILD/iso/GEEXBOX $BUILD/ziso/GEEXBOX

這段會把 iso/GEEXBOX 下的東西壓縮過,接下來壓製開機光碟的方式跟 KNOPPIX 就大同小異,完整語法如下:
mkisofs -quiet -no-pad -V GEEXBOX -volset GEEXBOX \
-publisher "The GeeXboX team (www.geexbox.org)" \
-p "The GeeXboX team (www.geexbox.org)" \
-A "MKISOFS ISO 9660/HFS FILESYSTEM BUILDER" \
-z -D -r -J -sort isolinux.bin 10000 \
-no-emul-boot \
-boot-info-table \
-boot-load-size 4 \
-b GEEXBOX/boot/isolinux.bin \
-c GEEXBOX/boot/boot.catalog \
$BUILD/ziso > $ISO


綜合以上所述,就精神上來看,KNOPPIX 的 iso 需較麻煩才能解開研究,它用了兩次 mkisofs 製作,其壓縮用 create_compressed_fs,相對的解開這個壓縮後的檔 KNOPPIX 可以用 extract_compressed_fs。而 GeeXboX 則先將檔案系統的檔案個別壓縮過再製成開機光碟,GeeXboX 的 iso 檔只需掛載後即與開機後所見無異。兩者的 initrd.gz,它原本就是由 kernel 所解開的,當然我們也可以相同的方式解開研究。

後續我會再發表一下若交換一下製作過程,其產生的 iso 檔大小的比較。

若系統夠小,而記憶體又夠,那麼 GeeXboX 的這種設計理念顯然非常優秀值得借鏡。當然若系統大到不可能放進記憶體中執行又或者連先解開再執行都不可能,那麼 KNOPPIX 的製作方式則值得借鏡。

這兩個方式其實不見得要拿來當 LiveCD 才能用,就算是要放到系統中也行,只是差在還得解開系統(意指一般Linux 是沒經過壓縮的)。總之,參考人家的做法會帶給自己不少的好處的。

LiveCD & RD - 淺談 LiveCD 在研發的地位與價值

很早就想寫這樣一篇文章,可是熟悉的朋友應該知道我非常懶,這懶之一字難以言論,卻也無可卸責,加上時機成熟,就試著寫一下,當成拋磚引玉之言。

對 LiveCD 熟悉的人非常多,國內外網站討論的站也不少,我比較常去的有底下幾個,這樣的網站非常多,大多有其他好站的連結可以查:


  1. LiveCD Wiki
  2. Linux From Scratch
  3. Knoppix
  4. KNOPPIX中文交流網
  5. GeeXboX
  6. Damn Small Linux
  7. LiveCD List
  8. ubuntu@taiwan


言歸正傳,這邊不講怎麼重製或自製 LiveCD, 請自行查詢。LiveCD 除了可以讓人輕鬆體驗 Linux(其實不止 Linux)之外,目前 LiveCD 的用途已經變得非常多彩多姿了,包括 Game, 教育, 科學, Clustering 等等,甚至有人拿來破解系統,掃毒,解救系統等重要領域。在研發上,他也可以讓你把「系統」帶著走。底下就專門說說研發上的事吧。

  1. 研發通常在自己的電腦上,可若要傳承,若要移轉,最常見的就是用一個像 Redhat 這類的來確定環境的一致性,可是若有 LiveCD, 可以在 LiveCD 安裝後的環境上確定了,則以某一版的 LiveCD 或者甘脆發布 LiveCD, 這樣也就省事多了。

  2. 一般 Linux distribution 的安裝過程非常繁瑣,而 LiveCD 雖然也有很多步,但是幾乎可以說是不必設定,這會讓安裝文件變得非常簡單。

  3. 承上,一般 Linux distribution 安裝過程非常長。而 LiveCD 則可以開完機就可以操作,而安裝也通常在十幾分鐘內完成。

  4. 一般 Linux distribution 安裝完不見得就適合研發,通常還得裝些有的沒的,有些安裝非常不易。但是若製成 LiveCD, 則安裝完就是當時研發的環境,或者相容環境,這問題就自然解決了。

  5. 一般 Linux distribution 安裝所需的硬碟通常較大,硬體需求也不見得符合,這雖然不是問題,但是有時找 driver 就很麻煩。而 LiveCD 則在其發佈時就通常為了適應更多硬體而儘量把 driver 放進去,而且可以把系統最小化,譬如刪除不必要的套件,刪除不必要的 doc 等等。對系統的發布有利。

  6. 一般 Linux distribution 通常是方便安裝到原生硬碟上,當然也可以與其他系統並存。這一點 LiveCD 除了一樣可以與其他系統並存外,還可以以 ISO 檔的方式存在,讓你用模擬器的方式來啟動。

  7. 一般 Linux distribution 只管自己的系統,若研發單位要同時發布套件、源碼等,則需要另外存放。而 LiveCD 則可以畢其功於一役,安裝一次就同時解決,甚至可以把界面調整成合適的,讓人一安裝完開機就看到你想給他們看的畫面。當然,甚至可以不必安裝就可以達成目的。

  8. 一般 Linux distribution 可以說無法重製,當然也不是無法重製,只是文件難尋。而 LiveCD 的重製文件非常之多。


以上簡單說明,有興趣的人可以留言討論。

2007/03/13

摘要報告 knoppix live cd 重製原理

請參考 Knoppix 重製有詳細說明,理應不需要我多說,不過我還是寫下來,順便整理思路,稍後再來整理與 GeeXboX 的對照。


  • 首先,你要有一個系統,至少要有一顆可以寫入的硬碟空間。原生 linux 系統可以讓你不必每次都以 Knoppix 光碟開機,沒有也行。
  • 至少要在第一次,以 KNOPPIX 開機,或者你要有辦法解開 KNOPPIX 的壓縮,把壓縮檔 KNOPPIX 解開。基本上解開的動作只需要一次。
  • 文件中提到 source 可以想像成從第一次 KNOPPIX 光碟開機後的系統的複製,也就是說,source 與開機後的系統可以說是一樣。後續製作可以利用 chroot 進 source 改變將來重製成光碟後的環境。
  • master 則把 source 壓縮起來變成 KNOPPIX, 命令為:
    mkisofs -R -U -V "KNOPPIX.net filesystem" -publisher "KNOPPIX www.knoppix.net" \
    -hide-rr-moved -cache-inodes -no-bak -pad /mnt/hda1/knx/source/KNOPPIX \
    | nice -5 /usr/bin/create_compressed_fs - 65536 > /mnt/hda1/knx/master/KNOPPIX/KNOPPIX

    再將「光碟開機」部份的功能也放在此處,例如 isolinux, 以利製作成開機光碟。製作成開機光碟的命令為:
    mkisofs -pad -l -r -J -v -V "KNOPPIX" -no-emul-boot -boot-load-size 4 \
    -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat \
    -hide-rr-moved -o /mnt/hda1/knx/knoppix.iso /mnt/hda1/knx/master

  • 除第一次重製的步驟需要以 KNOPPIX 光碟開機外,之後就可以利用先前建立好的 source 來重製新的光碟。

2007/03/08

Freevo2 UI guide


  • Who use Fade?
    • ui/src/plugins/idlebar.py
    • ui/src/gui/animation/transition.py
    • ui/src/gui/areas/handler.py
    • ui/src/gui/compat.py


  • Who has Area?
    • ui/src/gui/areas/tvlisting_area.py
    • ui/src/gui/areas/progress_area.py
    • ui/src/gui/areas/listing_area.py
    • ui/src/gui/areas/view_area.py
    • ui/src/gui/areas/info_area.py
    • ui/src/gui/theme.py
    • ui/src/input/linux_input.py
    • ui/src/menu/menu.py


  • What is Menu?
    • A Menu page with Items for the MenuStack. It is not allowed to change the selected item or the internal choices directly, use 'select', 'set_items' or 'change_item' to do this.

    • Inherited from:
      • from kaa.weakref import weakref
      • from item import Item


      Menu(heading, choices=[], reload_func = None, type = None)
      Global Variable: next_id, start from 1

    • Attributes:
      • . heading
      • stack
      • id = next_id (automate increase)
      • state
      • pos(in menu stack)
      • choices(items)
      • selected
      • infoitem
      • viewitem
      • type
      • submenu
      • tem
      • autoselect
      • cols
      • rows


    • Methods:
      • set_items(items, refresh=True)
      • select(item)
      • get_items()
      • get_selection()
      • change_item(old, new)
      • eventhandler(event): event :

        MENU_LEFT, MENU_BACK_ONE_MENU, MENU_RIGHT, MENU_SELECT, MENU_PAGEUP,
        MENU_PAGEDOWN, MENU_UP, MENU_DOWN, MENU_PLAY_ITEM, MENU_CHANGE_SELECTION,
        MENU_SUBMENU, MENU_CALL_ITEM_ACTION


  • What is ActionItem?
    • A simple item with one action. The first parameter of the function passed to this action is always the parent item if not None.

    • Attributes:
      • item: parent


    • Inherited from:
      • from files import Files
      • from item import Item
      • from mediaitem import MediaItem
      • from action import Action
      • from menu import Menu
      • from stack import MenuStack
      • from plugin import ItemPlugin, MediaPlugin


  • What is Action?
    • Action for item.actions()

      An action has a name and a function to call. Optional parameter is a shortcut name to be placed into the config for mapping an action to a button. It also has an optional description.

      To set parameters for the function call, use the parameter function of the action object. The function itself has always one or two parameters. If the function is defined inside the item, no extra parameters are used. If it is outside the item, the first parameter is the item.

      Action(name, function, shortcut=None, description=None)
      Action.parameter(*args, **kwargs)


    • Attributes:
      • name,
      • function,
      • shortcut
      • description
      • args
      • kwargs
      • item


  • What is the Files in UI?
    • File operations for an item.

    • Attributes:
      • files
      • fxd_file
      • image
      • read_only


    • Methods:
      • append(filename)
      • get()
      • copy_possible()
      • copy(dest)
      • move_possible()
      • move(dest)
      • delete_possible() == move_possible()
      • delete()


  • What is Item?
    • Item class. This is the base class for all items in the menu. It's a template for other info items like VideoItem, AudioItem and ImageItem

    • Inherited from:
      • from kaa.weakref import weakref
      • import kaa.beacon
      • from plugin import ItemPlugin


    • Item(parent=None, action=None, type=None)


    • Attributes:
      • icon
      • info: a hash of key:value
      • menu
      • type
      • _image
      • action
      • name == action.name
      • description = action.description
      • parent
      • iscopy
      • fxd_file


    • Methods:
      • _get_image()
      • _set_image()
      • __setitem__(key, value)
      • copy()
      • __id__()
      • sort(mode): mode = name, smart
      • actions()
      • get_actions()
      • get_menustack()
      • pushmenu(menu)
      • show_menu(refresh=True)
      • replace(item)
      • get_playlist()
      • eventhandler(event)
      • __getitem__(attr): attr could be:
        parent(),len(),name, or the key of info


  • What is MediaItem?
    • This item is for a media. It's only a template for image, video or audio items

    • Inherited from
      • import kaa.beacon
      • from kaa.strutils import str_to_unicode
      • from freevo.ui.event import PLAY_START, STOP
      • from item import Item
      • from files import Files


    • Attributes:
      • url: for player, such as dvd://
      • filename
      • fxdinfo


    • Methods:
      • set_url(url): url must be an instance of beacon
      • __getitem__(attr): attr could be length, length:min, elapsed:percent,
        or in fxdinfo, or come from Item
      • __id__(): == url
      • __repr__()
      • sort(mode): mode: name, filename, date
      • cache()
      • play()
      • stop()
      • eventhandler(event): event: PLAY_START, STOP


  • Plugin V.S. Menu?
    • Plugin class to add something to the item action list

      The plugin can also have an eventhandler. All events passed to the item
      will also be passed to this plugin. This works only for VideoItems right
      now (each item type must support it directly). If the function returns
      True, the event won't be passed to other eventhandlers and also not to
      the item itself.

    • Inherited from
      • from freevo.ui import plugin


    • ItemPlugin(name)


    • Attributes:
      • _plugin_type = "item"


    • Methods:
      • actions()
      • eventhandler(item, event)


    • MediaPlugin(name)


    • Attributes:
      • _plugin_type = "item"


    • Methods:
      • suffix()
      • get(parent, files)
      • count(parent, listing)
      • dirinfo(diritem)
      • database()


  • MenuStack
    • The MenuStack handles a stack of Menus.
      Stack 是為了讓選單能順利返回上一層,現在要慢慢搞懂其運作,每個 menu 會有個 menu.stack, 估計只是指向它在 MenuStack 的位置

    • Inherited from
      • from kaa.weakref import weakref
      • from freevo.ui.event import *
      • from menu import Menu
      • from item import Item


    • When __init__(), clear menustack

    • Attributes:
      • menustack


    • Methods:
      • back_to_menu(menu, refresh=True)
      • back_one_menu(refresh=True)
      • delete_submenu(refresh=True, reload=False, osd_message='')
      • pushmenu(menu): push and show
      • refresh(): 搞不懂為何 len(menu.choices) == 1 且 menu.autoselect 要刪除它
      • __getitem__(attr)
      • __setitem__(attr, value)
      • get_selected()
      • get_menu()
      • eventhendler(event): MENU_GOTO_MAINMENU, MENU_BACK_ONE_MENU,
        MENU_GOTO_MEDIA, MENU_SELECT, MENU_SUBMENU, MENU_PLAY_ITEM


  • What is MainMenu System?
    • MainMenu system contains three parts: MainMenuItem, MainMenuPlugin, MainMenu

    • Inherited from
      • from menu import Item, Action, Menu
      • from application.menuw import MenuWidget


  • What is MainMenuItem?
    • This class is a main menu item. Items of this type can be returned by a MainMenuPlugin.

      MainMenuItem(parent=None, name=u'', type=None, image=None, icon=None, skin_type=None)

      skin_info = theme.mainmenu.items 從 theme.mainmenu 中取出 skin_info
      用來設定 name, image, icon 等等

    • Attributes:
      • name
      • icon
      • image
      • type: == "main"
      • skin_type


    • Methods:
      • actions()
      • select()


  • What is MainMenuPlugin?
    • Plugin class for plugins to add something to the main menu

      MainMenuPlugin(name)


    • Attributes:
      • _plugin_type = "mainmenu"
      • _plugin_special = True
      • plugins


    • Methods:
      • items(parent)
      • plugins(subtype)


  • What is MainMenu?
    • MainMenu is an Item.

      This class handles the main menu. It will start the main menu widget and the first menu page based on the main menu plugins.

      它從每個 plugin 取得 items 再透過 Menu 變成主選單,最後利用 MenuWidget(menu)
      來產生畫面的 widget

    • Attributes:
      • menuw : menu widget

    • Methods:
      • get_menustack(): 竟然是傳回 menuw?


  • What is MenuWidget?
    • The MenuWidget is an Application for GUI and event handling and also an instance of MenuStack defined in menu.stack.

      重點在於它是 Application, 另外它的 refresh(reload=False) 只有兩行:

      MenuStack.refresh(self, reload)
      self.engine.update(self.menustack[-1])


  • What is an Application?
    • Inherited from
      • from kaa.notifier import Signal
      • from freevo.ui import gui
      • from handler import handler


    • Application(name, eventmap, capabilities)


    • Atrributes:
      • __name
      • _eventmap
      • _visible
      • engine = gui.Application(name)
      • signals = show, hide, start, stop
      • _status
      • _capabilities


    • Methods:
      • has_capabilities(capabilities)
      • get_status()
      • set_status(status)
      • _show_app(): emit a signal.show then call engine.show()
      • _hide_app()
      • eventhandler(event)
      • stop()
      • is_visible()
      • set_eventmap(eventmap)
      • get_eventmap()
      • get_name()
      • get_resources(*resources): 目前不知道 resources 的機制
      • free_resources(*resources)
      • __repr__()

2007/03/05

字詞驗證?

一直沒注意,沒想到我的 blog 被認定為垃圾 blog, 也就是發布文章時會出現字詞驗證。不過因為只要輸入字詞驗證即可,一直沒發現也正常。上星期至今一直出現原來字詞驗證的圖變成「字詞驗證」字樣,今天看了一下 help 才發現,得清掉 cookie。果然清掉 cookie 之後一切正常。

PS: 我記得申請當時有打開字詞驗證,難道這與說明不一致?

IE on linux

雖然很不想用 windows, 但是有某些狀況卻令人不得不用。在安裝 IE on Linux一文有說明,有興趣的人可以前往一觀。另外,我的系統是 debian etch, 安裝上不太一樣,底下說明:


  1. 下載 Wine, 請至WineHQ下載最新的 wine. 這邊以 wine-0.9.32 為例
  2. 解開壓縮檔 tar jxf wine-0.9.32.tar.bz2
  3. 安裝: cd ./wine-0.9.32; 請讀讀 README, 安裝過程視需求可能需要 root 密碼,安裝方式為 ./tools/wineinstall
  4. 下載 http://www.tatanka.com.br/ies4linux/downloads/ies4linux-latest.tar.gz
  5. 解開壓縮檔 tar jxf ies4linux-latest.tar.gz
  6. 安裝過程基本上都是按 Enter 即可,或請您詳讀訊息以符合您的需求,命令為: cd ./ies4linux-2.0.5; ./ies4linux
  7. 將 ies4linux 的內容放到 wine, 命令: rm -rf ~/.wine/drive_c/windows/system; cd ~/.ies4linux; cp -rf ie6/* ~/.wine
  8. 讓 ies4linux 的設定檔生效: rm ~/bin/ie6;cp ~/.ies4linux/bin/ie6 ~/bin; cp ~/.ies4linux/ies4linux.svg ~/.wine
  9. 修改 ~/bin/ie6 及 ~/Desktop/IE6.0.desktop, 將其中的 .ies4linux/ie6 通通改為 .wine


以上修改完,您的桌面的 IE 圖示應該可以動作,若沒圖示或不能正常啟動 IE的話, 請手動呼叫 ~/bin/ie6

2007/03/01

/dev/rtc to wait for clock tick timed out

我的 Lenovo NB, 先聲明一下,個人對這台感覺非常差,舉例來說,它沒有 Home/End Key, 必須輔以 Fn 鍵才行,這真的是糟至極點。

此外,灌 Debian testing, 2.6.18.1 竟然出現 hwclock 的錯誤訊息:
/dev/rtc to wait for clock tick timed out

目前我是替 hwclock 加上 --directisa 才得以解決。
據說是 BIOS 的問題,另外,網站上很多人發問都是在講 Intel Core-Dual 的CPU,到底誰的問題我也不確定,以上僅供參考。