顯示具有 Linux 標籤的文章。 顯示所有文章
顯示具有 Linux 標籤的文章。 顯示所有文章

10.02.2009

RDP function for close source Virtualbox

close source version virtualbox 的額外功能除了 usb 以外,還有一個就是 rdp 遠端連線功能。

這個遠端連線是由 Virtualbox 提供的,不是 guest OS。所以即使 guest OS 沒有遠端桌面功能(或是 disable 了遠端連線),我們還是可以經由 virtualbox 的 遠端桌面 連線 guest OS。

在 Setting 的遠端桌面 有一個 port number。
假設 該 server (不是 guest OS) 的 ip 是 192.168.145.72。
port number 是 3389
我們只要用遠端連線程式,連到 192.168.145.72:3389
就可以連過去了。

6.11.2009

mount samba folder

mount samba folder,參考這裡

我是用這個:
mount -t cifs -o username=server_user,password=server_password
//192.168.44.100/share_name /path_to/mount_point

5.13.2009

openmoko - flash kernel and rootfs

安裝 usb 連線軟體: dfu-util。
Debian 直接用 apt 安裝就可以。

通常需要
  1. kernel - uImage
  2. rootfs
bootloader 不一定要重燒

rootfs 通常是有 jffs2 在檔名中,kernel 通常就有 uImage 在檔名中。

開機進入 nor boot (nand boot) ? 就可以接上 usb ,和 dfu-util 溝通。

按著hold key 開機,進入nor boot 畫面,插上 usb。dmesg..

[786627.436013] usb 2-3: new full speed USB device using ohci_hcd and address 2
[786627.654996] usb 2-3: configuration #1 chosen from 2 choices
[786627.677190] usb 2-3: New USB device found, idVendor=1d50, idProduct=5119
[786627.677198] usb 2-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[786627.677202] usb 2-3: Product: Neo1973 Bootloader U-Boot 1.3.2-moko12
[786627.677205] usb 2-3: Manufacturer: OpenMoko, Inc
[786627.677207] usb 2-3: SerialNumber: 0000000
[786628.281641] cdc_acm: This device cannot do calls on its own. It is no modem.
[786628.281641] cdc_acm 2-3:1.0: ttyACM0: USB ACM device
[786628.288104] usbcore: registered new interface driver cdc_acm
[786628.288112] cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters
所以應該是有偵測到...

燒錄過程要注意的是...沒有操作30 sec 後,機器會自動 power off。
所以看到螢幕黑掉,就要重新 power on.

rootfs download 比較久。

重開機很花時間,約需要 2 min,約 1min 後才會出現splash screen.然後滅掉..

openmoko new freerunner - boot into nand and nor

Tony新買的Neo Freerunner 換OS後無法開機,停在 openmoko boot screen。
所以可以讓我玩一下..

先follow instruction,檢查一下nor boot 可不可以boot:
  1. .按左上角hold button不放
  2. 按右下角power button開機button不放,, 開機
  3. 放掉左上角hold button
  4. 放到右下角power button
這樣就開進 nor boot。可以看到 lcd 顯示 nor boot version 和 menu。


接著檢查 nand boot 可不可以 boot:
  1. 按著右下角 power button 不放
  2. 馬上按左上角 hold button,維持 5~8 sec,,開機
  3. 都可以放開了
這樣就開進 nand boot,可以看到 lcd 顯示 nand 和 menu

5.08.2009

open port in iptables

用iptables -L 列出目前所有的 rule:

[charles@test ~]$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- 6X-7X-2XX-2XX.adsl.static.giga.net.tw anywhere
ACCEPT all -- 6X-2XX-1XX-1XX.hinet-ip.hinet.net anywhere
ACCEPT all -- 1XX.5X.4X.X anywhere
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
DROP all -- anywhere anywhere state INVALID,NEW
DROP all -- anywhere anywhere

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain icmpfilter (0 references)
target prot opt source destination
DROP icmp -- anywhere anywhere icmp echo-request
ACCEPT icmp -- anywhere anywhere icmp echo-reply
ACCEPT icmp -- anywhere anywhere icmp destination-unreachable
ACCEPT icmp -- anywhere anywhere icmp fragmentation-needed
ACCEPT icmp -- anywhere anywhere icmp source-quench
ACCEPT icmp -- anywhere anywhere icmp time-exceeded
ACCEPT icmp -- anywhere anywhere icmp parameter-problem
ACCEPT icmp -- anywhere anywhere icmp timestamp-reply
ACCEPT icmp -- anywhere anywhere icmp type 16
ACCEPT icmp -- anywhere anywhere icmp address-mask-reply
[charles@test ~]$

現在要把 tcp port 2030 打開,下:

iptables -A INPUT -p tcp --dport 2030 -j ACCEPT
這樣的話,還是沒效,因為rule被 "append" 到後面。
再list一次:

Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- 6X-7X-2XX-2XX.adsl.static.giga.net.tw anywhere
ACCEPT all -- 6X-2XX-1XX-1XX.hinet-ip.hinet.net anywhere
ACCEPT all -- 1XX.5X.4X.X anywhere
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
DROP all -- anywhere anywhere state INVALID,NEW
DROP all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere tcp dpt:device2
可以看到,是在 DROP all 之後。所以沒效。
要用 "insert" 才有效:

$ sudo iptables -I INPUT 6 -p TCP --dport 2030 -j ACCEPT

這樣,list出來:

Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- 6X-7X-2XX-2XX.adsl.static.giga.net.tw anywhere
ACCEPT all -- 6X-2XX-1XX-1XX.hinet-ip.hinet.net anywhere
ACCEPT all -- 1XX.5X.4X.X anywhere
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT tcp -- anywhere anywhere tcp dpt:device2
DROP all -- anywhere anywhere state INVALID,NEW
DROP all -- anywhere anywhere
可以看到,被插到DROP之前了 (實際上是第6個)。

這樣就打開port 2030 了

5.06.2009

centos log

CentOS 裝完

visudo 把自己加入 ALL(ALL)=ALL

改 .bashrc 把 /sbin 加到 PATH。
用ifconfig 看網路

設定 proxy - 用 UI

設定 yum 使用 proxy:
設定檔是 /etc/yum.conf
加一行:
 proxy=http:\\ip:port
然後 run yum update (要有 root 權限)...等等等..

run 在 virtualbox 的話,follow 這一篇 ( http://forums.virtualbox.org/viewtopic.php?t=4960&highlight=install+guest+addition) 安裝VBoxAddition。

Debian 的 Service 用 /etc/init.d/xxx start| stop
CentOS 提供一個 command 叫 service: service httpd restart

django 可以配合python 2.3~2.6的版本,python 2.5 以後的版本內涵SQLit,可以不必額外在裝database。

4.27.2009

mythbuntu

原來ubuntu有for media center 的版本,叫 mythbuntu , 就是myth + ubuntu

要注意 繁體中文叫 Hanzi(Traditional)

但是看不到什麼feature...大概在Myth吧..

還有 backend 就是 TV card 的意思

Linux GPRS

Linux GPRS Howto 的說明比一些 GPRS Module 的application Notes 還清楚

PDP : packet data protocol. 資料封包 (對應的,語音連線送的是聲音封包)。
APN : Access Point Name。

用minicom 來下 command。要注意 屬於 dialout groupe。

下 AT 回應 OK 代表RS232 線連線 OK. (其實有看到 AT 就代表 正常,因為 AT 也 modem echo back )

下 AT+CPIN? 檢查 pin number 是不是有輸入,回 READY 代表正常。
如果不是,用 AT+CPIN=1234 輸入 pin number (1234)

下 AT+CGATT? 檢查是不是已經attach 到 GPRS network 了,回應 1 是OK。
如果是 0,用 AT+CGATT=1 叫 modem attach。

設定PDP 傳送的 profile,modem 可以設很多 pdp profile,方便user 轉換。
AT+CGDCONT=1,"IP","INTERNET"
  • 1 : profile 1
  • "IP" : PDP type (ip packet, 好像一定要大寫)
  • "INTERNET" : APN (每一家電信公司不一樣)
撥號,GPRS Servie 的 number 固定是:
*99***1#
後面的 " 1" 是 PDP profile 號碼。

ATDT*99***1#
播完號,出現 CONNECT,然後就會看到一堆亂碼。

..到這裡,代表 linux 到 gprs modem 端已經OK了。



接下來設定 linux 的撥接動作。

GPRS Modem 是以 ppp 的方式傳送資料,所以要config ppp。

好像大多數網站都說 wvdial,所以也用wvdial,wvdial 是 ppp 的 front-end,用一個 config 檔而已。

修改 /etc/wvdial.conf:

[Dialer Defaults]
Modem = /dev/ttyS1
Baud = 115200
Init = AT+CGDCONT=1,"IP","INTERNET"
Phone = *99***1#
Username = any
Password = any
Dial Command = ATDT
New PPPD = yes
雖然不檢查username, password,但是還是要填值,否則 wvdial 會 complain。
然後..
 : ~$sudo wvdial
就會出現..
$ sudo wvdial
--> WvDial: Internet dialer version 1.60
--> Initializing modem.
--> Sending: AT+CGDCONT=1,"IP","INTERNET"
AT+CGDCONT=1,"IP","INTERNET"
OK
--> Modem initialized.
--> Sending: ATDT*99***1#
--> Waiting for carrier.
ATDT*99***1#
CONNECT
~[7f]}#@!}!}$} }<}!}$}&@}#}$@#}%}&},<eI}"}&} } } } }'}"}(}"{8~~~
--> Carrier detected. Waiting for prompt.
~[7f]}#@!}!}%} }<}!}$}&@}#}$@#}%}&},<eI}"}&} } } } }'}"}(}"3j~
--> PPP negotiation detected.
--> Starting pppd at Tue Apr 28 11:52:35 2009
--> Pid of pppd: 30572
--> Using interface ppp0
--> local IP address 116.59.14.180
--> remote IP address 10.0.0.1
--> primary DNS address 168.95.1.1
--> secondary DNS address 168.95.192.1
這樣好像連上了..
但是 routing table 好像沒update 耶..

把eth0 斷掉後,重新連線,roue -n
default gateway 是ppp0 (自己)


without flow control and modem signal


如果GPRS Modem 和 Linux 間只有 TX/RX/GND,沒有其他 flow control (CTS, RTS) 和 modem state (CD, DSR, CTR) 信號。

雖然有看到/etc/ppp/options 中有 crtscts 選項可以設,但是好像沒效,wvdial 一定會去 check ctsrts。
所以wvdial 在第一階段,AT+CGDCONT=1,"IP","INTERNET" 就不通了,會反覆兩次,然後fail : Modem No Response。

這樣就需要把 linux 這一端的 RS232 的 CTS 和 RTS 短路 (7-8)。
這樣就可以正確下命令,和撥號,撥通...

但是一但撥通,就會有 carrier lost 的message。
這樣就要將 linux 這一端的 modem status DTR, CD, DSR 短路 (1,4,6)。
這樣就OK了

ref Null Modem




Linux 同時啟動internal network

就是要設定好 routing path.

因為有設定bridge (br0),所以要把 br0 啟動起來,把 eth0 關掉。
把 192.168.0.0 設定 gatway : 192.168.144.254
route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.144.254 br0

4.22.2009

build openocd under mingw - with ftd2232 chip interface

(有 update 喔)
openocd 在 mingw 下 build..

先要 install mingw(gcc for win) 和 msys(unix shell for win)

因為安裝 msys 會尋問 mingw在哪,所以要先install mingw:

mingw 現在以經有像 cygwin那樣的網路安裝了,download MinGW-5.1.4.exe
http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=240780

執行後就會出現問題,選安裝,然後而外的package 選 g++ 和 make..
之後就會 自己 download 和安裝完畢
我裝在 C:\MinGW
裝完後要手動把 c:\mingw\bin 加到 cmd 的環境變數。

這樣裝完後,就可以開啟cmd.exe,run gcc 了

但是要run make 和 bash file需要 msys。 download msys-1.0.10.exe
http://downloads.sourceforge.net/mingw/MSYS-1.0.10.exe

直接執行就可以,中途會問你postinstall,回 y。
然後問你有沒有 MinGW,回答有,並且把剛剛install MinGW的 path 寫出來
!!但是因為在 unix 中,目錄的左右斜線是相反的,要注意。
裝完後就可以在 programfile - MinGW- msys 啟動 msys 環境。



這個openocd 用 ftd232 (usb-232).
所以要 libftdi.a
libftdi.a 會用到 libusb.a

因為是 for windows 版,所以要dowload windows 版 libusb - libusb-win32-device-bin-0.1.12.1.tar.gz
http://libusb-win32.sourceforge.net/

下載的是bin 檔 (prebuild),所以把 usb.h copy 到 /mingw/include 把 libusb.a copy 到 /mingw/lib

還要安裝 libusb-win32 的 dll : libusb-win32-filter-bin-0.1.12.1.exe
http://sourceforge.net/project/downloading.php?group_id=78138&filename=libusb-win32-filter-bin-0.1.12.1.exe&a=96392657

這樣就可以 開始 build libftdi.a - download libftdi-0.15.tar.gz
http://www.intra2net.com/en/developer/libftdi/download.php

解開,到libftdi-0.15 下, /.configure 然後 make
會出現 error,但是 check 一下 error message,會發現 libftdi.a build 完,是 build example 時有 error,所以不管。

把 src/ftdi.h copy 到 /mingw/include
把 src/.libs/libftdi.a copy 到 /mingw/lib


最後就要 build openocd 了..

download trunk 的版本 (release 版支援的 cpu 比較少..)
解開, run ./bootstrap
./configure -enable-ft2232_libftdi CC="gcc -mno-cygwin"
make

3.25.2009

grep : find string in source

還是unix 好用,用 UnixUtil 搜尋 source 中的字串,可以用:

grep -Ir CStaticContainer *

其中..
  • -I 是說,ignore binary file
  • -r 是說,recursive
使用 grep 不能同時指定 file pattern 和 recursive,要配合 find 才行。

但是 xargs 在 Windows 下會有 "cannot fork" 的 error message。

其他:

  • -i 是說,ignore case (大小寫不管)
這一夜的說明很不錯。
http://www.esmerel.com/wagons/rob/grep.html

3.20.2009

sequence on CMD42

SD card 的溝通也是要靠 Address 的, (RCA : Relative Card Address),但是 address 0x00 是 broadcast address,所有的 card 都要收。

CMD7 (SELECT_DESELECT) 是用來 toggle SD card 進入/退出 Transfer Mode 。

Card Lock/Unlock Command 類似 Block Write Command。
其中 transfer 的 data 部份,就是 password, setting... etc。
所以 CMD42 的 Response 也跟 Block Write Command 的 Result 一樣 ?


Card Identification.. 然後 Configuration...然後進 Transfer state..

procedure :

先作 setting password


Linux 真是偉大,在某一版看到 implement,但是好像沒有 接受
http://groups.google.com.tw/group/linux.kernel/browse_thread/thread/7ddefc84c21ede84/d47cd82a306fd9d8?q=mmc_lock_unlock#d47cd82a306fd9d8


int mmc_lock_unlock(struct mmc_card *card, struct key *key, int mode)
+{
+ struct mmc_request mrq;
+ struct mmc_command cmd;
+ struct mmc_data data;
+ struct scatterlist sg;
+ struct mmc_key_payload *mpayload;
+ unsigned long erase_timeout;
+ int err, data_size;
+ u8 *data_buf;
+
+ mpayload = NULL;
+ data_size = 1;
+ if (mode != MMC_LOCK_MODE_ERASE) {
+ mpayload = rcu_dereference(key->payload.data);
+ data_size = 2 + mpayload->datalen;
+ }
+
+ data_buf = kmalloc(data_size, GFP_KERNEL);
+ if (!data_buf)
+ return -ENOMEM;
+ memset(data_buf, 0, data_size);
+
+ data_buf[0] = mode;
+ if (mode != MMC_LOCK_MODE_ERASE) {
+ data_buf[1] = mpayload->datalen;
+ memcpy(data_buf + 2, mpayload->data, mpayload->datalen);
+ }
+
+ memset(&cmd, 0, sizeof(struct mmc_command));
+
+ cmd.opcode = MMC_SET_BLOCKLEN;
+ cmd.arg = data_size;
+ cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
+ err = mmc_wait_for_cmd(card->host, &cmd, CMD_RETRIES);
+ if (err != MMC_ERR_NONE)
+ goto out;
+
+ memset(&cmd, 0, sizeof(struct mmc_command));
+
+ cmd.opcode = MMC_LOCK_UNLOCK;
+ cmd.arg = 0;
+ cmd.flags = MMC_RSP_R1B | MMC_CMD_ADTC;
+
+ memset(&data, 0, sizeof(struct mmc_data));
+
+ mmc_set_data_timeout(&data, card, 1);
+
+ data.blksz = data_size;
+ data.blocks = 1;
+ data.flags = MMC_DATA_WRITE;
+ data.sg = &sg;
+ data.sg_len = 1;
+
+ memset(&mrq, 0, sizeof(struct mmc_request));
+
+ mrq.cmd = &cmd;
+ mrq.data = &data;
+
+ sg_init_one(&sg, data_buf, data_size);
+ err = mmc_wait_for_req(card->host, &mrq);
+ if (err != MMC_ERR_NONE)
+ goto out;
+
+ memset(&cmd, 0, sizeof(struct mmc_command));
+
+ cmd.opcode = MMC_SEND_STATUS;
+ cmd.arg = card->rca << 16;
+ cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
+
+ /* set timeout for forced erase operation to 3 min. (see MMC spec) */
+ erase_timeout = jiffies + 180 * HZ;
+ do {
+ /* we cannot use "retries" here because the
+ * R1_LOCK_UNLOCK_FAILED bit is cleared by subsequent reads to
+ * the status register, hiding the error condition */
+ err = mmc_wait_for_cmd(card->host, &cmd, 0);
+ if (err != MMC_ERR_NONE)
+ break;
+ /* the other modes don't need timeout checking */
+ if (mode != MMC_LOCK_MODE_ERASE)
+ continue;
+ if (time_after(jiffies, erase_timeout)) {
+ dev_dbg(&card->dev, "forced erase timed out\n");
+ err = MMC_ERR_TIMEOUT;
+ break;
+ }
+ } while (!(cmd.resp[0] & R1_READY_FOR_DATA));
+ if (cmd.resp[0] & R1_LOCK_UNLOCK_FAILED) {
+ dev_dbg(&card->dev, "LOCK_UNLOCK operation failed\n");
+ err = MMC_ERR_FAILED;
+ }
+
+ if (cmd.resp[0] & R1_CARD_IS_LOCKED)
+ mmc_card_set_locked(card);
+ else
+ mmc_card_clear_locked(card);
+
+out:
+ kfree(data_buf);
+
+ return err;
+}


裡面有完整的CMD42 的 command sequence..
但是這段 code 在linux kernel 中找不到...

這一個Thread 有相關的討論..

3.02.2009

Install Samba Server in Windows

這一篇有prebuild version,還有,不用裝Cygwin.

為甚麼要這樣作呢? 因為Windows 有 15 人的連線限制...

還沒試..

這一篇是在 Cygwin 上安裝 Samba 的範例。

1.17.2009

原來SONY有這麼多產品用 Linux

在這一頁,SONY的 source code distribution service 中,列出所有使用 gpl 產品的 source code。

真不可思議,原來這麼多東西都有用到 Linux..
小從 多功能遙控器,大到 Home Server。都有用。

比較有趣的是..很多SONY相機都列在上面... H3, H10, H50...T2, T20,T300。

還有 PND.也都是 用 Linux.

10.15.2008

Linus 的 blog..

Linus 也有自己的 blog 耶 : Linus' blog

10 月開始 po,大概是說因為朋友有一個blog 放family 的story,他覺得有一個不錯,所以也在 blogger 開一個。

第二篇說他收到 Intel 的 SSD,超級好,random read/write 是他試過的 SSD 中最好的。

第三篇說他為了管制小孩使用 電腦的時間,所以寫了一個程式,限制小孩上網時間,他會自動紀錄上網時間,並且有一個UI顯示剩餘時間,當時間超過他的設定值,就會強制 log-off。
他把這個程式"tracker"放在 kernel git 中...

然後是寫他一個沒有選舉權的外國人,對美國選舉的感想...與芬蘭選舉制度的比較..

然後?是他的狗的照片?

最後一篇是講最近 2.6.27 版 的問題,...大概是希望晚一點release...

8.28.2008

IE 8 出來囉,而且看起來越來越像 firefox 了。

這樣發展下去,IE 會不會像是 IIS 一樣,一直追著 Apache..最後,還是只能投向 Apache 的懷抱。

為了興趣而寫code,和為了錢而寫,code 速度和品質 不一樣 (嗎 ?)。

8.26.2008

anon-proxy

ubuntu 裡有一個蠻方便的 package : anon-proxy ,實際是甚麼我不清楚,是 JAP ? TOR 還是只是單一的 proxy ?

但是 run 起來就像是一般匿名 proxy 一樣,只要從自己的 4001 port 出去,就會是另一個 ip (但是每一次不一樣?)


安裝後啟動方式就像是一般的 service 一樣:
$sudo /etc/init.d/anon-proxy start

然後在 browser 中指定 proxy = 127.0.0.1 port=4001

但是重開機後,anon-proxy 好像就沒辦法啟動。

很神奇的,open source 社群就是這麼奇怪,這麼少人用的軟體,還是有人會用,而且問了,還會有厲害的人回答:

這是因為 star. stop script 沒有 create folder,所以要自己修改 script:
$ sudo vi /etc/init.d/anon-proxy

然後在 '''PIDFILE=/var/run/anon-proxy/mix.pid''' 這一行後面加上:
mkdir /var/run/anon-proxy
chown anon-proxy:nogroup /var/run/anon-proxy

然後重新啟動就可以了。
然後為了避免自己不小心弄錯,就加裝一個 browser 吧!
我是選 opera,因為不知道為什麼,midori 在 ubuntu 上 run 不起來。
然後設定 opera 使用 anon-proxy 就可以了。

這樣,用 firefox 的就是真正的自己,在 opera 上的就是別人囉!
-- 我應該不會人格分裂吧!

ip 會變嗎? 還是先用個幾天好了....順便 log 一下 ip,今天的是.....

8.25.2008

TraceMonkey - JavaScript JIT for FF 3.1

在 這裡 看到的,Mozilla 好厲害,寫一個 JavaScript 的JIT,讓 FF3.1 執行 javascript 的速度比 3.0 快 2 ~ 40 倍 (這裡有 benchmark)

真是超厲害的,而且不是整個 script 都拿來轉,他只會找出 loop ,重複執行很多次的部份,把他轉成 native code,大概是因為要是都轉的話,花在做 compile 的時間反而不划算吧。

類似這個以前有一家公司 transmeta (Linus 有這在這一家公司上過班),有作過類似的技術,叫 code morphing,因為他的 core 是 VLIW,在 run x86 的 code時,會動態的把一些常常 run 的 code重新 compile成 native 的 Long Intruction Word。以此達到高效能低耗電。 (可惜結果好像不太好...)。

就和文章中說得一樣,這個技術要是 release 出來後,應該會讓很多 browser base 的 rich client AP 蓬勃發展 (雖然現在已經很多)。

這一篇有詳細說明這個 JIT 的作法,可以稍微瞭解如何決定要不要compile code。




要是真能成功就好了,這樣一些 原本就很熟習 JavaScript 的網頁設計師,就不用去學新的平台了 (SilverLight, AIR..etc)。

問題:因為是 compile 成 native code,所以....應該很難做到跨平台吧,要run 在 embedded system 也不容易吧...

8.20.2008

Hexdump format

因為需要把廠商提供的 bin 參數,轉成 c array。所以...用 linux 的 hexdump 來作,用 man hexdump 來看,果然是一個多樣化的 工具,還可以指定 format。只是看不太懂 man 中有關 -e format_string 的說明。

在 這裡 看到範例
$ hexdump -e ' [iterations]/[byte_count] "[format string]" '
原來,是要用 小字串 符號 把 format 框起來 呀!

所以我要的格式是

$ hexdump -e '16/1 "0x%02X,"' -e '"\n"' SPI_DATA.bin -n 432
這樣輸出的內容,直接就可以放在 C Array 裡了。

8.11.2008

今天的新聞: ACM 的這篇:

ACM SIGOPS Operating Systems Review
Volume 42 , Issue 5 (July 2008) Research and developments in the Linux kernel

開放下載:

內文章節:

Minding the gap: R&D in the Linux kernel

Introducing technology into the Linux kernel: a case study

Extending futex for kernel to user notification

Plan 9 authentication in Linux

Towards achieving fairness in the Linux scheduler

I/O resource management through system call scheduling

PipesFS: fast Linux I/O in the unix tradition

CUBIC: a new TCP-friendly high-speed TCP variant

On the design of a new Linux readahead framework

Practical techniques for purging deleted data using liveness information

virtio: towards a de-facto standard for virtual I/O devices

Virtual servers and checkpoint/restart in mainstream Linux

7.26.2008

程式要好好寫呀,不然這樣臉就丟大了!

在 LinuxLoop看到這個新聞,然後在Yuren's Info Area 看到翻譯。

大概是說 foxconn 的主機板 Foxconn G33M,bios中有一段code,偵測到OS是linux 系統的話,就回報錯誤的資料,讓linux不能在這個板子上執行。

follow 文中reference 的ubuntu 論壇,超詳細,順便可以學一下linux 下 acpi code 的 dump, compile。

竟然可以這麼清楚的看到以下的code : (害我都想買一片 Foxconn G33M來試試 :) )

If (MCTH (_OS, "Linux"))

{
Store (0x3, OSVR)
}

open source 的人也很厲害,就在forume中教你怎麼改這段code,然後 rebuild回去,修正這個問題。


好笑(糟糕)是foxconn 的客服。... (略)




我想,這應該不是Foxconn惡意的排除Linux系統,應該是 BIOS工程師改code時,只有考慮Windows 部份,所以只有改 Windows 的部份,其他部份就留著沒動(也就是懶? 或是趕 schedule?)。


發文者最後說:
Your DSDT table looks like it was written by a first year computer science student, it is scary, I will not just shut up and go away until I feel like I've been done right, this can end up on Digg, Slashdot, filed with the FTC that you are passing bad ACPI data on to Linux specifically.

嗯,這個。

可以算是給我們 身為軟體工程師 (programmer, software engineer) 一個警惕:

就算是趕 schedule,程式也要好好寫,不然自己丟臉不說,公司也受累不少...