參考 Implement DHCP client
增加dhcp request and inform packet的發送功能
dhcp.c
build on Ubuntu 12.04.1 with gcc 4.6.3
gcc dhcp.c
./a.out
輸入1發送dhcp discover
輸入3發送dhcp request
輸入8發送dhcp inform
2013年9月3日 星期二
2011年11月3日 星期四
如何將tcpdump移植到arm嵌入式系統
Follow http://read-and-thinking.blogspot.com/2009/06/tcpdumparm.html
下載
libpcap-1.1.1
tcpdump-4.1.1
build licpcap-1.1.1
1. 修改configure file
註解掉6901~6905
#if test -z "$with_pcap" && test "$cross_compiling" = yes; then
# { { echo "$as_me:$LINENO: error: pcap type not determined when cross-compiling; use --with-pcap=..." >&5
#echo "$as_me: error: pcap type not determined when cross-compiling; use --with-pcap=..." >&2;}
# { (exit 1); exit 1; }; }
#fi
註解掉7237~7241
# if test $ac_cv_linux_vers = unknown ; then
# { { echo "$as_me:$LINENO: error: cannot determine linux version when cross-compiling" >&5
#echo "$as_me: error: cannot determine linux version when cross-compiling" >&2;}
# { (exit 1); exit 1; }; }
# fi
./configure --host=arm-none-linux
確認Makefile的CC不是gcc而是你的cross compile的名字
就代表ok嚕
接下來
make
產生libpcap.so.1.1.1
就代表成功嚕
build tcpdump-4.1.1
1. 修改configure
註解掉 4411~4415
# if test $ac_cv_linux_vers = unknown ; then
# { { echo "$as_me:$LINENO: error: cannot determine linux version when cross-compiling" >&5
#echo "$as_me: error: cannot determine linux version when cross-compiling" >&2;}
# { (exit 1); exit 1; }; }
# fi
./configure --host=arm-none-linux
檢查是否成功的方式與上述相同
確認成功後
make
產生tcpdump
就代表成功嚕
可以用file看一下
file tcpdump
tcpdump: ELF 32-bit LSB executable, ARM, version 1, dynamically linked (uses shared libs), not stripped
下載
libpcap-1.1.1
tcpdump-4.1.1
build licpcap-1.1.1
1. 修改configure file
註解掉6901~6905
#if test -z "$with_pcap" && test "$cross_compiling" = yes; then
# { { echo "$as_me:$LINENO: error: pcap type not determined when cross-compiling; use --with-pcap=..." >&5
#echo "$as_me: error: pcap type not determined when cross-compiling; use --with-pcap=..." >&2;}
# { (exit 1); exit 1; }; }
#fi
註解掉7237~7241
# if test $ac_cv_linux_vers = unknown ; then
# { { echo "$as_me:$LINENO: error: cannot determine linux version when cross-compiling" >&5
#echo "$as_me: error: cannot determine linux version when cross-compiling" >&2;}
# { (exit 1); exit 1; }; }
# fi
./configure --host=arm-none-linux
確認Makefile的CC不是gcc而是你的cross compile的名字
就代表ok嚕
接下來
make
產生libpcap.so.1.1.1
就代表成功嚕
build tcpdump-4.1.1
1. 修改configure
註解掉 4411~4415
# if test $ac_cv_linux_vers = unknown ; then
# { { echo "$as_me:$LINENO: error: cannot determine linux version when cross-compiling" >&5
#echo "$as_me: error: cannot determine linux version when cross-compiling" >&2;}
# { (exit 1); exit 1; }; }
# fi
./configure --host=arm-none-linux
檢查是否成功的方式與上述相同
確認成功後
make
產生tcpdump
就代表成功嚕
可以用file看一下
file tcpdump
tcpdump: ELF 32-bit LSB executable, ARM, version 1, dynamically linked (uses shared libs), not stripped
透過Facebook分享
2011年9月28日 星期三
/bin, /sbin, /usr/bin, /usr/sbin 擺放binary的原則
系統有四個地方可以放置binary
/bin, /sbin, /usr/bin, /usr/sbin
所編譯出來的binary file, 怎麼放比較適合呢
可以用使用者以及系統管理者來做分類
/bin: 使用者與系統管理者必備
/sbin: 使用者非必備, 系統管理者必備
/usr/bin: 使用者非必備
/usr/sbin: 系統管理者非必備
Ref:
建構嵌入式LINUX系統
ISBN: 986-7794-30-3
/bin, /sbin, /usr/bin, /usr/sbin
所編譯出來的binary file, 怎麼放比較適合呢
可以用使用者以及系統管理者來做分類
/bin: 使用者與系統管理者必備
/sbin: 使用者非必備, 系統管理者必備
/usr/bin: 使用者非必備
/usr/sbin: 系統管理者非必備
Ref:
建構嵌入式LINUX系統
ISBN: 986-7794-30-3
透過Facebook分享
2011年8月23日 星期二
svn log get by date
一般
svn log path
會將完整的log顯示出來(Linux上RapidSVN就是這樣做)
造成每次看log的時候都會很慢
尤其當log內容很多的時候
其實大部分的時候
是需要看看最近改了些什麼
所以就可以用svn log帶上日期的方式去get某一部份的log資料
這樣就會快上許多(ToriseSVN就是這麼做)
command:
svn log http://x.x.x.x/svn/wimax/mt7119/branches/aa623a_BaaaaBaaaaa -r {2011-07-05}:{2011-08-23}
這是一個貢獻opensource的好機會
1. 提供patch給RapidSVN
2. create a project enhance RapidSVN (如果提供patch給RapidSVN沒人理的話)
Ref:
http://svn.haxx.se/users/archive-2006-08/0737.shtml
svn log path
會將完整的log顯示出來(Linux上RapidSVN就是這樣做)
造成每次看log的時候都會很慢
尤其當log內容很多的時候
其實大部分的時候
是需要看看最近改了些什麼
所以就可以用svn log帶上日期的方式去get某一部份的log資料
這樣就會快上許多(ToriseSVN就是這麼做)
command:
svn log http://x.x.x.x/svn/wimax/mt7119/branches/aa623a_BaaaaBaaaaa -r {2011-07-05}:{2011-08-23}
這是一個貢獻opensource的好機會
1. 提供patch給RapidSVN
2. create a project enhance RapidSVN (如果提供patch給RapidSVN沒人理的話)
Ref:
http://svn.haxx.se/users/archive-2006-08/0737.shtml
透過Facebook分享
2011年8月15日 星期一
bootchart for embedded - bootchart-lite
安裝java
安裝ant
<script src='http://pastie.org/2373889.js'></script>
download bootchart
build bootchart
<script src='http://pastie.org/2373891.js'></script>
使用bootchart.jar去產生png ok
<script src='http://pastie.org/2373911.js'></script>
先前問題:
使用sudo apt-get install bootchart
所安裝出來的工具bootchart
直接產生png目前會有問題
錯誤訊息如下
http://pastie.org/2373917
Ref:
http://blog.csdn.net/magicyu2/article/details/6292440
安裝ant
<script src='http://pastie.org/2373889.js'></script>
download bootchart
build bootchart
<script src='http://pastie.org/2373891.js'></script>
使用bootchart.jar去產生png ok
<script src='http://pastie.org/2373911.js'></script>
先前問題:
使用sudo apt-get install bootchart
所安裝出來的工具bootchart
直接產生png目前會有問題
錯誤訊息如下
http://pastie.org/2373917
Ref:
http://blog.csdn.net/magicyu2/article/details/6292440
透過Facebook分享
2011年6月27日 星期一
2011年6月21日 星期二
tcpdump - 分析封包流向與運作狀態
一般你可以使用wireshark來監控網路設備的流向
但是如果在嵌入式系統端
沒有這樣強大的工具
你可以使用tcpdump來達到
tcpdump -i eth0
監控eth0的網路狀態
Ref:
http://linux.vbird.org/linux_server/0140networkcommand.php#tcpdump
但是如果在嵌入式系統端
沒有這樣強大的工具
你可以使用tcpdump來達到
tcpdump -i eth0
監控eth0的網路狀態
Ref:
http://linux.vbird.org/linux_server/0140networkcommand.php#tcpdump
透過Facebook分享
2011年6月14日 星期二
Linux 反覆執行特定程式並顯示狀態
如果你像我一樣需要短時間內密集的做一件事情
ex.
定時更新無線網路的狀況
sudo iwlist scanning
每次手動key也是挺麻煩的
你可以使用watch
ex.
watch -d 'sudo iwlist scannng'
Ref:
ex.
定時更新無線網路的狀況
sudo iwlist scanning
每次手動key也是挺麻煩的
你可以使用watch
ex.
watch -d 'sudo iwlist scannng'
Ref:
Linux 定時執行程式 並 監看結果 - watch
透過Facebook分享
2011年6月9日 星期四
如何安裝Vim Plugin - ctags及taglist 與教學使用
史丹利部落格: Ubuntu安裝Vim Plugin ctags及taglist: "- 已使用 Google 工具列寄出"
今天看到主管使用ctags來trace code
真的是快阿
燃起我強大的學習慾望
決定也要使用ctags的技術來加快自己看code的速度
follow上述文章裝法
1. 安裝ctags
sudo apt-get install exuberant-ctags
2. 安裝taglist
下載taglist
http://vim-taglist.sourceforge.net/
解壓縮後
進行安裝
cp -a doc/ ~/.vim
cp -a plugin/ ~/.vim
3. 修改vimrc
sudo vim /etc/vim/vimrc
按下G到最後一行加上
map <f9> :Tlist<CR>
如何製作tag檔
到你要看code的目錄下
ctags -R
會產生tags檔案
開啟*.c之後
按下F9就會顯示tag list
如果要找某個fuction implement的地方
在該function使用處按下Ctrl+]
回到function使用處的地方按下Ctrl+t
這邊有介紹for java的jtags
今天看到主管使用ctags來trace code
真的是快阿
燃起我強大的學習慾望
決定也要使用ctags的技術來加快自己看code的速度
follow上述文章裝法
1. 安裝ctags
sudo apt-get install exuberant-ctags
2. 安裝taglist
下載taglist
http://vim-taglist.sourceforge.net/
解壓縮後
進行安裝
cp -a doc/ ~/.vim
cp -a plugin/ ~/.vim
3. 修改vimrc
sudo vim /etc/vim/vimrc
按下G到最後一行加上
map <f9> :Tlist<CR>
到你要看code的目錄下
ctags -R
會產生tags檔案
開啟*.c之後
按下F9就會顯示tag list
如果要找某個fuction implement的地方
在該function使用處按下Ctrl+]
回到function使用處的地方按下Ctrl+t
這邊有介紹for java的jtags
透過Facebook分享
make -DDBG
是什麼意思阿?
-D後面帶著參數代表flag的意思 通常會跟code是否開啟某一個功能有關
像是上述例子就會把DBG(Debug)功能打開
此外
-l 帶上搜尋路徑
Ref:
http://hi.baidu.com/shidagis/blog/item/24c24e181ca593ac4bedbcb0.html
-D後面帶著參數代表flag的意思 通常會跟code是否開啟某一個功能有關
像是上述例子就會把DBG(Debug)功能打開
此外
-l 帶上搜尋路徑
Ref:
http://hi.baidu.com/shidagis/blog/item/24c24e181ca593ac4bedbcb0.html
透過Facebook分享
cp 隱藏檔一起複製
cp -a A/ B/
這樣就可以整個A目錄(包含A)一起複製到B目錄下
也包含隱藏檔案
如果你是用
cp -a A/* B/
就會把A目錄下的資料(不包含A)複製到B目錄下
不包含隱藏黨按
這樣就可以整個A目錄(包含A)一起複製到B目錄下
也包含隱藏檔案
如果你是用
cp -a A/* B/
就會把A目錄下的資料(不包含A)複製到B目錄下
不包含隱藏黨按
透過Facebook分享
2011年6月3日 星期五
iwpriv 設參數到wifi chip
Ref: http://linux.about.com/library/cmd/blcmdl8_iwpriv.htm
可以利用iwpriv設參數到wifi chip
格式
iwpriv wifiinterface privatecmd parameter
ex.
iwpriv wl0 set Channel=0
可以利用iwpriv設參數到wifi chip
格式
iwpriv wifiinterface privatecmd parameter
ex.
iwpriv wl0 set Channel=0
透過Facebook分享
2011年6月2日 星期四
ARP: Address Resolution Protocol
ARP stands for Address Resolution Protocol, which is used to find the media access control address of a network neighbour for a given IPv4 Address.
用arp -a尋找鄰居
用arp -a尋找鄰居
透過Facebook分享
2011年5月30日 星期一
2011年5月26日 星期四
vim 換行自動對齊功能
【軟件應用】vim 換行自動對齊_Glaivelee --- LIFE NOT IF ELSE_百度空間: "set number
- 已使用 Google 工具列寄出"
在home目錄下
vim .vimrc
set autoindent
set smartindent
另外我加上
set number
可以顯示行號
- 已使用 Google 工具列寄出"
在home目錄下
vim .vimrc
set autoindent
set smartindent
另外我加上
set number
可以顯示行號
透過Facebook分享
2011年5月25日 星期三
DNRD intro. from README
簡單來說
DNRD負責將hosts 傳送來的dns request, pass到不同的DNS Server.
並且將DNS Server處理好的dns reply, pass回到hosts.
因此hosts就可以知道domain name要對應什麼ip address.
-s 可以允許你設定要forward 到哪些 DNS Server.
你也可以把dnrd自己當作一個簡單的DNS Server.
這個時候你要利用
-m來做設定
預設會讀取/usr/local/etc/dnrd/master
如果此檔案不存在
就會讀取/etc/hosts
當然你也可以設定其他lcoal位置
DNRD負責將hosts 傳送來的dns request, pass到不同的DNS Server.
並且將DNS Server處理好的dns reply, pass回到hosts.
因此hosts就可以知道domain name要對應什麼ip address.
-s 可以允許你設定要forward 到哪些 DNS Server.
- -s ipaddr(:domain)
- --server=ipaddr(:domain)
- Add a forward DNS server. If multiple -s options are given, dnrd treats the first as a primary DNS server and the rest as backup servers. If the primary DNS server times out, it is deactivated and the next specified server (that is active) is used until the previous gets reactivated.
你也可以把dnrd自己當作一個簡單的DNS Server.
這個時候你要利用
-m來做設定
預設會讀取/usr/local/etc/dnrd/master
如果此檔案不存在
就會讀取/etc/hosts
當然你也可以設定其他lcoal位置
- -m (off|hosts)
- --master=(off|hosts)
- dnrd can act as the primary name server for a number of hosts. By default, it will read in /usr/local/etc/dnrd/master to determine how this is done. If that file doesn't exist, it will act as the primary server for the hosts found in /etc/hosts. This option allows you to override the default behavior. Setting it to off turns off all primary server functionality. Setting it to hosts causes dnrd to act as the primary server for hosts in /etc/hosts regardless of whether it could find /usr/local/etc/dnrd/master.
透過Facebook分享
2011年5月23日 星期一
DNRD - Domain Name Relay Daemon
DNRD - Domain Name Relay Daemon: "- 已使用 Google 工具列寄出"
Domain Name Relay Daemon is a cacheing, forwarding DNS proxy server.
特色
1. 有caching功能
2. 備份DNS server資料
3. 提供簡易的routing: 不同domain可以設定不同的forward
4. 預防cache poisoning
5. Force authorative or unauthorative answers for specified domains
6. 分享/etc/hosts內容
7. DNS 黑名單支援
8. TCP支援
運行在 openbsd, freebsd, and linux
Domain Name Relay Daemon is a cacheing, forwarding DNS proxy server.
特色
1. 有caching功能
2. 備份DNS server資料
3. 提供簡易的routing: 不同domain可以設定不同的forward
4. 預防cache poisoning
5. Force authorative or unauthorative answers for specified domains
6. 分享/etc/hosts內容
7. DNS 黑名單支援
8. TCP支援
運行在 openbsd, freebsd, and linux
透過Facebook分享
2011年5月12日 星期四
使用tar查看壓縮檔的內容
tar -zvtf file.tar.gzReference:
http://www.cyberciti.biz/faq/list-the-contents-of-a-tar-or-targz-file/
透過Facebook分享
2011年5月11日 星期三
busybox教學 - 如何enable/disable vi
下載busybox (目前使用1.18.4)
解壓縮後
cd busybox-1.18.4.
vim .config
搜尋字串CONFIG_VI=y
拿掉#
重新build一次就ok
./busybox 就可以看到目前支援的功能
Currently defined functions:
[, [[, arp, arping, ash, awk, basename, bunzip2, bzcat, cat, chmod, chroot, cksum, clear, cmp, cp, crond, crontab, cut, date, dd, df, dhcprelay,
dirname, dmesg, du, echo, egrep, env, expr, false, fgrep, free, ftpget, ftpput, getopt, getty, grep, gunzip, gzip, halt, head, hostid, hostname,
id, ifconfig, ifdown, ifup, init, insmod, ip, ipaddr, ipcalc, ipcs, iplink, iproute, kill, killall, killall5, klogd, linuxrc, ln, login, logread,
ls, lsmod, md5sum, mkdir, mkfifo, mknod, mktemp, modprobe, mount, mv, nameif, nc, netstat, nice, nslookup, pidof, ping, poweroff, printf, ps,
pwd, reboot, rm, rmmod, route, run-parts, sed, seq, setconsole, setsid, sh, sleep, sort, split, start-stop-daemon, stat, stty, sum, swapoff,
swapon, switch_root, sync, syslogd, tail, tar, tee, telnetd, test, tftp, top, touch, tr, traceroute, true, tty, udhcpc, udhcpd, umount, uname,
uniq, usleep, vconfig, vi, wc, which, whoami, yes, zcat
解壓縮後
cd busybox-1.18.4.
vim .config
搜尋字串CONFIG_VI=y
拿掉#
重新build一次就ok
./busybox 就可以看到目前支援的功能
Currently defined functions:
[, [[, arp, arping, ash, awk, basename, bunzip2, bzcat, cat, chmod, chroot, cksum, clear, cmp, cp, crond, crontab, cut, date, dd, df, dhcprelay,
dirname, dmesg, du, echo, egrep, env, expr, false, fgrep, free, ftpget, ftpput, getopt, getty, grep, gunzip, gzip, halt, head, hostid, hostname,
id, ifconfig, ifdown, ifup, init, insmod, ip, ipaddr, ipcalc, ipcs, iplink, iproute, kill, killall, killall5, klogd, linuxrc, ln, login, logread,
ls, lsmod, md5sum, mkdir, mkfifo, mknod, mktemp, modprobe, mount, mv, nameif, nc, netstat, nice, nslookup, pidof, ping, poweroff, printf, ps,
pwd, reboot, rm, rmmod, route, run-parts, sed, seq, setconsole, setsid, sh, sleep, sort, split, start-stop-daemon, stat, stty, sum, swapoff,
swapon, switch_root, sync, syslogd, tail, tar, tee, telnetd, test, tftp, top, touch, tr, traceroute, true, tty, udhcpc, udhcpd, umount, uname,
uniq, usleep, vconfig, vi, wc, which, whoami, yes, zcat
透過Facebook分享
訂閱:
文章 (Atom)