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

2010年11月25日

simple trunc implement

uClibc的libm沒有trunc function的實作, 如果一定要用到的話, 可以加入簡單的實作:

2010年5月5日

Use mutt receive email

如果要用mutt內建的pop/imap收信功能, 首先要檢查是否compile時有enable
# mutt -v
+USE_POP  +USE_IMAP
1. 執行mutt
2. 假設要連線到pop3 server:www.hibox.hinet.net
3. 按c 改變mail box 路徑
4. 輸入: pop://email-account@www.hibox.hinet.net 
5. 若要使用imap, 則改變pop成imap即可imap://email-account@www.hibox.hinet.net

2010年1月26日

Extract file from Tarball

下載下來的kernel source tarball不想整個解開,
只要解開某個目錄時, 可以用下面的指令
tar -xvf tarball.tar.gz {path/to/dir}
For example, only usb driver directory:

# tar -xf linux-2.6.24.tar.gz linux-2.6.24/drivers/usb/

2010年1月22日

Setup Viewvc on Fedora9


  1. yum install viewvc
  2. Edit /etc/viewvc/viewvc.conf, modify cvs_roots to your current CVSROOT
  3. Edit /etc/httpd/conf.d/viewvc.conf

2010年1月16日

a small and nice ini parser -- iniParser

Today I finished cross-compiling wvdial package. After I cross-compiling it, I found that it has some problem to load the wvdial.conf. And I also know that passing arguments to the wvdial is still working. Finally, I decide to modify the wvdial program to load the wvdial.conf by my own. I load the config file with iniParser and pass it to the cfg object. Now it works perfectly !!

wvdial -- a utility that helps in making modem-based connections to the Internet
wvdial site
wvdial wiki
iniParser home
wvdial introduction 

2010年1月11日

compiling wvstreams lib on Ubuntu

Install pre-requests:
sudo apt-get install build-essential libssl-dev libreadline5-dev zlib1g-dev

wget http://wvstreams.googlecode.com/files/wvstreams-4.6.1.tar.gz
tar zxvf wvstreams-4.6.1.tar.gz
./configure
make

2010年1月5日

cvsync: 好用的cvs同步工具

cvsync 網址
http://www.cvsync.org/

預設設定檔位址
/usr/local/etc/
設定檔範例在samples目錄
cvsync.conf是給client用
cvsyncd.conf是給server用

如果在compile的時候出現下面訊息, 則是沒有指定HASH_TYPE

WARNING! Please specify the HASH_TYPE.
  libgcrypt
  mhash
  native (default)
  openssl
make[1]: *** [hash-error] Error 1
直接在make後面指定就可以了
make HASH_TYPE=openssl

2010年1月3日

ubuntu上mount lvm partition

ubuntu 9.10灌好後, 最先就是把之前灌fedora那個硬碟的資料copy回來.
由於fedora 9預設是用lvm的partition, 因此要安裝lvm2套件,
剩下的, 就是把lvm mount起來
# sudo apt-get install lvm2
# sudo vgscan
# sudo vgchange -ay VolGroup00
# sudo lvs
# sudo mount /dev/VolGroup00/LogVol00 /mnt
Reference: http://www.linux-sxs.org/storage/fedora2ubuntu.html

2009年12月30日

Keep command running even you logout

Telnet到某台Linux主機上執行指令, 但此時Windows需要重開機,
可以用兩個簡單的方式繼續執行原本指令
1. Ctrl-D
如果指令已經在執行而且不想重run
先用Ctrl-z暫停, 然後執行bg使原本暫停的指令到backgroud
最後再下Ctrl-D
2. nohup
一開始執行指令時就加上nohup在前面
i.e. nohup your-command &
此時關閉視窗或中斷連線都不會影響正在執行的指令了

2009年12月29日

2009年12月20日

Get file's size in Hex

更新firmware前, 如果遇到比較陽春的bootloader, 有的還要自己手動輸入檔案大小
這時可以先將做出來的大小先算出, 再以script代入就可以了

ls -l FileName  | awk '{print $5} ' |   echo "ibase=10;obase=16;$$" | bc

2009年12月19日

在Linux下用native2ascii轉成簡中unicode的方式

在JDK安裝目錄中BIN底下有一個轉碼工具native2ascii.exe
資源文件需要進行Unicode編碼,方法是使用這個jdk提供的工具來轉換native2ascii

ascii到unicode方式:
native2ascii 原檔名 轉換檔名

因為我用的是繁體中文的環境, 首先, 必需將自己的locale換成zh_CN
export LC_ALL=zh_CN.utf8
然後再執行gnome-editor將翻譯成簡中的文字貼上
最後再執行native2ascii即可

範例
aaa.txt文件內容包括:中國
native2ascii aaa.txt bbb.txt
執行後變為:\u4e2d\u56fd

aaa.txt文件內容包括:\u4e2d\u56fd
native2ascii -reverse aaa.txt bbb.txt
執行後變為:中國

2009年2月3日

移動andLinux在windows下的磁碟檔

andLinux在windows下的磁碟檔為base.drv 和 swap.drv
預設被存放在C:\Program Files\andLinux\Drives 下
想到搬到其它的硬碟下, 比方說:g:\andLinuxDisk\
  1. 先將andLinux 的service停止
  2. 再將base.drv和swap.drv移動到想要的目錄下
  3. 修改設定檔C:\Program Files\andLinux\setting.txt, 如下所示
  4. 再將service重新起動即可(但TAP-colinux的網路介面卡無法起動, 需要重新開機才有辨法, 目前還不知道為什麼)
mem=256
root=/dev/cobd0
initrd=initrd.gz
kernel=vmlinux
cobd0=g:\andLinuxDisk\base.drv
cobd1=g:\andLinuxDisk\swap.drv
eth0=slirp
eth1=tuntap,"TAP-Colinux",00:11:22:33:44:55


如果要加大磁碟檔的大小, 可以參考下面這個網頁
http://colinux.wikia.com/wiki/ExpandingRoot#The_most_reliable_way_to_enlarge_the_root_partition

2009年1月31日

Initrd

現在的Fedora都有用到initrd來開機, 如果想研究看看裡面的機制, 可以將之解開來看看.
cpio format
mkdir temp ; cd temp
cp /boot/initrd-2.6.14.2.img initrd-2.6.14.2.img.gz
gunzip initrd-2.6.14.2.img.gz
cpio -i --make-directories < initrd-2.6.14.2.img

non-cpio format
mkdir temp ; cd temp
cp /boot/initrd.img.gz .
gunzip initrd.img.gz
mount -t ext -o loop initrd.img /mnt/initrd
ls -la /mnt/initrd

Tools
mkinitrd; packagename -- mkinitrd
References:


http://www-128.ibm.com/developerworks/linux/library/l-initrd.html


2009年1月30日

Linux 下看硬體規格的工具

lshw is a small tool to extract detailed information on the hardware configuration of the machine.

yum install -y lshw


有GUI版

yum install -y lshw-gui



其它相關工具: lspci, lsusb, and lshal

2009年1月22日

andLinux上使用sshfs

在andLinux上裝sshfs package
apt-get install sshfs
andLinux上default並沒有將/dev/fuse這個device node建立起來, 手動建立它
mknod /dev/fuse c 10 229
確認fuse 的module已經load
modprobe fuse

因為在我的windows-host 上有跑CygWin 的sshd, 所以我可以直接將它mount到指定目錄下:
mkdir -p /mnt/sshfs
sshfs jim@windows-host:/cygdrive/d /mnt/sshfs/
umount 的方式
fusermount -u /mnt/sshfs

在andLinux下新增interface alias

修改/etc/network/interfaces

例如: 幫eth1多bind 一個新的ip叫做192.168.0.53

iface eth1:1 inet static

address 192.168.0.53

netmask 255.255.255.0




下次起動時就會有了, 或是直接執行
/etc/init.d/networking restart

2008年11月26日

indent

The `indent' program can be used to make code easier to read. It can also convert from one style of writing C to another.
indent -kr -ts4 filename

coap-client 4.3.0 Windows build

coap-client  is a  wget -like tool to generate simple requests for retrieval and modification of resources on a remote server.  Got the sour...