Oct 31, 2009
用rsnapshot 備份
How To Backup Remote Linux Host Using rsnapshot rsync Utility
Oct 6, 2009
rsync for backup
server 端
設定 /etc/rsyncd.conf, 一組設定稱為一個module[KG6500_Stream]
path = /media/HD-CEU2 # server 端的備份位置
uid = root
gid = root
secrets file = /etc/rsyncd.secrets # 帳號密碼設定檔
read only = no
client
要備份的資料夾: /home/Stream執行 rsync -vrtopg --progress --password-file=/etc/rsyncd.secrets /home/Stream backup@127.0.0.1::KG6500_Stream
會將client端的/home/Stream 整個資料夾備份到/media/HD-CEU2/Stream
參數說明
v : 顯示進度r : 遞迴
topg : 維持檔案屬性
Apr 27, 2009
這帽子扣得真大
我是很尊敬前輩的……
Mar 12, 2009
enable mouse in vim
http://snpshu.blog.pingtung.org/post/2/68
"使用m$模式
source $VIMRUNTIME/mswin.vim
behave mswin
"使用mouse
set mouse=a
"指定term模式
set ttymouse=xterm2
"切換滑鼠模式快速鍵
map m :set mouse=a<CR>
map <Leader>m :set mouse=<CR>
Mar 4, 2009
backup my vimrc
" 256 color depth
set t_Co=256
" paste without indent
set paste
" 顯示行號
set nu
set nobackup
set autoindent
colors asmdev
set cindent
set ruler
set tags=./tags,tags
set nocompatible
set backspace=2
set showmatch
" tab for cindent with 4 spaces
set shiftwidth=4
" tab = 4 spaces
set tabstop=4
" convert tab to space
set expandtab
syntax on
set et
" set noet
" F2 : 存檔(不關閉)
map :up
" F3 : 切換游標所在行劃底線
map :set cursorline!:echo "Highlight active cursor line: " . strpart("OffOn", 3 * &cursorline, 3)
" F4 直接關閉
map :q
" F5 到下個tab
map :tabprev
" F6 到前個tab
map :tabnext
map :NERDTree
map :set hls!set hls?
nmap :set nu!
imap :set nu!
map :TlistToggle
map :color relaxedgreen
map :vs:Explore
let Tlist_GainFocus_On_ToggleOpen = 1
map w :tabclose
map n :tabnew:e
" 每次開啟檔案回到之前開啟的位置
if has("autocmd")
autocmd BufRead *.txt set tw=78
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") 0
set fileencodings=ucs-bom,utf-8,cp936,big5,euc-jp,euc-kr,latin1
else
set fileencodings=cp936,big5,euc-jp,euc-kr,latin1
endif
" CJK environment detection and corresponding setting
if v:lang =~ "^zh_CN"
" Use cp936 to support GBK, euc-cn == gb2312
set encoding=cp936
set termencoding=cp936
set fileencoding=cp936
elseif v:lang =~ "^zh_TW"
" cp950, big5 or euc-tw
" Are they equal to each other?
set encoding=big5
set termencoding=big5
set fileencoding=big5
elseif v:lang =~ "^ko"
" Copied from someone縮 dotfile, untested
set encoding=euc-kr
set termencoding=euc-kr
set fileencoding=euc-kr
elseif v:lang =~ "^ja_JP"
" Copied from someone縮 dotfile, unteste
set encoding=euc-jp
set termencoding=euc-jp
set fileencoding=euc-jp
endif
" Detect UTF-8 locale, and replace CJK setting if needed
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
set encoding=utf-8
set termencoding=utf-8
set fileencoding=utf-8
endif
else
echoerr "Sorry, this version of (g)vim was not compiled with multi_byte"
endif
" cscope
if has("cscope")
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb
set cscopetag
set cscopequickfix=s-,g-,c-,d-,t-,e-,f-,i-
endif
Feb 5, 2009
ubuntu ethxx rename
不知道為甚麼,eth0不見了,只剩下eth1
http://mydebian.blogdns.org/?p=177
# /etc/init.d/networking stop
首先要知道網路卡的driver module name
# lsmod (找出網路卡module : NICmod)
# rmmod NICmod
確認udev rule for NIC設定檔
通常在 /etc/udev/rules.d/xxx-net.rules
將它清空,重新載入NIC module
# modprobe NICmod
# /etc/init.d/networking start
Jan 19, 2009
sed - 字串取代
將a.txt裡面的xxx取代成yyy,存到b.txt
sed 's/xxx/yyy/g' a.txt > b.txt
取代行首
sed 's/^/yyy/g' a.txt > b.txt
取代行末
sed 's/$/yyy/g' a.txt > b.txt
Jan 13, 2009
Jan 9, 2009
Jun 21, 2008
Jun 18, 2008
SSH Server 登入過慢
修改 /etc/ssh/sshd_config
加入一行 UseDNS no
另一個方法:
把client 端的 ip & hostname 加到 ssh server 那台電腦裡的 /etc/hosts
Jun 12, 2008
May 20, 2008
debian 出大包了
真不敢相信debian 這麼嚴謹的distro 會出這種錯誤
而且擺了一兩年
Serious Debian/Ubuntu openssl/openssh bug found
ubuntu 系出debian 當然也受影響(libssl-0.9.8)
受影響版本:
- Ubuntu 7.04 (Feisty)
- Ubuntu 7.10 (Gutsy)
- Ubuntu 8.04 LTS (Hardy)
- Ubuntu “Intrepid Ibex” (development): libssl <= 0.9.8g-8
- Debian 4.0 (etch) (see corresponding Debian security advisory)
May 15, 2008
Ubuntu 7.10 gusty, 台灣的source list
deb http://ftp.twaren.net/Linux/Ubuntu/ubuntu/ gutsy main universe restricted multiverse
deb-src http://ftp.twaren.net/Linux/Ubuntu/ubuntu/ gutsy main universe restricted multiverse
deb http://tw.archive.ubuntu.com/ubuntu/ gutsy-security main restricted
deb-src http://tw.archive.ubuntu.com/ubuntu/ gutsy-security main restricted
deb http://tw.archive.ubuntu.com/ubuntu/ gutsy-security universe
deb-src http://tw.archive.ubuntu.com/ubuntu/ gutsy-security universe
deb http://tw.archive.ubuntu.com/ubuntu/ gutsy-security multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu/ gutsy-security multiverse
deb http://ftp.twaren.net/Linux/Ubuntu/ubuntu/ gutsy-updates universe main multiverse restricted
deb-src http://ftp.twaren.net/Linux/Ubuntu/ubuntu/ gutsy-updates universe main multiverse res
May 6, 2008
Apr 28, 2008
S3C2440, USB in Linux
帥哥的測試:
GPH10 控制小 port:0 是打開 1 是關掉
GPH8 控制大 port: 1 是打開 0 是關掉
送電之後就可以用了...他媽的白費兩個禮拜
05/23 :
之前請正哥寄信去要電路圖都不屌我們
COLOR 打電話去就要到了
更正
GPH8 : USB_HOST_EN
GPH10 : nUSB_PULL_UP_EN
USB_HOST_EN 控制 USB_H_5V --> USB HOST PORT 的供電 (大PORT)
nUSB_PULL_UP_EN 控制 USB_C_D+ --> MINI USB 的供電 (小PORT)
DEBUGFS Support
(host)# cd rootfs(host)# pwd /home2/fyodor/filesystem/rootfs
(busybox)# mkdir var/debug(busybox)# vi etc/fstab加一行:none /var/debug debugfs ramfs 0 0
(busybox)# modprobe rt73usbphy0 -> rt2x00_set_chip: Info - Chipset detected - rt: 1300, rf: 0002, rev: 000.
usbcore: registered new interface driver rt73usb
(busybox)# cd /var/debug(busybox)# lsdrwxr-xr-x 3 0 0 0 Jan 1 00:32 ieee80211
drwxr-xr-x 3 0 0 0 Jan 1 00:00 ohci
drwxr-xr-x 2 0 0 0 Jan 1 00:00 usbmon
rt73的debugfs出來的資訊就在ieee80211裡面
ASUS WL-167G (USB WLAN Adapter) For ARM Linux
usb host timeout的原因是....usb controller過熱被保護電路關電.......
林老師卡好勒
=============================================================
great~ it offers linux driver~
copy the directory Linux/rt73 in the Driver CDROM ( remember to chmod +w )
follow the README in Linux/rt73/module/
if you got error "undefined get_wireless_stats"
just fix rtmp_main.c, replace netdev->get_wireless_stats to netdev->get_stats
=======================================
編譯module
網路上有非官方driver : rt2x00 project
每天最新版本
或是直接用CVS更新
cvs -d:pserver:anonymous@rt2400.cvs.sourceforge.net:/cvsroot/rt2400 login
cvs -z3 -d:pserver:anonymous@rt2400.cvs.sourceforge.net:/cvsroot/rt2400 co -P source/rt73
修改Makefile
最前面增加五行
ARCH=arm
CROSS_COMPILE=/usr/local/arm/3.4.1/bin/arm-linux-
KERNDIR=/home2/fyodor/kernel/linux-2.6.25__from__2.6.24.3
(KERNDIR要指到目標板所使用的KERNEL SOURCE,而且KERNEL必須先設定好交叉編譯)
ROOTFS = /home2/fyodor/filesystem/rootfs
MODDIR = /lib/modules/2.6.24.3/extra
把module install 的目標位置依照目標kernel版本設定
否則就會安裝到目前uname -r 所找到的kernel module位置...
ps. make install時,modules.dep的設定不會跟著MODDIR而改變
所以還是得設定成extra
修改一行
FIRM_DIR := $(ROOTFS)/lib/firmware
編譯
(host)# make armdebug
警告訊息
!!! WARNING: Module file much too big (>1MB)
!!! Check your kernel settings or use 'strip'
*** Module rt73.ko built successfully
表示編出來的module太大了,這個好解決
必須削減(strip)多餘訊息 (strip之後,板子上無法modprobe!format不合)
(host)# arm-linux-strip ./rt73.ko
把module安裝到target rootfs
這一步,我不很確定怎麼做,試看看吧~
(host)# sudo make install
*** Install module in /lib/modules/2.6.24.3/extra ...
make[1]: Entering directory `/home2/fyodor/kernel/linux-2.6.25__from__2.6.24.3'
INSTALL /home2/fyodor/filesystem/tools/wirelessTool/WL-167G/rt73-cvs/rt73-cvs-2008042100/Module/rt73.ko
DEPMOD 2.6.24.3
make[1]: Leaving directory `/home2/fyodor/kernel/linux-2.6.25__from__2.6.24.3'
/sbin/depmod -a
*** Update /etc/modprobe.d/ralink alias for wlan*
*** Install firmware in /home2/fyodor/filesystem/rootfs/lib/firmware ...
*** Check old config ...
警告訊息
WARNING: Couldn't find symtab and strtab in module /lib/modules/2.6.20-15-generic/extra/rt73.ko
*** Update /etc/modprobe.d/ralink alias for wlan*
*** Install firmware in /home2/fyodor/filesystem/rootfs/lib/firmware ...
*** Check old config ...
因為這一個編譯所使用的kernel版本2.6.24.3,和host機器上目前使用的版本2.6.15不同導致這個錯誤不知道怎麼處理... 應該是沒關係因為真正運作時,這個module在板子上所配合的kernel 版本就對上了參考: http://www.linuxsir.org/bbs/thread307321.html
結束
一樣照著路徑複製到rootfs裡面
module : /lib/modules/2.6.24.3/extra/rt73.ko
firmware : /lib/firmware/rt73.bin
status code :
s3c2410-ohci s3c2410-ohci: urb c2704ec0 path 1 ep0in 5ec20000 cc 5
–> status -62
all status code : include/asm-generic/errno.h
#define ETIME 62 /* Timer expired */
Document of error codes : Documentation/usb/error-codes.txt
-ETIME (**)
No response packet received within the prescribed bus turn-around time. This error may instead be reported as -EPROTO or -EILSEQ.
懶惰的script
ROOTFS=/home2/fyodor/filesystem/rootfs
echo " install module to $ROOTFS/lib/modules/2.6.24.3/extra/"
cp /lib/modules/2.6.24.3/extra/rt73.ko $ROOTFS/lib/modules/2.6.24.3/extra/rt73.ko
echo " install firmware to $ROOTFS/lib/firmware/"
cp /lib/firmware/rt73.bin $ROOTFS/lib/firmware/
ls -alh $ROOTFS/lib/modules/2.6.24.3/extra/rt73.ko
ls -alh $ROOTFS/lib/firmware/rt73.binmodprobe
[busybox] # modprobe rt73 debug=15 firmware=/lib/firmware/rt73.bin
[busybox] # ifconfig wlan0 up
[busybox] # dmesg
rt73: USBVendorRequest TIMEOUT
rt73: Retry count exhausted or device removed!!!
rt73: BBP version = 0
s3c2410-ohci s3c2410-ohci: urb c1980840 path 1 ep0in 5ec20000 cc 5 --> status -62
rt73: USBVendorRequest TIMEOUT
s3c2410-ohci s3c2410-ohci: urb c1980840 path 1 ep0out 5ec20000 cc 5 --> status -62
rt73: USBVendorRequest TIMEOUT
s3c2410-ohci s3c2410-ohci: urb c1980840 path 1 ep0in 5ec20000 cc 5 --> status -62
rt73: USBVendorRequest TIMEOUT
s3c2410-ohci s3c2410-ohci: urb c1980840 path 1 ep0in 5ec20000 cc 5 --> status -62
rt73: USBVendorRequest TIMEOUT
s3c2410-ohci s3c2410-ohci: urb c1980840 path 1 ep0in 5ec20000 cc 5 --> status -62
rt73: USBVendorRequest TIMEOUT
rt73: Retry count exhausted or device removed!!!
rt73: BBP version = 0
為什麼會timeout勒..... 搞了一個禮拜還是搞不清楚
rt73: USBVendorRequest TIMEOUT是我自己加的訊息
總之status -62 = -ETIME,就是TIMEOUT
上面說過了,status code的詳細定義在$(KERNDIR)/include/asm-generic/errno.h
error的解釋在$(KERNDIR)/Documentation/usb/error-codes.txt
去rt2x00.serialmonkey.com post問題,一邊trace driver 一邊等
覺得問題比較有可能出在s3c2410-ohci
畢竟這部份的2440移植,我做的很粗糙
Error Code Tracing
rt73: USBVendorRequest TIMEOUT
$(RT73)/Module/rtusb_io.c ===> RTUSB_VendorRequest function內的ret 值
ret=usb_control_msg(pAd->pUsb_Dev, usb_sndctrlpipe( pAd->pUsb_Dev, 0 ), \
Request, RequestType, Value,Index, TransferBuffer, TransferBufferLength, \
CONTROL_TIMEOUT_JIFFIES);
message : s3c2410-ohci s3c2410-ohci: urb c1980840 path 1 ep0out 5ec20000 cc 5 --> status -62
來源:drivers/usb/host/ohci-q.c : dl_done_list() --> dl_reverse_done_list() --> ed_halted()
誰呼叫RTUSB_VendorRequest
RTUSBReadMACRegister
RTUSBWriteMACRegister
Apr 22, 2008
NAND Flash ~ empty flash 問題
# sumtool -e 0x20000 --no-cleanmarkers --littleendian -i output/rootfs.jffs2 -o output/newrootfs.jffs2
Apr 19, 2008
warning: `regparm' attribute directive ignored
交叉編譯rt73usb driver的時候,需要指定kernel source路徑
# cd RT73_Linux_STA_Drv1.0.4.0/Module
# make ARCH=arm CROSS_COMPILE=arm-linux-
\KERNDIR=/home2/fyodor/kernel/linux-2.6.25__from__2.6.24.3/
出現了這個警告
warning: `regparm' attribute directive ignored
網路上查到是說
kernel src directory裡面的 include/asm
他是一個link,應該要指向corss compile目標
(在我這個情況就是asm-arm)
如果沒把asm 指到 asm-arm,就會出現這個warning
http://osdir.com/ml/linux.gps/2006-02/msg00049.html
http://linux.chinaunix.net/bbs/archiver/?tid-916672.html
可是我有正確指過去啊....怎麼還是出現這個warning