2009年12月28日 星期一
安裝Mplayer至Fedora11
參考網頁: rpmfusion http://blog.udn.com/webberjane/3121290
1. 首先, 需啟用rpm-fusion
# rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
# rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm'
2. 再來用yum search, 就能看到mplayer了^ ^
# yum search mplayer
# yum install mplayer.i586
2009年11月24日 星期二
3G網卡 on Linux
雖然網路上對於3G網卡的設定文章不在少數, 但對於我來說很陌生...而且找錯方向...搞了很久.
首先, 先看看usb id認不認得你這個新的3G module
# lsusb
Bus 005 Device 006: ID 0ace:1215 ZyDAS WLA-54L WiFi
Bus 005 Device 005: ID 1da5:4515
...以下略
我一直以為ZyDAS是我這次要設定的目標...所以我怎麼設定都不會讓/dev/ttyUSB起來
# sudo modprobe usbserial vendor=0x0ace product=0x1215
網路上都是這樣打就會產生modem的相關device, 而我怎麼設定都不行, 還一直跑出kernel error msg, 讓我以為Ubuntu 8.04的Driver有問題XD 原來是我一直搞錯東西...
正確的其實是沒有名字的 1da5:4515
# sudo modprobe usbserial vendor=0x1da5 product=0x4515
這樣就會在kernel msg看到四個(我的有四個)/dev/ttyUSB[0-3]產生
*************************************************************************************
解釋一下每一個device的用途
/dev/ttyUSB0 should be used for your ppp data connections.
/dev/ttyUSB2 is the device to use for GSM related tasks such as SMS and network checks.
/dev/ttyUSB1 is not used at all.
/dev/ttyUSB3 ...I don't know XD
*************************************************************************************
解決聯絡的modem窗口問題, 接下來就是要搞懂怎樣設定才可以讓我的sim卡正常運作
# ln -s -f /dev/ttyUSB2 /dev/modem
# vi /etc/wvdial.conf
*************************************************************************************
[Dialer Defaults]
Phone = *99#
APN = internet
Username = username
Password = password
Stupid Mode = 1
Dial Command = ATDT
Modem = /dev/modem
Baud = 9600
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ISDN = 0
Modem Type = Analog Modem
*************************************************************************************
查看有無正常運作
# wvdialconf
...略
Found a modem on /dev/ttyUSB2, using link /dev/modem in config
Modem configuration written to /etc/wvidal.conf
ttyUSB2
執行
# wvdial &
完成!!
我從network manger那邊設定, 雖然看得到ip, 但是無法連線(?), 不知道問題出在哪XD
這次真的像瞎子摸象, 根本不曉得到底是哪裡出了問題, driver , kernel or setting?
不曉得如何設定modem, 如何使用ppp tool.
一直到打電話問廠商的業務, 他說他們的工程師也是在Ubuntu 8.04上測試ok.
自信生力量...我就可以排除是kernel的問題, 重灌後仔細看, 才發現我根本一直搞錯對象 >///<
接下來就一帆風順了 XD
2009年11月23日 星期一
如何用圖形化介面來遠端操控
Ubunutu的資料真的很多, 非常方便, 而且非常有趣, 這次設定參考網站如下
http://wiki.ubuntu-tw.org/index.php?title=Ubuntu6.10Guidetw
Host:
# apt-get install xvnc4viewer
# vncviewer -fullscreen 「Target IP」
Target:
System >> Preferences >> Remote Desktop >> Allow other users to view your desktop
2009年11月18日 星期三
/proc/meminfo
man proc --> 搜尋meminfo
/proc/meminfo
This is used by free(1) to report the amount of free and used
memory (both physical and swap) on the system as well as the
shared memory and buffers used by the kernel.
It is in the same format as free(1).
man free --> 沒有相關資料, 繼續往回找
dpkg -S /usr/bin/free
procps: /usr/bin/free
dpkg -L procps --> 也沒有可用資訊
http://wiki.debian.org.hk/w/Filesystem:/proc/meminfo
* MemTotal: 可以記憶體大小 (即是實體記憶體大小減去一些保留的位元及作業系統核心)
* MemFree: LowFree + HighFree
* MemShared: 理論上是分享記憶體 (Shared Memory) 的太小,但因為效率原因,永遠都是 0 。
* Buffers: 緩衝區快取 (Buffer Cache, 原始磁碟區塊在記憶體上的暫時寄存位) 記憶體大小,應該不會大過 20MB 。
* Cached: pagecache (由磁盤讀取檔案用的決取記憶體) 減去 SwapCache
* SwapCache: 曾被換出(swap out),但被換回(swap in)而仍留在 swapfile 的記憶體大小 (當系統要求記憶體時,這些記憶體不用經過被換出的工序,因為其內容早已放在 swapfile 中,可以減少I/O。
2009年11月12日 星期四
NFS
Target : RSC-W910
Host:
# sudo apt-get install nfs-kernel-server
# sudo vi /etc/exports
/filesystem 10.1.1.0/24(rw,no_root_squash)
/ARM/data 10.1.1.0/24(rw,no_root_squash)
# sudo /etc/init.d/portmap restart
# sudo /etc/init.d/nfs-kernel-server start
Target:
# mount -o nolock (Host'IP):/ARM/data /mnt
用-t nfs 會需要portmap, 這時會有錯誤訊息
----------以上 For RSC-W910設定---------------
----------以下為PC上設定--------------------------
伺服端︰
開啟portmap以及nfs服務
~$ sudo service portmap start
~$ sudo service nfs-kernel-server start
修改/etc/exports,開放nfs folder以及允許存取的位置和權限
客戶端︰
開啟portmap以及nfs
看此ip有開放哪些folder可使用
~$ showmount -e server'ip
掛載nfs folder
~$ mount -t nfs server'ip:folder'path mount'path
ex: mount -t nfs 10.1.1.13:/home/me/nfsfolder /mnt
2009年9月28日 星期一
修改initrd , 使系統能由usb開機
# cp /boot/initrd.img /tmp/.
# mkdir /tmp/test
# cd /tmp
# mv initrd.img initrd.img.gz
# gunzip initrd.img.gz
# cd test
# cpio -i -I ../initrd.img
由於usb開機 , 需要載入正確的模組 , 才可以讓usb被認出以及被掛載為root filesystem
scsi_mod.ko sd_mod.ko usbcore.ko usb-storage.ko uhci-hcd.ko ohci-hcd.ko ehci-hcd.ko
把這些模組搬到/tmp/test/lib/下 , 然後再修改/tmp/test/init即可
# find . -print | cpio -o -H newc > ../test.ininrd.img
# cd ..
# gzip -9 test.initrd.img
# mv test.initrd.img.gz /boot/test.initrd.img
最後再修改grub/menu.lst就可以了~
如何看initrd到底在做甚麼
# mv initrd.img initrd.img.gz
# gunzip initrd.img.gz
# mkdir /mnt/init
# mount -o loop initrd.img /mnt/init
修改好後還原
# umount /mnt/init
# gzip -9 initrd.img
# mv initrd.img.gz initrd.img
新版本的initrd , 是使用cpio來做備份 , 所以要用cpio來還原檔案
# file initrd.img
initrd.img: gzip compressed data, from Unix, last modified: Wed Jul 29 11:21:30 2009
# mv initrd.img initrd.img.gz
# gunzip initrd.img.gz
# file initrd.img
initrd.img: ASCII cpio archive (SVR4 with no CRC)
# mkdir init
# cd init
# cpio -i -I ../initrd.img
修改好後還原
# find . -print | cpio -o -H newc > ../new.initrd.img (用new ASCII格式)
# file ../new.initrd.img
new.initrd.img: ASCII cpio archive (SVR4 with no CRC)
# cd ..
# gzip -9 new.initrd.img
# mv new.initrd.img.gz new.initrd.img
2009年9月25日 星期五
如何掛載LVM格式的裝置
那我在Ubuntu 8.10下要如何去掛載這個硬碟呢!
# apt-get install lvm2 (這樣才可以使用下面一些的指令)
# modprobe dm-mod
# pvscan (查看VG是哪一個)
ex: PV /dev/sda2 VG VolGroup00 lvm2 [37.16 GB / 32.00 MB free]
Total: 1 [37.16 GB] / in use: 1 [37.16 GB] / in no VG: 0 [0 ]
# vgchange -a y VolGroup00 (-a為active y為yes , 將VolGroup00 enable)
這時 , 在/dev/下 , 就會產生VolGroup00這個裝置
# ls /dev/VolGroup00
LogVol00 LogVol01
再將這個裝置mount起來即可
# mkdir /mnt/fc4
# mount /dev/VolGroup00/LogVol00 /mnt/fc4
收工!!
詳細的LVM介紹 , 請參考下面連結
http://plog.kmjh.tc.edu.tw/post/1/91
2009年9月22日 星期二
錯誤訊息與可能可以解決的方法
~$ sudo make -j2
LD [M] ubuntu/omnibook/omnibook.o
ld: /ubuntu/omnibook/sections.lds: No such file: No such file or directory
make[2]: *** [ubuntu/omnibook/omnibook.o] Error 1
make[1]: *** [ubuntu/omnibook] Error 2
make: *** [ubuntu] Error 2
$ sudo vi /usr/src/linux/ubuntu/omnibook/Makefile
160: #EXTRA_LDFLAGS += $(src)/sections.lds
161: EXTRA_LDFLAGS += $(PWD)/ubuntu/omnibook/sections.lds
1. cannot restore segment prot after reloc permission denied
這是我在執行startx IEGD的Driver載入時會出現這個錯誤 , 判斷是Selinux的問題
因此google到一個方法
chcon -t texrel_shlib_t $(FILE)
2. perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
由於debootstrap會依照目前我電腦的設定去產生filesystem, 所以在幫客人做filesystem時會有這種語言設定的錯誤.
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
dpkg-reconfigure locales
3.
OAFILD:Gnome_FastUserSwitch Applet安裝好X server client gnome後, startx會產生的Err Msg
apt-get install fast-user-switch-applet
#### 在Fedora 10上安裝新版intel driver ####
# ./autogen.sh
syntax error near unexpected token xinerama
抓新版的xorg-x11-server-devel
# yum search xorg-x11-server-devel
# yum install xorg-x11-server-devel-i386
#### Nautilus can't be used now ####
在使用embedded debian時, 我手殘的把user加入了gdm群組, 導致重登後出現這個錯誤.
把/etc/group下, gdm後面的user刪掉即可.
Error 16: Inconsistent filesystem structure
還原後的系統, grub時所出現的錯誤, 是他不認得你的裝置格式, 通常是有錯誤才會這樣
# fsck -y -f $DEVICE_NODE
手很賤...將原先編譯的好的kernel make clean又移位,導致我要compile module時出現錯誤。
1. 先出現Module.symvers is missing
那就將module下的Module.symvers貼過去
2. 又出現scripts/mod/modpost: No such file or directory
make scripts就可以解決^_^
3. 可以編譯以及正確動作啦!
手動從console only安裝x windows server & clients後,登入時的錯誤
OAFIID:GNOME_FastUserSwitchApplet panel encountered a problem
sudo apt-get install indicator-applet-session
2009年9月16日 星期三
VIA CX700M for Kernel 2.6.18
這個問題搞了我很久...
我的錯誤決策導致浪費相當多的時間.
一開始我就決定用最省力的方式 , 直接Update Kernel到2.6.27 (Ubuntu8.10的Kernel version) , 想當然爾 , DMA在更新核心後就可以開啟了 . 但是小日本並不想更新核心 . 由於他們是使用CentOS5.3 , 所以並不想冒險去使用較新的核心.
這邊出現了一點小問題...我第一次Update Kernel到2.6.18.8時 , DMA也是可以被開啟的...但是第二次之後 , 卻一直都是失敗...我也還沒搞清楚問題在哪裡.
後來一直圍繞在第一次成功的基準 , 不斷的去更改核心選項 , 認為應該問題是在於我少勾或者是多勾了甚麼功能...所以造成非常多的時間被浪費在編譯核心.
最後更改方向 , 去VIA的論壇去看看這個晶片在2.6.18上是有甚麼問題的. 果然找到了一個可能的解決方案 . 在driver/ide/pci/via82cxxx.c內多加幾行code即可
#define PCI_DEVICE_ID_VIA_CX700 0x8324
#define PCI_DEVICE_ID_VIA_CX700-IDE 0x5324
#define PCI_DEVICE_ID_VIA_8237S 0x3372
{ “cx700”, PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }
{ “vt8237s”, PCI_DEVICE_ID_VIA_8237S, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }
{ “6410”, PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }
static struct pci_device_id via_pci_tbl[] = {
{ PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C576_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_CX700-IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0,0},
{ PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_6410, PCI_ANY_ID, PCI_ANY_ID, 0, 1, },
修改完後 , 把他編譯進核心 , 不能使用模組的方式 , 因為不知道是哪個模組會去先使用到ide的位置 , 導致這個模組用外掛的方式會失敗
重新開機後即可!!
2009年9月3日 星期四
在CF卡上安裝Ubuntu 8.10
只是我這邊在做一些筆記而已
1.格式化CF卡 , 我是分成/boot 以及 / , 沒有切swap出來用
# fdisk /dev/sda
# mkfs.ext3 -m 0 /dev/sda1
# mkfs.ext3 -m 0 /dev/sda2
-m 0 指的是不多分5%空間給root
# mkdir /mnt/sda2
# mount /dev/sda2 /mnt/sda2
2.用debootstrap做出Ubuntu 8.10的filesystem
# apt-get install debootstrap
# debootstrap --arch i386 intrepid /mnt/sda2
這邊的intrepid指的是Ubuntu 8.10的版本代碼
3.安裝Grub on /boot
# mount /dev/sda1 /mnt/sda2/boot
# grub-install --root-directory=/mnt/sda2 /dev/sda
參數代表root的位置以及你要安裝grub的裝置位置(/dev/sda 為 第一個硬碟的MBR)
# grub
grub> root (hd0,0) (指定你的 /boot 分割區位置)
grub> setup (hd0) (安裝 GRUB 到 MBR)
grub> quit (離開 GRUB shell)
# touch /mnt/sda2/boot/grub/menu.lst
在Ubuntu 8.10是去讀menu.lst , 不是grub.conf
建立自己的menu.lst
--------------------------------------------------------
ex:
default 0
timeout 3
title Ubuntu 8.10 , Kernel 2.6.27.7
root (hd0,0)
kernel /vmlinuz root=/dev/sda2 ro quiet
initrd /initrd.img
---------------------------------------------------------
3. 在Host PC上做出vmlinuz以及initrd.img
這邊就不贅述了 , 做好後把vmlinuz initrd.img 以及modules放到CF卡上
重開機後就可以用CF開機 , 並且進入你做好的Linux內了!
我做到這邊尚無X window大概花了600M的空間
4. 先把最重要的網路用起來
# vi /etc/network/interfaces
auto eth0
iface eth0 inet dhcp
# /etc/init.d/networking restart
再設定apt的sourcelist
# apt-get update
編輯fstab
# vi /etc/fstab
/dev/sda2 / ext3 relatime,errors=remount-ro 0 1
/dev/sda1 /boot ext3 relatime 0 2
5. 安裝X Window
# apt-get install xserver-xorg-core xterm gnome-core gdm (843M)
# apt-get install xbase-clients (2662K)
# X -configure
# cp ~/xorg.conf.new /etc/X11/xorg.conf
# startx
Resolution不對 , 無法顯示正確的1024x600_60.00
感覺桌面被定死在1024x768 , 所以1024x600都會造成無法顯示下面的區塊
800x600也不行...真的是Driver問題嗎!!?
恩...Driver的問題...
修改xf86-video-geode-2.11.3/src/lx_panel.c即可
6. 好用的Tools
# apt-get install pciutils (lspci)
測試用Tools
# apt-get install hdparm (hdparm)
# apt-get install ssh (可以直接在host端控制)
7. 修改user權限, 使user運作正常
由於adduser產生的user, 在Debian上沒有加入其他groups, 所以在Audio或者是network-manager的使用上有問題. 以下範例適用於debian
# usermod -g ($Userid) -a -G adm dialout cdrom plugdev netdev audio ($Userid)
8. 開機出現的錯誤訊息
mfgpt-timer: could not allocate a MFPGT timer
LX800的一個.c檔所造成
hub 1-0:1.0: unable to enumerate USB device on port 3
2009年7月24日 星期五
製作還原光碟
由於對還原光碟完全沒有概念,所以查了不少資料。
在初步查詢資料後,有兩個方案可以來嘗試製作:
方案1. 想辦法做一個LiveUSB/LiveCF/之類的東西,然後把要還原的硬碟(簡稱A)透過dd指令寫入至檔案,然後再透過ShellScript讓客戶可以方便的來把檔案dd回去A。確定可行後,再把LiveUSB/LiveCF做成LiveDVD給客人。
由於方案一實在蠻麻煩的,而且dd會有些技術上的問題,可能需要同型號同大小的硬碟才保證無誤,所以出現了方案2。
方案2. 在Linux討論區流傳著一種好用的備份還原軟體-----Clonezilla----,它是國家高速網路與計算中心自行研發出來Base on Linux的類似Ghost軟體。可至Clonezilla官網下載所需的Live版本。官網本身也有詳細的對於Clonezilla的操作介紹,在此不細談。
由於是國人自行研發的,所以有親切的中文介面,也有圖形化或者文字介面供使用者選擇,整體來說很方便。還原光碟的製作方式如下:
1. 進入LiveCD後跟著選項操作,然後選擇再生龍來使用。先把要存放映像檔的裝置mount起來,再透過選項把硬碟備份至mount的資料夾下,最後會產生一個依照你命名的資料夾,那個就是備份資料。
2. 由於要製作光碟,所以備份完後繼續操作。 選擇2`,進入command 模式。
# sudo passwd root --> 設定root的帳號密碼
# su - --> 切換成root
# rmmod pcspkr --> 關掉非常吵的蜂鳴器
# mount --> 看看存映像檔的位置被掛在哪一個路徑下
# 不知道如何mount的話,可以使用prep-ocsroot這個指令
# cd PATH --> 這裡的PATH就是映像檔掛載的位置 ex:/tmp/iso
# /opt/drbl/sbin/ocs-iso -g en_US.UTF-8 -t -k NONE -e "-b -c restoredisk ImageName sda" ImageName
--> ImageName就是備份的資料夾名稱,-g 指定語言 -k 指定KB -e 代表額外參數 , 我們選擇restore only 以及指定還原映像檔和還原的硬碟號碼
依照上述製作出的還原光碟 , 只會跳出選擇解析度以及確定是否要還原的選項
接下來插上USB,並且mount起來,把產生的iso檔存到USB上,再把檔案燒成DVD即可
接下來是我在研究如何製作還原光碟的心路歷程...
由於一開始官網的文件製作還原光碟那我看不太懂一 一,很懷疑怎麼再LiveCD上面再做一個還原光碟。所以我去嘗試修改LiveCD的iso檔內容,使用# mount -o loop livecd.iso /mnt/iso後,可以看到裡面包的東西,但是卻看不到我以為可以看得到的filesystem。原來filesystem被壓縮成filesystem.squashfs放在live內,再一次使用 # mount -o loop filesystem.squashfs /mnt/fs,也就可以看到filesystem的內容了。但是愚蠢的我天真的以為可以直接修改iso檔內的東西...但是再寫入時才發現唯讀...。需要把那些mount起來的資料夾給cp出來修改。可以修改歸可以修改...但是在修改完後又遇上更古怪的問題。
原來squashfs是一個在LiveCD上很常看到的壓縮工具。由於本來的filesystem就是靠squashfs做出來的,所以我也必須把新的filesystem給做成squashfs檔。先apt-get取得相關的套件,再使用mksquashfs做成filesystem.squashfs。但是在這邊我有碰到問題,LiveCD內所使用的squashfs是4.0的版本,而我去抓下來的是3.x的版本,所以後來我想從新mount我做的filesystem時卻不能mount,說我的squashfs太舊...
接下來是把資料夾再做成iso檔...由於Ubuntu8.10已經是使用genisoimage而不是使用以前的mkiso...所以換成genisoimage來操作。產生的iso檔燒出來...卻...是一般的資料夾...不是bootable的iso....,需要下參數才有辦法做成bootable的iso檔...但是由於趕著要出貨給客戶一 一,所以這邊放棄...以後有空在想辦法...
2009年6月26日 星期五
關於Debian版本定義
# apt-get update 他會更新成2.6 kernel的套件 , 導致我的2.4無法找到正確的套件.
Google一下 , 發現是 source.list內的敘述有問題. Debian分成很多種版本 , 每種都有各種不同的需求 , 由於我在source list內為 deb http://.../ stable , 所以他會自動幫我去抓最新的套件 , 而不是最新的2.4 kernel的套件.
以下節錄自Debian官方網站
Debian發行版有3種「風格」: stable:適用於架設產品化服務器,不適用於工作站用戶(workstation 縮寫WS) testing:適用於工作站用戶。 unstable:千萬別盲目使用。新的程度:Unstable > testing > stable。 在2002年3月時,這三個發行版對應為potato(產品化品質),woody(beta-test,非常穩定即將發佈),和sid(alpha- test)。到2002年8月,也就是woody剛剛發佈,三個發行版對應為woody(產品化品質),sarge(beta-test,有時運行不夠穩 定),和sid(總處於alpha-test)。如果unstable發行版中的軟件包不再出現Release Critical(RC)錯誤,一周後將自動升級到testing發行版。請注意,如果使用混合型Debian,例如在stable中加入testing或是在stable中加入unstable,會一不留神從testing或unstable中下載許多關鍵包,由於Unstable是最新且不穩定的,可能會造成一些意外的錯誤。
待續...XD
2009年6月12日 星期五
更新資料庫的金鑰
使用apt-get update後出現的Error
W: GPG error: http://ftp.tw.debian.org etch Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 9AA38DCD55BE302B
Method1:
debian:
# gpg --keyserver subkeys.pgp.net --recv-keys 金鑰
Ubuntu:
# gpg --keyserver keyserver.ubuntu.com --recv 金鑰
# gpg --export --armor 金鑰 | sudo apt-key add -
Method2:
http://wwwkeys.pgp.net/
Get "newkey" and save
# apt-key add "newkey"
加入CD-ROM至sourcelist
# apt-cdrom add
我的sources.list (Debian 4.0)
deb http://ftp.tw.debian.org/debian/ etch main contrib non-free
deb-src http://ftp.tw.debian.org/debian/ etch main contrib non-free
deb http://security.debian.org etch/updates main contrib non-free
deb-src http://security.debian.org etch/updates main contrib non-free
如何方便找到最佳站台
有時候安裝時,因為無相對應的Ethernet Driver,所以不能設定站台,變成要安裝好後,再手動安裝。
1. 因為剛裝好時只有DVD的dpkg可以用...所以就將安裝驅動所需的套件安裝起來
ex : gcc, linux-headers, make, autoconf...
2. 安裝Ethernet Driver (略)
3. 先設定簡易的站台,不然沒有netselect-apt可用
~$ vi /etc/apt/source.list
加入下面這兩句,就可以有最基本的套件用,我這邊是用Debian 5.0,所以是lenny
deb http://ftp.tw.debian.org/debian/ lenny main
deb-src http://ftp.tw.debian.org/debian/ lenny main
4. 更新list以及下載netselect-apt
~$ apt-get update
~$ apt-get install netselect-apt
~$ netselect-apt -s -n
-s : source
-n : non-free
5. 檢查新產生的sources.list是不是沒問題,ok的話就取代原先的sources.list
~$ cp sources.list /etc/apt/
~$ apt-get update
2009年6月8日 星期一
USB Controler
由於跟USB鍵盤的特殊按鍵結構相當,所以先從鍵盤的特殊按鍵開始下手。查了一些相關資料,主要做的事情就是找出按鍵所對應到的Keycode,然後再設定他所對應到的程式。
未完一 一
2009年6月5日 星期五
Extra Keyboard Key
Extar Keyboaed Key
Console Mode:
/* check keycode */
# showkey
GNOME Sysyem :
/* check the key map */
# xmodmap -pke
/* see which keycode or behavior under GNOME */
# xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'
/* check the GNOME keybinding status. */
# gnome-keybinding-properties"
Change HotKey Function :
1. /* Check X window default funtion */
# less /usr/share/X11/XKeysymDB
2. /* Check Hotkey keycode */
# xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'
3. /* Change Hotkey function */
# xmodmap -e "keycode `number` = `function`"
缺少keysmdef.h的話
apt-get install libxcb-keysyms0-dev
2009年6月4日 星期四
2009年5月25日 星期一
GPIO Driver
1. Insert Module
#cd mtp_ios
#make --> mtp_io.ko
#insmod mtp_io.ko
#cat /proc/devices | grep mtp_io (Driver register name) --> get module major number 121
#mknod /dev/mtp_io0 (Ap open device name) 121 0
2. Compile AP
#cd mtp_api
#make --> mtp_api.so
#cp mtp_api.so /usr/lib/.
#cd test_mtp
#make
#./test_mtp
done!!
Character Device Driver (unregister_chrdev)
error: void value not ignored as it ought to be
意思是我把一個沒有回傳值的函數當成有回傳值來使用
看了一下程式碼,發現是在這行
if (unregister_chrdev(DEV_MAJOR, DEV_NAME))
翻了一下書,Driver老師講義和聖經黑馬書上是定義如下。
int unregister_chrdev(unsigned int major, const char *name)
但是我去看了一下在 include/linux/fs.h下的定義,卻是以下
extern void unregister_chredv(unsigned int, const char*)
所以在新版本核心提供的函式~他是沒有回傳值的!!
2009年5月21日 星期四
Trace Code Tools
之前上驅動程式課程的時候,老師有稍微提到過ctags的使用方法,但是由於上課的Code都沒有大到需要用這些工具,所以也很快的就遺忘了。一直到工作後,聽到小個兒師父再次提起ctags以及cscope是很好用的trace工具,我才認真的去考慮使用它。
Vim
Vim一直是我是最愛使用的編輯器,不然拿著滑鼠複製貼上實在是很麻煩...
但是由於Ubuntu預設安裝的vim是簡易版,沒有顏色那些,所以要我習慣會抓完整的來使用
#apt-get install vim-full
Ctags
Ctags會建立搜尋點,他會把原始碼內的函式名稱以及各種變數紀錄位置。使用上,只要把游標放在要搜尋的函式或者變數上,按 Ctrl+] 就會跳到函式或者變數的定義位置,按 Ctrl+t則是返回。
#apt-get install ctags
到所要建立ctags的目錄下 # ctags -R *,就會產生tags檔。
但是呢,基本上我看的code都還不會很大,所以只要有ctags就很好用了。像小個兒那些要看kernel source的才會比較需要cscope
Cscope
Cscope是我搞比較久,也不太熟悉的東西,學到什麼再補充什麼。
去http://cscope.sourceforge.net/cscope_maps.vim,把cscope_maps.vim抓下來放到/etc/vim/下, 再去修改/etc/vim/vimrc, 多加一行 source /etc/vim/cscope_maps.vim。
例 :
# cd /usr/src/linux
# ctag -R *
# cscope -R
# vi init/main.c, 就可以使用ctags以及cscope的功能
進入vim畫面,輸入:cs show,就可以看到你剛產生的cscope已經跟你的檔案連結。
c: Find functions calling this function (找出使用這個函式的函式)
d: Find functions called by this function (找出這個函式所使用到的函式)
e: Find this egrep pattern
f: Find this file
g: Find this definition (找出定義處, 同ctags的ctrl+])
i: Find files #including this file (列出include此檔案的檔案)
s: Find this C symbol (Symbol, 以此字串當作識別子, 可以搜尋到定義以及引用處 )
t: Find assignments to (找出有包含這個字串的地方)
參考網頁:http://www.gracecode.com/manual/cscope_vim_tutorial_zh.html
2009年5月19日 星期二
Update Kernel to 2.6.29.3 on Ubuntu 8.04
由於2.6.29.1跟Intel Video Driver好像有點問題,所以升級成2.6.29.3測試
參考文件: http://www.ubuntu-tw.org/modules/newbb/viewtopic.php?post_id=73830
1.
#wget http://mirrors.kernel.org/ubuntu/pool/main/w/wireless-crda/wireless-crda_1.7_i386.deb
#dpkg -i wireless-crda_1.7_i386.deb
#wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.29.3/linux-headers-2.6.29-02062903-generic_2.6.29-02062903_i386.deb
#wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.29.3/linux-image-2.6.29-02062903-generic_2.6.29-02062903_i386.deb
#dpkg -i linux-image-2.6.29-02062903-generic_2.6.29-02062903_i386.deb
開機後,X11也變成正常開啟了,Intel Driver問題自己消失了一 一
2009年5月18日 星期一
Bison Webcam Driver
2. #tar zxf luvcview-20070512.tar.gz
3. cd ./luvcview-20070512
4. #make
Error: SDL/SDL.h is not found
5. #apt-get install libsdl1.2-dev
6. #make
7. #make install
2009年5月12日 星期二
建造屬於自己的開發環境
所以呢...每次都要慢慢想我之前到底做了啥事是很困擾的。
這篇會隨著我的使用時間而不斷的加減,減少我以後換一台電腦的麻煩。
Vim
1. #apt-get install vim-full
2. #apt-get install ctags
Develop Env
1. #apt-get install kernel-package
2. #apt-get install libncurses5-dev
3. #apt-get install gcc
4. #apt-get install autoconf
Favor
1. #apt-get install mplayer
2. #apt-get install pidgin
Inter Driver Env
#apt-get install xutils-dev
#apt-get install libtool
#apt-get install libdrm
#apt-get install libghc6-opengl-dev
解決pdf中文會亂碼的問題
去下載adobereader即可
手動更新Intel Driver
之前在公司灌的Debian 4.0用起來實在很不順手,想說換成跟家裡一樣的Ubuntu 8.10。
沒想到灌好,啟動X Window時,迎接我的是全黑的畫面一 一。
由於新版的xorg.conf已經變得比較沒用處而簡單化了。在裡面找不到我所要的資訊,必須要在文字模式下#X -configure產生詳細的xorg.conf。
Section "Device"
Driver "intel"
由於不曉得是不是驅動程式的問題,我先把預設就有的vesa拿來使用
Driver "vesa"
#Driver "intel"
#reboot
可以正常進入X Window,證明是我的Intel_drv.so有問題
先去官網抓source code xf86-video-intel-2.7.0.901.tar.bz2
先把整個需求的環境給建立好(包括編譯時出錯所要加入的套件...由於紀錄檔忘記存檔...唉)
開發環境
#apt-get install kernel-package
#apt-get install libncurses5-dev
Error: autoreconf is not found
#apt-get install autoconf
error: 'PACKAGE_VERSION_MAJOR' undeclared here (not in a function)
error: 'PACKAGE_VERSION_MINOR' undeclared here (not in a function)
error: 'PACKAGE_VERSION_PATCHLEVEL' undeclared here (not in a function)
Error: xorg-macros is not found
#apt-cache search xorg-macros
#apt-get install xutils-dev
Error: libtoolize is not found
Error: possibly undefined macro: AC_DISABLE_STATIC
Error: possibly undefined macro: AC_PROG_LIBTOOL
#apt-get install libtool
Error: GL/g1.h is not found
----- 太肥, 裝太多沒必要得東西了 -----#apt-get install libghc6-opengl-dev
$ sudo apt-get install libxvmc-dev libgl1-mesa-dev
Error: libdrm is not found
#apt-get install libdrm
Error: syntax error near unexpected token `XINERAMA,'
XORG_DRIVER_CHECK_EXT(XINERAMA, xineramaproto)
#apt-get install xorg-dev
開始編譯新的驅動程式, 指定prefix=/usr, 則是會蓋掉原先driver, 不然預設是/usr/local/, 請小心使用.
#tar jxf xf86-video-intel-2.7.0.901.tar.bz2 -C /
#cd /xf86-video-intel-2.7.0.901
#sh autogen.sh
這邊會產生錯誤訊息,說明我的libdrm版本太舊(2.3.1)
所以去抓新的libdrm libdrm-2.4.9.tar.bz2
#tar jxf libdrm-2.4.9.tar.bz2 -C /
#cd /libdrm-2.4.9
#./configure --prefix=/usr/
#make;make install
!Success
再回去編譯
#sh autogen.sh
#./configure --prefix=/usr/
#make;make install
!Success
new driver put in /usr/lib/xorg/modules/drivers/.
Modify xorg.conf
Section "Device"
Driver "Intel"
#Driver "vesa"
#reboot
收工,大工告成,可以繼續使用我愛的Ubuntu了XD
GNU/Linux and Kernel Version
Ubuntu 7.10 2.6.22
Ubuntu 8.04 2.6.24
Ubuntu 8.10 2.6.27-7
Ubuntu 9.04 2.6.28-11
Debian 4.0 2.6.18
Debian 3.1r4 2.4.27
Fedora 4 2.6.11-1.1369
Fedora 8 2.6.23
Fedora 9 2.6.25-14
Fedora 11 2.6.29.4-167.fc11.i686
RedHat Linux 7.3 2.4.18-3
RedHat Linux 7.2 2.4.7-10
CentOS 5.0 2.6.18-8.el5
CentOS 5.3 2.6.18-128.el5