<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>憂藍夢境‧部落格 &#187; Linux</title>
	<atom:link href="http://blog.linym.net/archives/category/system/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.linym.net</link>
	<description>我的學習心得、筆記</description>
	<lastBuildDate>Thu, 10 Sep 2009 07:50:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>IE 下載 Office 2007 檔案變成 zip</title>
		<link>http://blog.linym.net/archives/221</link>
		<comments>http://blog.linym.net/archives/221#comments</comments>
		<pubDate>Tue, 17 Jun 2008 16:33:50 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[系統筆記]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[教學]]></category>

		<guid isPermaLink="false">http://blog.linym.net/?p=221</guid>
		<description><![CDATA[如果您的 Web Server 是採用 Apache，那有可能使用 Internet Explorer 下載 Office 2007(docx、ppts、xlsx...) 檔案的時候，會發現副檔名自動變成 .zip，有以下解決方法(擇一即可)：
一、修改 mime.types 檔案
加入：
application/vnd.openxmlformats    docx pptx xlsx
二、修改 httpd.conf 檔案
加入：
AddType  application/vnd.openxmlformats  .docx .pptx .xlsx
三、使用 .htaccess
加入：
AddType  application/vnd.openxmlformats  .docx .pptx .xlsx
參考文章：Office 2007 MIME types for Apache 
]]></description>
			<content:encoded><![CDATA[<p>如果您的 Web Server 是採用 Apache，那有可能使用 Internet Explorer 下載 Office 2007(docx、ppts、xlsx...) 檔案的時候，會發現副檔名自動變成 .zip，有以下解決方法(擇一即可)：</p>
<p><strong>一、修改 mime.types 檔案</strong><br />
加入：</p>
<pre>application/vnd.openxmlformats    docx pptx xlsx</pre>
<p><strong>二、修改 httpd.conf 檔案</strong><br />
加入：</p>
<pre>AddType  application/vnd.openxmlformats  .docx .pptx .xlsx</pre>
<p><strong>三、使用 .htaccess</strong><br />
加入：</p>
<pre>AddType  application/vnd.openxmlformats  .docx .pptx .xlsx</pre>
<p>參考文章：<a href="http://www.vladville.com/2007/04/office-2007-mime-types-for-apache.html">Office 2007 MIME types for Apache </a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/221/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>開源中文語音合成:eSpeak</title>
		<link>http://blog.linym.net/archives/211</link>
		<comments>http://blog.linym.net/archives/211#comments</comments>
		<pubDate>Sat, 01 Dec 2007 00:47:20 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[軟體筆記]]></category>
		<category><![CDATA[eSpeak]]></category>
		<category><![CDATA[TTS]]></category>
		<category><![CDATA[語音合成]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/211</guid>
		<description><![CDATA[語音合成系統通常拿來做 TTS(Text to Speach) 應用，英文 TTS 已經滿多且成熟了，但是中文的目前大多是廠商或實驗室驗自行開發，所以可能沒辦法免費拿來研究。
最近發現的 eSpeak 這個 Open Source 已經在最新的開發版本中加入中文語音支援囉!網頁在這裡，應該不久就會變成正式版本釋出。根據了解，好用的 StarDict 翻譯軟體也是使用 eSpeak 來作為朗讀發音系統哦！
在嘗試移植到嵌入式 ARM Linux 時失敗，因為實在太多 Shared Libraries 了，如果有成功的高手希望能分享一下心得。
]]></description>
			<content:encoded><![CDATA[<p>語音合成系統通常拿來做 TTS(Text to Speach) 應用，英文 TTS 已經滿多且成熟了，但是中文的目前大多是廠商或實驗室驗自行開發，所以可能沒辦法免費拿來研究。</p>
<p>最近發現的 <a href="http://espeak.sourceforge.net/" target="_blank">eSpeak</a> 這個 Open Source 已經在最新的開發版本中加入中文語音支援囉!網頁在<a href="http://espeak.sourceforge.net/test/latest.html" target="_blank">這裡</a>，應該不久就會變成正式版本釋出。根據了解，好用的 <a href="http://stardict.sourceforge.net/" target="_blank">StarDict</a> 翻譯軟體也是使用 eSpeak 來作為朗讀發音系統哦！</p>
<p>在嘗試移植到嵌入式 ARM Linux 時失敗，因為實在太多 Shared Libraries 了，如果有成功的高手希望能分享一下心得。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/211/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>編譯 ZD1211 無線網卡驅動</title>
		<link>http://blog.linym.net/archives/209</link>
		<comments>http://blog.linym.net/archives/209#comments</comments>
		<pubDate>Mon, 19 Nov 2007 11:36:22 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Other]]></category>
		<category><![CDATA[硬體筆記]]></category>
		<category><![CDATA[driver]]></category>
		<category><![CDATA[wireless]]></category>
		<category><![CDATA[zd1211]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/209</guid>
		<description><![CDATA[關於如何編譯 ZD1211/ZD1211B 晶片的 USB 無線網卡 driver，經常在各大討論區及 BBS 看到有人提出相同的問題，因此來寫個教學。
前往 ZD1211 專案網站可以知道目前有三種版本的驅動，其中建議使用 zd1211rw 這個版本，因為它持續在更新且已納入 Linux 2.6.18 以後的 kernel 裡。zd1211rw 支援這三種晶片：

ZyDAS ZD1211
ZyDAS ZD1211B
Atheros AR5007UG

不過既然都已經納入 kernel 了為什麼還要編譯驅動？因為還是有很多產品的 USB ID 不能被 zd1211rw 所辨識(我的 PCI GW-US54GXS 就是)，當然就沒辦法驅動囉！這篇要做的就是從 kernel 裡的 zd1211rw source code 加入對應的 USB ID，主機環境是 ubuntu 7.10，其他版本應該也差不多。
首先要安裝編譯相關套件 &#038; 下載 linux source
$ sudo apt-get install build-essential kernel-package linux-source
切換至 src 目錄並解開 linux source
$ [...]]]></description>
			<content:encoded><![CDATA[<p>關於如何編譯 ZD1211/ZD1211B 晶片的 USB 無線網卡 driver，經常在各大討論區及 BBS 看到有人提出相同的問題，因此來寫個教學。</p>
<p>前往 <a href="http://zd1211.wiki.sourceforge.net/" target="_blank">ZD1211</a> 專案網站可以知道目前有三種版本的驅動，其中建議使用 <a href="http://www.linuxwireless.org/en/users/Drivers/zd1211rw" target="_blank">zd1211rw</a> 這個版本，因為它持續在更新且已納入 Linux 2.6.18 以後的 kernel 裡。zd1211rw 支援這三種晶片：</p>
<ul>
<li>ZyDAS ZD1211</li>
<li>ZyDAS ZD1211B</li>
<li>Atheros AR5007UG</li>
</ul>
<p>不過既然都已經納入 kernel 了為什麼還要編譯驅動？因為還是有很多產品的 USB ID 不能被 zd1211rw 所辨識(我的 PCI GW-US54GXS 就是)，當然就沒辦法驅動囉！這篇要做的就是從 kernel 裡的 zd1211rw source code 加入對應的 USB ID，主機環境是 ubuntu 7.10，其他版本應該也差不多。</p>
<p><strong>首先要安裝編譯相關套件 &#038; 下載 linux source</strong><br />
$ sudo apt-get install build-essential kernel-package linux-source</p>
<p><strong>切換至 src 目錄並解開 linux source</strong><br />
$ cd /usr/src<br />
$ sudo tar -xjvf linux-source-2.6.22.tar.bz2</p>
<p><strong>拷貝 kernel 設定檔(.config) 至 linux source</strong><br />
$ sudo cp linux-headers-2.6.22-14-generic/.config linux-source-2.6.22</p>
<p><strong>編輯 zd_usb.c 加入新 USB ID，可利用 lsusb 指令可以找出網卡的 ID，如：2019:5303</strong><br />
$ cd linux-source-2.6.22<br />
$ sudo vim drivers/net/wireless/zd1211rw/zd_usb.c<br />
在檔案開頭不遠處可以看到一堆 USB ID 號碼，就是要加進這裡面，GW-US54GXS 是 ZD1211B 晶片，所以在 ZD1211B 下方增加一行：<br />
/* ZD1211B */<br />
{ USB_DEVICE(0x2019, 0x5303), .driver_info = DEVICE_ZD1211B },<br />
確認後就存檔離開</p>
<p><strong>開始編譯驅動</strong><br />
$ sudo mkdir .tmp_versions<br />
$ sudo make drivers/net/wireless/zd1211rw/zd1211rw.ko</p>
<p><strong>沒錯誤就會產生 zd1211rw.ko，將它覆蓋原本系統中的</strong><br />
$ sudo cp drivers/net/wireless/zd1211rw/zd1211rw.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless/zd1211rw<br />
$ sudo depmod -a</p>
<p>重開機應該就可以正確驅動了:D</p>
<p>參考資料：<br />
<a href="http://www.linuxwireless.org/en/users/Drivers/zd1211rw/AddID" target="_blank">Adding new device IDs to zd1211rw</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/209/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Ubuntu 7.10 安裝心得</title>
		<link>http://blog.linym.net/archives/201</link>
		<comments>http://blog.linym.net/archives/201#comments</comments>
		<pubDate>Sat, 20 Oct 2007 18:19:36 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[系統筆記]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[系統]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/201</guid>
		<description><![CDATA[最新版的 Ubuntu 7.10 Gutsy Gibbon，終於在 2007 年 10 月 18 日下午正式發佈囉！這次沒聽說塞爆伺服器的情形發生了，大多順利下載完成，我也馬上拿出 NB 來全新安裝，裝完進到桌面的感想是：比以前更順了，安裝和使用大致上也沒什麼問題，不過筆電是 ATI X1450 的顯示晶片，要啟動 Compiz Fusion 特效還是麻煩了些。
一、啟動 Compiz Fusion 桌面特效
在新版中，如果顯卡驅動沒問題並且有支援，預設就會啟動特效，如果要手動更改可到 偏好設定 -> 外觀設定 -> Visual Effects 設定。
二、安裝 Compiz Fusion 管理工具
新版中設定 Compiz Fusion 特效要安裝 compizconfig-settings-manager，不要使用 gnome-compiz-manager (會不穩定)。
三、ATI 顯卡開啟特效
我是用 ATI Mobility Radeon X1450 的晶片，預設沒辦法開啟 Compiz Fusion，但安裝內建的驅動加上 xserver-xgl 套件即可。

但是裝了 xserver-xgl 之後，特效雖然開了，SCIM 輸入法卻也掛點了，完全沒辦法打中文，幸好 Ubuntu 正體中文站 有人找到了解決方法。
選擇功能表 系統 [...]]]></description>
			<content:encoded><![CDATA[<p>最新版的 <a href="http://www.ubuntu.com/" target="_blank">Ubuntu 7.10 Gutsy Gibbon</a>，終於在 2007 年 10 月 18 日下午正式發佈囉！這次沒聽說塞爆伺服器的情形發生了，大多順利下載完成，我也馬上拿出 NB 來全新安裝，裝完進到桌面的感想是：比以前更順了，安裝和使用大致上也沒什麼問題，不過筆電是 ATI X1450 的顯示晶片，要啟動 Compiz Fusion 特效還是麻煩了些。</p>
<p><strong>一、啟動 Compiz Fusion 桌面特效</strong><br />
在新版中，如果顯卡驅動沒問題並且有支援，預設就會啟動特效，如果要手動更改可到 <em>偏好設定 -> 外觀設定 -> Visual Effects</em> 設定。</p>
<p><strong>二、安裝 Compiz Fusion 管理工具</strong><br />
新版中設定 Compiz Fusion 特效要安裝 compizconfig-settings-manager，不要使用 gnome-compiz-manager (會不穩定)。</p>
<p><strong>三、ATI 顯卡開啟特效</strong><br />
我是用 ATI Mobility Radeon X1450 的晶片，預設沒辦法開啟 Compiz Fusion，但安裝內建的驅動加上 xserver-xgl 套件即可。<br />
<a href='http://blog.linym.net/wp-content/uploads/2007/10/01jpg.jpg' title=''><img src='http://blog.linym.net/wp-content/uploads/2007/10/01jpg.jpg' alt='driver' width="500" /></a></p>
<p>但是裝了 xserver-xgl 之後，特效雖然開了，SCIM 輸入法卻也掛點了，完全沒辦法打中文，幸好 <a href="http://www.ubuntu.org.tw/modules/newbb/viewtopic.php?viewmode=flat&#038;type=&#038;topic_id=6465&#038;forum=2" target="_blank">Ubuntu 正體中文站</a> 有人找到了解決方法。<br />
選擇功能表 系統  -> 偏好設定 -> 作業階段 -> 初始啟動程式 -> 新增 -> 名稱（SCIM）→ 指令（scim) ，重新啟動即可。</p>
<p><del datetime="2007-10-27T16:48:16+00:00">ps. 據說官方即將釋出 8.42 驅動，預設就可以支援特效，敬請期待！</del><br />
<a href="http://ati.amd.com/support/drivers/linux/linux-radeon.html" target="_blank">8.42.3</a> 版的 Linux 驅動已釋出，但許多人試用的感想都不太理想，因此如果要開啟 compiz 特效，建議還是使用上面的方法。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/201/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 懶人包 - Lazybuntu 正式版發佈</title>
		<link>http://blog.linym.net/archives/199</link>
		<comments>http://blog.linym.net/archives/199#comments</comments>
		<pubDate>Sat, 20 Oct 2007 16:47:55 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[系統筆記]]></category>
		<category><![CDATA[軟體筆記]]></category>
		<category><![CDATA[Lazybuntu]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[軟體]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/199</guid>
		<description><![CDATA[由 PCMan 所發起的 Ubuntu 懶人包 - Lazybuntu 終於正式發佈囉！剛好趕上 Ubuntu 7.10 的發行 ，正式版號為 0.1，強調 3個步驟，搞定你的 Ubuntu，Ubuntu 安裝完後，再使用 Lazybuntu，就能讓你的 Ubuntu 更好用，省去了麻煩的調校設定工作，值得 Ubuntu 新手或愛用者試試！

]]></description>
			<content:encoded><![CDATA[<p>由 PCMan 所發起的 Ubuntu 懶人包 - <a href="http://lazybuntu.openfoundry.org/" target="_blank">Lazybuntu</a> 終於正式發佈囉！剛好趕上 <a href="http://releases.ubuntu.com/releases/7.10/" target="_blank">Ubuntu 7.10</a> 的發行 ，正式版號為 0.1，強調 <strong>3個步驟，搞定你的 Ubuntu</strong>，Ubuntu 安裝完後，再使用 <a href="http://lazybuntu.openfoundry.org/" target="_blank">Lazybuntu</a>，就能讓你的 Ubuntu 更好用，省去了麻煩的調校設定工作，值得 Ubuntu 新手或愛用者試試！<br />
<a href='http://blog.linym.net/wp-content/uploads/2007/10/lazybuntu_screenshot.png' title=''><img src='http://blog.linym.net/wp-content/uploads/2007/10/lazybuntu_screenshot.png' alt='Lazybuntu' width="500" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/199/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>在嵌入式 Linux 架設 Boa Webserver</title>
		<link>http://blog.linym.net/archives/180</link>
		<comments>http://blog.linym.net/archives/180#comments</comments>
		<pubDate>Tue, 18 Sep 2007 10:16:13 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[boa]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/180</guid>
		<description><![CDATA[Boa 是一套小型的網頁伺服器，很適合應用在 Embedded System 上，並且內建就可以直接支援以 C 寫的 CGI 網頁，這篇是移植 Boa 到 ARM9 S3C2410 平台的過程，Linux 版本為 2.6.17.4，使用 arm-linux toolchain 3.4.1 編譯。
1. 產生 Makefile
下載 Source code 並解壓縮進到 src 目錄。
# ./configure --host=arm-linux
2. 修改 Makefile 使用跨平台編譯
CC = arm-linux-gcc
CPP = arm-linux-gcc -E
# make (如果編譯或執行時有錯誤請看Q&#038;A)
# arm-linux-strip boa
3. 配置 Boa
可以在源碼目錄找到這個設定檔，放到 /etc/boa 裡面，有修改的部份如下：
User 0
Group 0
#DirectoryMaker /usr/lib/boa/boa_indexer
CGIPath /bin:/usr/bin:/var/www/cgi-bin
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
然後需要放一個 mime.types 檔案在 /etc，我是直接複製 ubuntu [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.boa.org/" target="_blank">Boa</a> 是一套小型的網頁伺服器，很適合應用在 Embedded System 上，並且內建就可以直接支援以 C 寫的 CGI 網頁，這篇是移植 Boa 到 ARM9 S3C2410 平台的過程，Linux 版本為 2.6.17.4，使用 arm-linux toolchain 3.4.1 編譯。</p>
<p><strong>1. 產生 Makefile</strong><br />
下載 Source code 並解壓縮進到 src 目錄。<br />
# ./configure --host=arm-linux</p>
<p><strong>2. 修改 Makefile 使用跨平台編譯</strong><br />
CC = <span style="color:blue">arm-linux-</span>gcc<br />
CPP = <span style="color:blue">arm-linux-</span>gcc -E<br />
# make (如果編譯或執行時有錯誤請看Q&#038;A)<br />
# arm-linux-strip boa</p>
<p><strong>3. 配置 Boa</strong><br />
可以在源碼目錄找到這個設定檔，放到 /etc/boa 裡面，有修改的部份如下：<br />
User 0<br />
Group 0<br />
#DirectoryMaker /usr/lib/boa/boa_indexer<br />
CGIPath /bin:/usr/bin:/var/www/cgi-bin<br />
ScriptAlias /cgi-bin/ /var/www/cgi-bin/</p>
<p>然後需要放一個 <a href='http://blog.linym.net/wp-content/uploads/2007/09/mime.zip' title='mime.zip'>mime.types</a> 檔案在 /etc，我是直接複製 ubuntu 裡的檔案。</p>
<p><strong>4. 加入 boa 執行檔</strong><br />
將編譯好的 boa 執行檔加入檔案系統 /bin，要啟動 server 只要輸入 boa 即可，可到 /var/log/boa 查看 log。</p>
<p><strong>問題 Q&#038;A：</strong><br />
<span id="more-180"></span><br />
<strong>Q：使用 toolchain 3.4.1 編譯出現錯誤</strong><br />
arm-linux-gcc  -g -O2 -pipe -Wall -I.   -c -o util.o util.c<br />
util.c:100:1: pasting &quot;t&quot; and &quot;->&quot; does not give a valid preprocessing token<br />
make: *** [util.o] Error 1<br />
A：修改 src/compat.h<br />
找到<br />
#define TIMEZONE_OFFSET(foo) foo##->tm_gmtoff<br />
修改成<br />
#define TIMEZONE_OFFSET(foo) (foo)->tm_gmtoff</p>
<p><strong>Q：執行 boa 出現 &quot;gethostbyname::No such file or directory&quot;</strong><br />
A：需將 boa.conf 裡的 ServerName 開頭註解拿掉</p>
<p><strong>Q：無法啟動 Boa，error log 顯示 &quot;boa.c:266.icky Linux kernel bug!:No such file&quot;</strong><br />
A：修改 src/boa.c，將底下判斷式註解掉：<br />
/*if (setuid(0) != -1) {<br />
    DIE(&quot;icky Linux kernel bug!&quot;);<br />
}*/<br />
重新編譯</p>
<p><strong>Q：無法啟動 Boa，error log 顯示 &quot;boa.c:211 - getpwuid....略&quot;</strong><br />
A：修改 src/boa.c，將底下兩個判斷式註解掉：<br />
/*if (passwdbuf == NULL) {<br />
    DIE(&quot;getpwuid&quot;);<br />
}<br />
if (initgroups(passwdbuf->pw_name, passwdbuf->pw_gid) == -1) {<br />
    DIE(&quot;initgroups&quot;);<br />
}*/<br />
重新編譯</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/180/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>S3C2410 RTC Driver 問題</title>
		<link>http://blog.linym.net/archives/179</link>
		<comments>http://blog.linym.net/archives/179#comments</comments>
		<pubDate>Mon, 17 Sep 2007 16:54:04 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/179</guid>
		<description><![CDATA[在 Linux 系統中的時鐘，可分為硬體時鐘及系統時鐘。硬體時鐘可以依賴輔助電源(電池)持續累計時間；而系統時鐘則每次重新啟動就會重置，所以一般 Linux 在開機時會做個和硬體時鐘同步的動作(hwclock -s)，但是在 Embedded Linux 中是要手動操作的。
首先必須正確驅動 S3C2410 的 RTC(Real-Time Clock) 模組才能使用 hwclock 指令，Linux 2.6.10 版本之後應該都有內建驅動，不過在 2.6.14.7 版本中有些問題，會跑出 Segmentation fault 訊息，需要作以下修改。
1. 重新編譯 Kernel 選項 
    # make menuconfig
    在 Device Drivers ---> Character devices --->
    < > Enhanced Real Time Clock Support (不要選擇)
  [...]]]></description>
			<content:encoded><![CDATA[<p>在 Linux 系統中的時鐘，可分為硬體時鐘及系統時鐘。硬體時鐘可以依賴輔助電源(電池)持續累計時間；而系統時鐘則每次重新啟動就會重置，所以一般 Linux 在開機時會做個和硬體時鐘同步的動作(hwclock -s)，但是在 Embedded Linux 中是要手動操作的。</p>
<p>首先必須正確驅動 S3C2410 的 RTC(Real-Time Clock) 模組才能使用 hwclock 指令，Linux 2.6.10 版本之後應該都有內建驅動，不過在 2.6.14.7 版本中有些問題，會跑出 Segmentation fault 訊息，需要作以下修改。</p>
<p><strong>1. 重新編譯 Kernel 選項 </strong><br />
    # make menuconfig<br />
    在 Device Drivers ---> Character devices ---><br />
    < > Enhanced Real Time Clock Support (不要選擇)<br />
    [*] S3C2410 RTC Driver</p>
<p><strong>2. 修改 arch/arm/mach-s3c2410/mach-smdk2410.c</strong><br />
在 struct platform_device *smdk2410_devices[] 當中加入 <strong>&#038;s3c_device_rtc,</strong>，這個結構已經在 arch/arm/mach-s3c2410/devs.c 定義，應該是忘記加了，修改好後再編譯即完成。</p>
<p><strong>3. 確認驅動載入</strong><br />
Driver 有正確載入開機應該會有<br />
S3C2410 RTC, (c) 2004 Simtec Electronics<br />
s3c2410-rtc s3c2410-rtc: rtc disabled, re-enabling<br />
並且有 /dev/misc/rtc 裝置</p>
<p><strong>4. 使用 hwclock</strong><br />
先利用 date 指令調整好系統時間，再用 hwclock -w 寫入硬體時鐘，往後開機只要自動執行用 hwclock -s 即可抓到正確的時間囉！</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/179/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux 自動配置主設備號</title>
		<link>http://blog.linym.net/archives/176</link>
		<comments>http://blog.linym.net/archives/176#comments</comments>
		<pubDate>Sat, 08 Sep 2007 16:58:58 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[driver]]></category>
		<category><![CDATA[驅動程式]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/176</guid>
		<description><![CDATA[在撰寫 Linux 設備驅動程式的時候，如果指定主設備號(MAJOR)為 0，就可以利用 alloc_chrdev_region() 函式讓系統自動分配一個可用 MAJOR 給裝置，程式片段：

#define DEV_NAME "LED" //設備名稱
int DEV_MAJOR = 0; //主設備號
int DEV_MINOR = 0; //次設備號
int count = 1;
dev_t led_dev;
/*  Dynamic assign major */
result = alloc_chrdev_region(&#038;led_dev, DEV_MAJOR, count, DEV_NAME);
DEV_MAJOR = MAJOR(led_dev);

這樣驅動寫好後載入核心執行，就會分配到一個 MAJOR，可利用 cat /proc/devices 查看，但是如果要存取這個設備，還需要手動用 mknod 在 /dev 建立設備檔，但問題是怎麼知道分配到的設備號碼是什麼？這裡利用一個 shell script 搭配 awk 來達成。


#!/bin/sh
module = &#34;LED&#34; // /proc/device 顯示的名稱
device = &#34;LED&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>在撰寫 Linux 設備驅動程式的時候，如果指定主設備號(MAJOR)為 0，就可以利用 alloc_chrdev_region() 函式讓系統自動分配一個可用 MAJOR 給裝置，程式片段：</p>
<pre>
#define DEV_NAME "LED" //設備名稱
int DEV_MAJOR = 0; //主設備號
int DEV_MINOR = 0; //次設備號
int count = 1;
dev_t led_dev;
/*  Dynamic assign major */
result = alloc_chrdev_region(&#038;led_dev, DEV_MAJOR, count, DEV_NAME);
DEV_MAJOR = MAJOR(led_dev);
</pre>
<p>這樣驅動寫好後載入核心執行，就會分配到一個 MAJOR，可利用 cat /proc/devices 查看，但是如果要存取這個設備，還需要手動用 mknod 在 /dev 建立設備檔，但問題是怎麼知道分配到的設備號碼是什麼？這裡利用一個 shell script 搭配 awk 來達成。</p>
<pre title="code" class="c">

#!/bin/sh
module = &quot;LED&quot; // /proc/device 顯示的名稱
device = &quot;LED&quot; // /dev 要建立的設備檔名稱

major=`cat /proc/devices | awk &quot;\\$2==\&quot;$module\&quot; {print \\$1}&quot;`
mknod /dev/$device c $major 0 //建立字元設備
</pre>
<p>然後只要將這個 script 檔案設成啟動時執行就可以囉！</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/176/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux 下透過 GPRS 上網</title>
		<link>http://blog.linym.net/archives/171</link>
		<comments>http://blog.linym.net/archives/171#comments</comments>
		<pubDate>Fri, 24 Aug 2007 16:14:10 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[系統筆記]]></category>
		<category><![CDATA[GPRS]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[PPP]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/171</guid>
		<description><![CDATA[基本需求：

可連上 GPRS 的硬體設備
編譯 Kernel 使其支援 PPP
擁有 pppd、chat 兩個程式
PPP 連線的 script 檔案

1. 可連上 GPRS 的硬體設備
可以是專用的 GPRS Modem 或是手機，不過當然要先配置好相關設定及驅動，我是使用 Wavecom Q2403A 這個 GSM/GPRS 模組透過 com port 來實驗。
2. 編譯 Kernel 使其支援 PPP
# make menuconfig
選擇 Device Drivers ---> Network device support ---> PPP (point-to-point protocol) support，底下的子項目如果不確定就全選即可。
核心更新後請檢查 /dev/ppp 是否存在，若無可用 mknod /dev/ppp c 108 0 建立。
3. 擁有 pppd、chat 兩個程式
如果是一般 PC 版本應該都已經有內建了；Embedded [...]]]></description>
			<content:encoded><![CDATA[<p><strong>基本需求：</strong></p>
<ul>
<li>可連上 GPRS 的硬體設備</li>
<li>編譯 Kernel 使其支援 PPP</li>
<li>擁有 pppd、chat 兩個程式</li>
<li>PPP 連線的 script 檔案</li>
</ul>
<p><strong>1. 可連上 GPRS 的硬體設備</strong><br />
可以是專用的 GPRS Modem 或是手機，不過當然要先配置好相關設定及驅動，我是使用 Wavecom Q2403A 這個 GSM/GPRS 模組透過 com port 來實驗。</p>
<p><strong>2. 編譯 Kernel 使其支援 PPP</strong><br />
# make menuconfig<br />
選擇 Device Drivers ---> Network device support ---> PPP (point-to-point protocol) support，底下的子項目如果不確定就全選即可。<br />
核心更新後請檢查 /dev/ppp 是否存在，若無可用 mknod /dev/ppp c 108 0 建立。</p>
<p><strong>3. 擁有 pppd、chat 兩個程式</strong><br />
如果是一般 PC 版本應該都已經有內建了；<del datetime="2007-09-16T01:38:33+00:00">Embedded 平台則可以考慮使用 busybox，裡面也有包含這兩個程式；</del>再不然就自行下載 <a href="http://ppp.samba.org/ppp/download.html" target="_blank">source code</a> 來編譯。</p>
<p><strong>4. PPP 連線的 script 檔案</strong><br />
建立 script 來做 PPP 連線，通常可以在 /usr/share/doc/ppp/examples/scripts 底下找到 ppp-on、ppp-off、ppp-on-dialer 三個範例檔案，不過用範例檔的設定不一定能成功，請參考<a href="http://blog.linym.net/wp-content/uploads/2007/08/gprs.zip">我的檔案</a>，已測試中華電信可以成功。</p>
<p>相關的設定及原理可以參考：</p>
<ul>
<li><a href="http://tldp.org/HOWTO/PPP-HOWTO/">Linux PPP HOWTO</a> (另有<a href="http://linux.cis.nctu.edu.tw/chinese/how-to/PPP-HOWTO.html">中譯版</a>)</li>
<li><a href="http://wiki.openmoko.org/wiki/Manually_using_GPRS">Manually using GPRS</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/171/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache mod_rewrite (Ubuntu)</title>
		<link>http://blog.linym.net/archives/119</link>
		<comments>http://blog.linym.net/archives/119#comments</comments>
		<pubDate>Sat, 03 Feb 2007 10:55:13 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://lym.fyman.idv.tw/blog/archives/119</guid>
		<description><![CDATA[要使用 mod_rewrite 模組在 Ubuntu 中是非常容易的，如果安裝 Ubuntu 時有順便裝 LAMP，那其實 mod_rewrite 就已經編譯好了，只需要將它載入即可。
所有可載入的模組和設定可以在 /etc/apache2/mods-available 找到，之後只要作個 Link 到 mods-enabled 目錄即可使用。
但是不需要這麼麻煩，因為有 a2enmod、a2dismod、a2ensite、a2dissite，這些指令可以更方便的載入、關閉模組，例如想要開啟 rewrite 只要鍵入：
sudo a2enmod rewrite
sudo /etc/init.d/apache2 restart
就可以了
]]></description>
			<content:encoded><![CDATA[<p>要使用 mod_rewrite 模組在 Ubuntu 中是非常容易的，如果安裝 Ubuntu 時有順便裝 LAMP，那其實 mod_rewrite 就已經編譯好了，只需要將它載入即可。</p>
<p>所有可載入的模組和設定可以在 <strong>/etc/apache2/mods-available </strong>找到，之後只要作個 Link 到 mods-enabled 目錄即可使用。<br />
但是不需要這麼麻煩，因為有 a2enmod、a2dismod、a2ensite、a2dissite，這些指令可以更方便的載入、關閉模組，例如想要開啟 rewrite 只要鍵入：</p>
<blockquote><p>sudo a2enmod rewrite<br />
sudo /etc/init.d/apache2 restart</p></blockquote>
<p>就可以了</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/119/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>安裝 SQLite (For Linux)</title>
		<link>http://blog.linym.net/archives/61</link>
		<comments>http://blog.linym.net/archives/61#comments</comments>
		<pubDate>Mon, 16 Jan 2006 16:40:52 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[SQLite]]></category>
		<category><![CDATA[架站]]></category>

		<guid isPermaLink="false">http://lym.fyman.idv.tw/blog/archives/61</guid>
		<description><![CDATA[我的 Linux 是 Fedora Core 4 (FC4)，其 RPM 套件的 PHP 版本是 5.0.4，並沒有將 SQLite 模組包含進去，所以只好另外手動安裝。
1. 下載 SQLite
$ wget http://pecl.php.net/get/SQLite-1.0.3.tgz
2. 解壓縮，開始編譯 ※如找不到 phpize 請安裝「php-devel」套件
$ tar zxvf SQLite-1.0.3.tgz
$ cd SQLite-1.0.3
$ phpize
$ ./configure
$ make
3. 如果編譯錯誤需修改 sqlite.c 檔案
找到：
static unsigned char arg3_force_ref[] = {3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
將它註解掉：
/* static unsigned char arg3_force_ref[] = {3, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; */
找到：
function_entry sqlite_functions[] = [...]]]></description>
			<content:encoded><![CDATA[<p>我的 Linux 是 Fedora Core 4 (FC4)，其 RPM 套件的 PHP 版本是 5.0.4，並沒有將 SQLite 模組包含進去，所以只好另外手動安裝。<br />
<strong>1. 下載 SQLite</strong><br />
$ wget http://pecl.php.net/get/SQLite-1.0.3.tgz</p>
<p><strong>2. 解壓縮，開始編譯</strong> ※如找不到 phpize 請安裝「php-devel」套件<br />
$ tar zxvf SQLite-1.0.3.tgz<br />
$ cd SQLite-1.0.3<br />
$ phpize<br />
$ ./configure<br />
$ make</p>
<p><strong>3. 如果編譯錯誤需修改 sqlite.c 檔案</strong><br />
找到：<br />
static unsigned char arg3_force_ref[] = {3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };</p>
<p>將它註解掉：<br />
/* static unsigned char arg3_force_ref[] = {3, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; */</p>
<p>找到：<br />
function_entry sqlite_functions[] = {<br />
PHP_FE(sqlite_open, arg3_force_ref)<br />
PHP_FE(sqlite_popen, arg3_force_ref)</p>
<p>替換為：<br />
function_entry sqlite_functions[] = {<br />
PHP_FE(sqlite_open, third_arg_force_ref)<br />
PHP_FE(sqlite_popen, third_arg_force_ref)</p>
<p><strong>4. 重新編譯及安裝</strong><br />
$ make<br />
$ make install</p>
<p><strong>5. 建立 sqlite.ini 將 SQLite 載入 PHP</strong><br />
$ vi /etc/php.d/sqlite.ini</p>
<p>加入以下內容並存檔離開：<br />
; Enable sqlite extension module<br />
extension=sqlite.so</p>
<p><strong>6. 重新啟動 Apache</strong><br />
service httpd restart</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/61/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>iptables 防火牆規則</title>
		<link>http://blog.linym.net/archives/97</link>
		<comments>http://blog.linym.net/archives/97#comments</comments>
		<pubDate>Fri, 13 Jan 2006 10:11:00 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[防火牆]]></category>

		<guid isPermaLink="false">http://lym.fyman.idv.tw/blog/archives/97</guid>
		<description><![CDATA[還原規則：iptables-restore &#60; 檔案名稱

*filter
:FORWARD ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [355059:275915118]
# 接受確認連線
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
# 接受 loopback 連線
-A INPUT -i lo -j ACCEPT
# 接受 icmp 封包
-A INPUT -p icmp -j ACCEPT
# 本機特定服務
-A INPUT -p tcp -m tcp --dport 20:21 -j ACCEPT # FTP
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT # [...]]]></description>
			<content:encoded><![CDATA[<p>還原規則：<em>iptables-restore &lt; 檔案名稱</em></p>
<pre>
*filter
:FORWARD ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [355059:275915118]
# 接受確認連線
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
# 接受 loopback 連線
-A INPUT -i lo -j ACCEPT
# 接受 icmp 封包
-A INPUT -p icmp -j ACCEPT
# 本機特定服務
-A INPUT -p tcp -m tcp --dport 20:21 -j ACCEPT # FTP
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT # SSH
-A INPUT -p tcp -m tcp --dport 53 -j ACCEPT # DNS
-A INPUT -p udp -m udp --dport 53 -j ACCEPT # DNS
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT # HTTP
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT # HTTPS
-A INPUT -p tcp -m tcp --dport 65400:65500 -j ACCEPT # FTP PASV
# 其餘全部封殺
-A INPUT -j DROP
COMMIT
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/97/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fedora Core 的 Bind 路徑</title>
		<link>http://blog.linym.net/archives/5</link>
		<comments>http://blog.linym.net/archives/5#comments</comments>
		<pubDate>Mon, 15 Nov 2004 02:08:37 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[系統筆記]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[fedora]]></category>

		<guid isPermaLink="false">http://lym.fyman.idv.tw/blog/archives/5</guid>
		<description><![CDATA[在 Fedora Core 的 Bind 設定檔路徑和以往不太一樣，全部都移到了chroot 目錄底下，以提高安全性，底下是變更後的檔案位置：
named.conf
原始： /etc/named.conf
更改為： /var/named/chroot/etc/named.conf
根網域記錄檔
原始： /var/named/named.ca
更改為： /var/named/chroot/var/named/named.ca
正反解記錄檔
原始： /var/named/
更改為： /var/named/chroot/var/named/
接著啟動 named 後您的 DNS Server 就可以正常運作囉!!
]]></description>
			<content:encoded><![CDATA[<p>在 Fedora Core 的 Bind 設定檔路徑和以往不太一樣，全部都移到了chroot 目錄底下，以提高安全性，底下是變更後的檔案位置：</p>
<p><strong>named.conf</strong><br />
原始： /etc/named.conf<br />
更改為： /var/named/chroot/etc/named.conf</p>
<p><strong>根網域記錄檔</strong><br />
原始： /var/named/named.ca<br />
更改為： /var/named/chroot/var/named/named.ca</p>
<p><strong>正反解記錄檔</strong><br />
原始： /var/named/<br />
更改為： /var/named/chroot/var/named/</p>
<p>接著啟動 named 後您的 DNS Server 就可以正常運作囉!!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/5/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
