Showing posts with label modprobe. Show all posts
Showing posts with label modprobe. Show all posts

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

Apr 4, 2008

Linux Kernel modules in busybox

如果module沒有安裝到 target_rootfs裡面,在板子上就沒有module,也沒有modules.dep。
執行modprobe 會error : modprobe: cannot parse modules.dep

把modules放在busybox_rootfs裡


(~/kernel_src/linux-2.6.24.3) $ make clean

(~/kernel_src/linux-2.6.24.3) $ make

(2.6以上的kernel只要執行make就包含make zImage && make modules)

(~/kernel_src/linux-2.6.24.3) # make modules_install

// 把編譯出來的模組,複製到host機器的 /lib/modules/2.6.24.3/ (最好先把 /lib/modules 備份!)

# ls /lib/modules/2.6.24.3 -l


總計 44
lrwxrwxrwx 1 root root   35 2008-03-29 16:47 build -> /home2/fyodor/kernel/linux-2.6.24.3
drwxr-xr-x 4 root root   96 2008-03-29 16:47 kernel
-rw-r--r-- 1 root root  166 2008-03-29 16:47 modules.alias
-rw-r--r-- 1 root root   69 2008-03-29 16:47 modules.ccwmap
-rw-r--r-- 1 root root 2627 2008-03-29 16:47 modules.dep
-rw-r--r-- 1 root root   73 2008-03-29 16:47 modules.ieee1394map
-rw-r--r-- 1 root root  141 2008-03-29 16:47 modules.inputmap
-rw-r--r-- 1 root root   81 2008-03-29 16:47 modules.isapnpmap
-rw-r--r-- 1 root root   74 2008-03-29 16:47 modules.ofmap
-rw-r--r-- 1 root root   99 2008-03-29 16:47 modules.pcimap
-rw-r--r-- 1 root root   43 2008-03-29 16:47 modules.seriomap
-rw-r--r-- 1 root root 2660 2008-03-29 16:47 modules.symbols
-rw-r--r-- 1 root root  189 2008-03-29 16:47 modules.usbmap
lrwxrwxrwx 1 root root   35 2008-03-29 16:47 source -> /home2/fyodor/kernel/linux-2.6.24.3

除了build 和 source 不需要放到target檔案系統裡,其他全部複製過去

# sudo mkdir -p ~/FileSystem/rootfs/lib/modules/2.6.24.3

# sudo cp /lib/modules/2.6.24.3/* ~/FileSystem/rootfs/lib/modules/2.6.24.3

(如果有手動加 driver,還是要照對應路徑放到rootfs裡面)

Apr 2, 2008

module 相關指令 & 設定

載入名為sbc的module,包含相依的modules一起載入

# modprobe sbc
列出系統可使用的模組

# modprobe -l

(也就是/lib/modules/<kernel version>/裡面的東西 )
列出已載入的模組(比 lsmod 更詳細)

# modprobe -c
載入名為sbc的module(不包含相依模組)

# insmod sbc
列出已經載入的module

# lsmod
Module             Size   Used by    Not tainted
cbc                  3904     0
blkcipher          5796     1 cbc

移除名為sbc的module,包含相依的modules一起移除

# modprobe -r sbc
module設定檔

/etc/modules.conf 或 /etc/conf.modules,視版本而定

/lib/modules/<kernel version>/
kernel:此版本kernel 編譯出來的模組

modules.dep:模組相依性的資訊

顯示模組訊息

# modinfo sbc