2012年3月8日 星期四

IOCTL




This program opens a tty (serial port) and then calls ioctl with the fd of the serial port, the command TIOCMGET (listed as get the status of modem bits) and a pointer to an integer into which the result is returned.


Reference:



2012年3月5日 星期一

Make

article:

GNU make:



make 內建變數的涵義

$@ Target的檔名

$% 程式庫成員中的檔名元素

$< 第一個prequeite的檔名

$? Timestamp 在Target之後的Prequeite

$^ 所有的Prequeite的檔名 但不包含重複部分

$+ 所有的Prequeite的檔名


$(@D) $(

$(@F) $(



.PHONY in Makefile

Make 主要的工作目標都是針對檔案,所以萬一你定義的工作目標並不是檔案,或是正好與檔案重複的時候,其實是會讓人丈二金剛摸不著頭的。
所以,.PHONY 被用來定義假工作目標,這樣 Make 就知道這不是針對檔案。

Make 預設的假工作目標有:
  • all
  • install
  • clean
  • distclean
  • TAGS
  • info
  • check
Reference:

OBJ and ELF


Reference:

2012年2月16日 星期四

Hard disk Check

1. Tools : SMART
{{{
#smartctl -c /dev/裝置名稱 //顯示硬碟支援檢查項目


-h顯示參數說明及範例
-V顯示版本等相關資訊
-i顯示該硬碟的相關資訊(包括是否啟動 SMART)
-a顯示硬碟所有相關資訊
-H顯示硬碟 SMART 健康狀況 (健康 PASSED、生病 FAILED)
-c顯示硬碟支援的檢查、測試項目
-A顯示硬碟檢查後的相關屬性值 (例如 194 Temperature_Celsius 最後值為 HDD 溫度)
-l TYPE顯示硬碟檢查後 Log (TYPE: error, selftest, selective, directory)
-t TEST執行硬碟測試 (TEST: offline, short, long, conveyance, select,M-N pending,N afterselect,on afterselect,off)
-X放棄執行硬碟測試

}}}

Booting grub

#########################################
#########################################
Question: 因為我是利用grub當開機管理,因為每次都會看到 kernel /boot/vmliuz-2.6.10-1.771_FC2 ro root=LABEL=/ rhgb quiet
我有看過一些書,可是很少有在說明的,所以我非常很好奇 ro root=LABEL=/ rhgb quiet 它的功能是什麼??跟/proc/cmdline關係
墾請大大告知~謝謝您!!
ro root=LABEL=/ rhgb quiet

Solution:
"kernel /boot/vmliuz-2.6.10-1.771_FC2" 只是在告訴 grub 關於 kernel image 的正確位址, "ro root=LABEL=/ rhgb quiet" 是傳給 kernel 的參數 (command line), 'ro' 表示一開始以唯讀的方式去 mount root file system (稍後會再 remount 成可讀寫), 'root=LABEL=/' 則告訴 kernel 關於 root file system 所在之位置, 'quiet' 表示 kernel 載入的過程不要螢幕上顯示訊息, 'rhgb' 不是給 kernel 用的, 而是藉著 kernel command line (也就是 /proc/cmdline) 讓開機過程 (此時 kernel 已載入完成而進入 user mode) 知道要使用圖形介面. 你可以去找一下 "/etc/rc.d/rc.sysinit" 這個檔案裡面就會用到 'rhgb' 了.

以上是我知道的, 如果有不正確的地方還請多指正.

##################################
##################################
rhgb = redhat graphical boot - This is a GUI mode booting screen with most of the information hidden while the user sees a rotating activity icon spining and brief information as to what the computer is doing.





2012年2月15日 星期三

Bash Script

1. Calculating

The Double Parentheses Construct
Similar to the let command, the ((...)) construct permits arithmetic expansion and evaluation.
In its simplest form, a=$(( 5 + 3 )) would set "a" to "5 + 3", or 8.
However, this double parentheses construct is also a mechanism for allowing C-type manipulation of variables in Bash.

2. Array

bash下array的幾種使用方法





Memory control Tech




Reference: