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

2009年8月28日 星期五

Hacking D-Link AP


由於D-Link產品乃修改自Linux,基本上就是個Embedded Linux System,在Windows下開發應該是不可能的,因此開發環境選用Linux,建議要有一定的Linux使用及操作經驗,才不會在開發過程中花很多的時間在環境配置或找指令,更甚者,花了很多時間卻不知自己身在幹麻。

沒有Linux使用經驗的朋友,建議使用虛擬機器軟體建立Linux環境先熟悉一下Linux環境及玩法,以利開發及使用,使用虛擬機器好處是不需要解決Linux + Windows的雙系統安裝問題,以及可能因安裝失敗以致毀掉重要資料帶來的身心傷害

常見的虛擬機器軟體有:VirtualboxVMWareMicrosoft Virtual PC … 等,推薦使用Virtualbox,優點除了是自由軟體外,還很好吃呢,安裝方便、輕巧且耗費的資源少、模擬環境的效能還不錯。

建議初學者先看看鳥哥的Linux私房菜這個網站,資料很多很豐富,可建立許多基本概念,另外,也建議先學會操作vimshell commandvim是一套Linux上文字介面的text editor,有著強大的功能(請見參考文件),各大發行版(distribution)都有它的蹤跡,學會了到處都可以用,若不習慣沒滑鼠及GUI的日子,還有圖形化版本可選用(Gvim)shell command是操作Linux的基本功,使用Linux卻不會shell command會帶來很多的不便,而且無法進行開發工作這對身為專業的資訊人員來說是不允許滴

Last but not leastLinuxWindows有著截然不同的設計哲學及系統架構,they are differentLinux並非Windows的低價取代品,因此許多方面的比較是毫無意義的,Linux不會比Windows難用,只是你跟它不熟罷了,所以請當做自己在學習一個新東西(事實上確實是如此),就如同當年你與Windows 95初次見面一般。

說明文件中的開發環境
OSUbuntu 9.04
gccgcc 4.1
EditorVIM

References
Linux learning: 鳥哥的Linux 私房菜
Embedded linux: Free Electrons
C programming under linux: die.net,


開發環境設定
ubuntu上開發請先安裝下列軟體,若在其它distribution開發也可以檢查這些套件是否已經安裝在系統中了。
Packagebisonflexbuild-essentialpatchlibncurses5-devzlib1-devlibssl-devgcc-4.1

D-Link產品的source code可在http://tsd.dlink.com.tw/下載。

修改以下兩個設定
*Relink /bin/sh -> /bin/bash (/bin/dash originally, that cause error)
$ sudo rm /bin/sh
$ sudo ln -s /bin/bash /bin/sh

*Relink /usr/bin/gcc -> /usr/bin/gcc-4.1 (/usr/bin/gcc-4.3 originally, that cause error)
Ubuntu 9.04gcc版本為4.3,在compile過程中會很盡責的回報一堆bug,有些bug根本就不知從何著手XD,後來換成gcc 4.1才順利compile完成,推測D-Link可能原就是使用gcc 4.1compile
安裝gcc 4.1(無需移除gcc 4.3)
$ sudo apt-get install gcc-4.1

將系統中的gcc指令改為指向gcc 4.1
$ sudo rm /usr/bin/gcc
$ sudo ln -s /usr/bin/gcc-4.1 /usr/bin/gcc


Source Code Compilation
以下的tarball本文測試時使用的版本,請勿直接套用名稱,會無法使用。另外,儘量不使用root權限,以免發生莫名其妙的error,除非因權限不足造成問題
*Extract source code tarball and enter the directory.
$ bzip -d DAP1353_v200_r0013_2007-09-26.tar.bz2
$ tar -zvf DAP1353_v200_r0013_2007-09-26.tar
$ cd DAP1353

*Execute the "build_tool_chain.sh",請先看readme,有些選項要手動設定
$ sh build_tool_chain.sh

If permission error occurred, run this script as root
重要:重run前先刪除當前目錄下buildroot目錄,不然作到死都不會成功的XD,因為script會先判斷這個目錄是否存在
$ rm -rv buildroot
$ sudo sh build_tool_chain.sh

*Compile source code
第一次compile分別執行3make,若在前一步驟使用root權限,在此亦使用root權限。Compile成功後會產生image檔,放在當前目錄的images目錄下。

*使用image
唯一的方法就是使用網頁介面(192.168.0.1;帳號:admin、密碼:無)中上傳功能(維護 => 韌體更新),選取正確的image並上傳。

2009年7月14日 星期二

vsftp - FTP Server輕鬆架

由於工作上的需要,因此想在辦公室的電腦上架FTP,當然使用者只有我自己啦XD
而我裝的套件是vsftp,環境是Ubuntu 9.04

首先呢,當然就是安裝套件囉
$ sudo apt-get install vsftpd
OK,這樣就安裝完了,接下來就到了設定的步驟了。
有幾個檔案是vsftpd的相關設定檔:
/etc/vsftpd.conf
/etc/vsftpd.chroot_list

先說/etc/vsftpd.conf,這是vsftpd的主要設定檔,檔案中其實已有相當詳細的註解了。
所以在此僅提出幾個常用的設定
特別注意:修改設定檔前請先備份

# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
是否允許任意使用者連線,由於我只想給自己使用,所以設為NO

# Uncomment this to allow local users to log in.
local_enable=YES
是否允許本機使用者登入FTP,我使用自己的帳號登入,所以設為YES

# Uncomment this to enable any form of FTP write command.
write_enable=YES
是否開放寫入的權限,我的需求是下載及上傳資料,所以需要寫入的權限,設為YES

chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
這三個就有趣了,所以一起上XD
PS:chroot,就是讓使用者變換根目錄的功能,在登入FTP Server時,預設根目錄為使用者的home directory

chroot_local_user=YES
chroot_list_enable=YES
這樣的設定,讓所有使用者無法變換根目錄,除了/etc/vsftpd.chroot_list中所列的使用者

以上,如有錯誤請各位不吝指正,謝謝。

2009年6月3日 星期三

Foxit Reader - 輕巧好用的PDF Reader

Foxit是PDF Reader後起之秀,用過的人相信都對它輕巧快速留下了深刻,不過可惜的是Foxit一開始Release的Linux版本非常的難用,不僅如此還難以安裝,這麼好的程式卻無法在Linux使用實在是令人相當的懊腦,於是在下三不五時就會到Foxit的官網上晃晃並期待奇蹟的出現 ...

終於有一天 ... 奇蹟真的發生了 !! 有圖有真相 !!


不僅如此,同時亦提供多種package任君選擇(~淚)。


這是裝好後開啟的模樣


重點來了,中文顯示是否正常呢?會不會出現碎字呢?


再近一點看

人客阿~你還在用肥腦油腸的Adobe嗎?試試輕巧的Foxit吧 !

下台一鞠躬 !

PS:補上Linux下載的聯結,因為不是很好找
Foxit for Linux Desktop

2009年2月28日 星期六

root權限開啟tab命令補全功能

剛安裝好Debian時root並沒有開啟tab命令補全, 而一般使用者則有開啟這項功能,
所以我的想法是, 就到使用者的 .bashrc 看看

以下就是開啟tab命令補全的code, 只要寫入 /root/.bashrc 裡便可以使用了.
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi

喔, 對了, 當您使用root權限做這件事時, 在bash中登出root再登入便可以了.

2009年2月15日 星期日

Linux的回憶

使用Linux也一小段時間了,

都忘了是怎麼開始的, 只記得第一個使用的發行版是Mandrake 9.x(現已更名為Mandriva)
好久了, 7 年前了(茶) ...
那時興沖沖的買了一本薄薄的書(忘了叫什麼),
蠻大本的, 而且裡面僅僅介紹如何安裝以及少量的GUI操作, 僅此而已

這本書帶給我相當大的挫敗感, 只記得當年安裝不下數十次均告失敗 ...
上網查了老半天發現不只我有相同的困擾,
更令人難以忘懷的是安裝失敗的原因竟在於書商所提供的安裝光碟根本就是壞的
Orz ...

幾經波折後竟也讓我裝起來了, 看到登入畫面時那股感動至今難以忘懷(淚)
就這樣, Linux與我碰出了小小的火花, 在心中留下難以抹滅的光芒 ...

2007年10月12日 星期五

Ubuntu 7.04 - the Feisty Fawn 的 source.list

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.

deb http://tw.archive.ubuntu.com/ubuntu/ feisty main restricted
deb-src http://tw.archive.ubuntu.com/ubuntu/ feisty main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://tw.archive.ubuntu.com/ubuntu/ feisty-updates main restricted
deb-src http://tw.archive.ubuntu.com/ubuntu/ feisty-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://tw.archive.ubuntu.com/ubuntu/ feisty universe
deb-src http://tw.archive.ubuntu.com/ubuntu/ feisty universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://tw.archive.ubuntu.com/ubuntu/ feisty multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu/ feisty multiverse

## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://tw.archive.ubuntu.com/ubuntu/ feisty-backports main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu/ feisty-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu feisty-security main restricted
deb-src http://security.ubuntu.com/ubuntu feisty-security main restricted
deb http://security.ubuntu.com/ubuntu feisty-security universe
deb-src http://security.ubuntu.com/ubuntu feisty-security universe
deb http://security.ubuntu.com/ubuntu feisty-security multiverse
deb-src http://security.ubuntu.com/ubuntu feisty-security multiverse

## Automatix2
deb http://www.getautomatix.com/apt feisty main

#AUTOMATIX REPOS START

deb http://archive.canonical.com/ubuntu feisty-commercial main

deb http://archive.ubuntu.com/ubuntu feisty-updates universe multiverse

deb http://archive.ubuntu.com/ubuntu feisty-security main restricted universe multiverse
#AUTOMATIX REPOS END

# Compiz Fusion
deb http://download.tuxfamily.org/3v1deb feisty eyecandy
deb-src http://download.tuxfamily.org/3v1deb feisty eyecandy

Beep Media Player 播放 .ape 檔案

Beep Media Player 原先是無法播放 .ape 檔案的, Windows 下一堆 player 都可以 .... = =
不過使用Beep Media Player 的朋友們現在總算可以稍稍寬寬心了, .ape 檔案播放不再是令人心碎的一件事了

Mac i386 Deb包

BMP 擴充元件安裝

好感動 ......

不過 ... cue檔仍無解 Orz

PS: 參考自181 Works with PixnetUbuntu 與 ape的相遇

2007年7月19日 星期四

Asus W3J 音效卡問題解決

小弟的Notebook是Asus W3J, 是3月2號購入的 , 入手之後其實就有一股衝動, 想把Ubuntu給塞進去, 但又擔心相容性的問題, 所以遲遲不敢動手 ....

終於在某一天, 我下定了決心, 速速的燒了Ubuntu 6.10就給他塞進去了, 沒想到不試則已, 一試驚人吶 !!!
Ubuntu 對於W3J的支援度簡直是無可挑剔 !!! 不僅安裝過程十分的順利, 連最難搞的ATI顯卡都沒讓我動手, 當下熊熊就有一股想流淚的感覺, 是洋蔥 ... 阿, 不是啦, 應該是: 為什麼要讓我用到Ubuntu阿 !!!! 我怕我以後再也用不到那麼好的Distribution阿 ....

好像有點離題了 XD

安裝好之後, 仍是有點小小的瑕疵
1. 休眠 = 死 , Orz ...
2. 沒聲音, 但系統確實是有抓到音效卡, 也安裝了Driver

其中, 第一項應該是無解的, 我google了好久, 就是沒看到有Solution, 甚至連Windows休眠都有人掛掉, 我想它這主機板應該可以叫"一鍵喪命板", 反正也沒啥大不了, 大不了就不休眠(華夫人 : 大不了不笑不走路 XD)

至於音效部份, 後來上了ALSA看了一下, 發現它的Driver應該是裝錯了(Intel High Definition Audio Driver應該是hda-intel)

好, 廢話不多說, 重新Compile Driver吧 !!

1. 到ALSA下載最新的Driver, 但要特別小心看更新日期最新是哪一個, 不要像我之前傻傻的, 想說版本號越多就新, 就越沒問題, 大錯特錯!! 就裝不起來 Orz

2. 開始安裝
$ sudo chmod a+x alsa-driver-x.x.x
$ bunzip2 alsa-driver-x.x.x
$ tar -xf alsa-driver-x.x.x
$ sudo ./configure --with-cards=hda-intel --with-sequencer=yes
$ sudo make
$ sudo make install
3. 重開機吧

打完收工
PS : Ubuntu 7.04 - the Feisty Fawn 也可以這樣做

2007年7月3日 星期二

Bluetooth 設定

在我剛裝好Ubuntu時Bluetooth Device是無法連接上電腦的, 需要在做一些設定.

1. 首先呢, 先看看該裝的東西是不是裝了
$ sudo apt-get install bluez-utils
2. 接著來看看哪些藍芽裝置已經連線了
$ hcitool dev
3. Scan可連線的藍芽裝置(如果失敗的話多試幾次, 也可以把藍芽裝置關掉再打開)
$ sudo hidd --search
如果這指令真的無效, 來來來, 再來一個看看(基本上這兩個指令都可以成功, 我試過了)
$ hcitool scan
再不然... 還有一個更麻煩的, 您需要知道裝置的Bluetooth Address
$ sudo hidd --connect aa:bb:cc:dd:ee:ff
連接成功的話應該會有類似的Message出現
Searching ...
Connecting to device aa:bb:cc:dd:ee:ff

基本上這樣就ok啦

我想您看到這裡時心中可能會出現一個想法, 那就是 - 每次開機就要在來一次, 麻煩透了, 是不是有可能開機後便自動連接呢 ?

恭喜你, 有的 !! 請繼續看下去吧

1. 我們需要修改一些檔案, 在修改前... 沒錯, 您又猜對了 !!! 備份一下先
$ sudo cp /etc/default/bluetooth /etc/default/bluetooth.backup
(我也有看過檔案名稱是 bluez-utils, 但我的不是)
2. 尋找一下類似這一行
HIDD_ENABLED=0
改成
HIDD_ENABLED=1


3. 找
HIDD_OPTIONS="--master --server"

改成
HIDD_OPTIONS="--connect aa:bb:cc:dd:ee:ff --server"
說明一下, 您會發現在這檔案中有一些些的說明如下 :
# to make hidd always use a particular interface, use something
# like this, substituting the bdaddr of the interface:
# HIDD_OPTIONS="-i AA:BB:CC:DD:EE:FF --server"
基本上意思就是說, 如果有些裝置是您一定會使用的, 可以修改該項目為
HIDD_OPTIONS="-i AA:BB:CC:DD:EE:FF --server"
但根我測試的結果, 失敗.
# remove '--master' if you're having trouble working with Ericsson
# T630 phones with hidd operational at the same time.
這是說, '--master'這參數可能會產生問題, 因此我是把這參數移掉啦, 但要不要是看你啦.

4. add HIDP to /etc/modules
$ echo hidp | sudo tee -a /etc/modules
大功告成

2007年2月3日 星期六

Ubuntu Dapper 6.06 Source List

####
# Dapper
####

# apt.ubtw

deb http://apt.ubuntu.org.tw/ubuntu dapper-updates main restricted universe multiverse
deb-src http://apt.ubuntu.org.tw/ubuntu dapper-updates main restricted universe multiverse
deb http://apt.ubuntu.org.tw/ubuntu dapper main universe multiverse restricted
deb-src http://apt.ubuntu.org.tw/ubuntu dapper main universe multiverse restricted

deb http://apt.ubuntu.org.tw/ubuntu dapper-backports main universe multiverse restricted
deb-src http://apt.ubuntu.org.tw/ubuntu dapper-backports main universe multiverse restricted

# deb http://apt.ubuntu.org.tw/ubuntu dapper-proposed main universe multiverse restricted
# deb-src http://apt.ubuntu.org.tw/ubuntu dapper-proposed main universe multiverse restricted

deb http://apt.ubuntu.org.tw/ubuntu dapper-security main restricted universe multiverse
deb-src http://apt.ubuntu.org.tw/ubuntu dapper-security main restricted universe multiverse


# ubtw
deb http://apt.ubuntu.org.tw ubtw/
deb http://apt.ubuntu.org.tw ubtw-dapper/
#deb http://apt.ubuntu.org.tw ubtw-testing/

# tw.archive
deb http://tw.archive.ubuntu.com/ubuntu/ dapper main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu/ dapper main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu/ dapper-updates main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu/ dapper-updates main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu/ dapper-backports main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu/ dapper-backports main restricted universe multiverse
#deb http://tw.archive.ubuntu.com/ubuntu/ dapper-proposed main restricted universe multiverse
#deb-src http://tw.archive.ubuntu.com/ubuntu/ dapper-proposed main restricted universe multiverse


# official security updates
deb http://security.ubuntu.com/ubuntu dapper-security main restricted universe multiverse
deb-src http://security.ubuntu.com/ubuntu dapper-security main restricted universe multiverse

2007年1月30日 星期二

Sun Java 6 install

今天無聊的到 Synaptic 套件管理程式亂晃了一下, 天阿, 沒想到 Sun Java 6 已經進到 Ubuntu 的套件庫中了, 真是神速阿 , 當下就給他安裝了一下

Step 1 :
到 Synaptic 套件管理程式中搜尋 sun
找到 sun-java6-bin, 就不客氣的給他打勾

有幾點要注意 :
1. sun-java6-doc 別安裝
因為在 Synaptic 下無法自動安裝此套件, 看它的說明說需自行從 sun 的網站下載
(迷之音 : 那這套件放這裡好玩的喔 !?)

2. sun-java6-font 別安裝
之前在我安裝了 sun-java5 時我裝了它, 結果在 Sun Java Control Panel 下會掉字, 就算解除安 裝了也沒用, 那時費了一番功夫才解決, 但我忘了記錄下來了, 如果有人知道就請告訴我吧.

anyway, 這次安裝後, 我到 Sun Java Control Panel 一看, 果然就沒掉字, 應該是它自行去抓取系統參數, 所以就沒有字型問題 (我自行安裝了些字型).

接下來就可以好整以暇的欣賞安裝畫面

Step 2 :
我本身不喜歡使用 GCJ, 沒為什麼, 純粹想把 Linux 下的 Java 開發環境弄得單純些, 免得將來找問題找到發瘋, 因此找到了一個指令
$ sudo update-alternatives --config java

之後就可以選擇系統中的 jre 來源, 真方便 !!!

Firefox 字型設定

會有這一篇的原因是我裝了新字型並且設定給系統使用, 但在啟動 firefox 後卻發現選單及部份的頁面文字依然故我, 仍是楷體字, 花了近一小時, 終於在 黑眼珠-Ubuntu 6.06(Dapper)字型設定 裡看到.

簡單的來說, 原本在 Ubuntu 6.06 中, /etc/font 下的
language-selector.con 是個錯誤的 link, 因為link的目的檔(none)不存在
language-selector.conf -> /usr/share/language-selector/fontconfig/none
應該這麼做 :
cd /etc/fonts
sudo rm language-selector.conf
sudo ln -s /usr/share/language-selector/fontconfig/zh_TW language-selector.conf
如此一來 Firefox 的字型就正常了

2007年1月12日 星期五

Gcin install

首先是安裝 gcin
$ sudo apt-get install gcin gcin-qt3-immodule im-switch

套件說明 :
gcin - 當然就是 gcin 主程式
gcin-qt3-immodule - 不知道
im-switch - 輸入法切換成式

接下來, 將 gcin 設為預設的輸入法
$ im-switch -s gcin

That`s so easy !!
如果有錯請指正, 多謝