lsmod | 把現在 kernel 中插入的 modules 列出來 |
insmod | 把某個 module 插入 kernel 中 |
rmmod | 把某個沒在用的 module 拔出 kernel |
depmod | 制造 module dependency file,以告訴將來的 insmod 要去哪兒抓
modules 來插。這個 dependency file 就在
|
kerneld | 一個 daemon,可負責自動呼叫 insmod 插入 module,是一個很方便 的 daemon。它也同時查看,若某 module 插入後但很久沒人在用了,就會把它 拔出來,以省記憶體。 |
PATH=/sbin:/usr/sbin:/bin:/usr/bin # enable swapping /sbin/swapon -a # Start update. /sbin/update & # # Now, start kerneld as soon as possible, so that any disk # driver modules can be loaded "automagically" if [ -x /sbin/kerneld ] then /sbin/kerneld fi |
# # If everything went well, we remount the root filesystem read/write # echo "Re-mounting root file system read-write" /sbin/mount -w -n -o remount / # # Then do some standard clean-up: # rm -f /etc/mtab~ /etc/fastboot /etc/nologin #這部份可能和您的系統 rc.S 不太一樣, 請不要照抄! #cat /dev/null > /etc/mtab cat /dev/null > /var/adm/utmp # 以下才是我們要加的第二部份 # The code from here, down to "#=========" can be put in a separate script # # Create a generic link to the modules for the current kernel # # You can have generic symbolic links in /lib/modules/boot # if you create links to: "../current/subsystem/module.o" # rm /lib/modules/current ln -s /lib/modules/`uname -r` /lib/modules/current if [ \! -r /lib/modules/current/modules.dep ] then echo "Creating module dependencies" /sbin/depmod -a fi # # Load the boot modules # if [ -x /sbin/kerneld ] then if find /lib/modules/boot -type f -o type l > /dev/null 2>&1 then echo "Loading boot-time modules" /sbin/modprobe -a -t boot \* fi else echo "Loading modules" /sbin/modprobe -a \* fi #=============================================== |
root system 所在:
您的 kernel binary 格式?
大概就這些吧,是不可以 compile 成 module 的。而原本沒有提供 M 的 kernel config 選項者,要用到的話當然只能乖乖地回答 Y 羅!
* * Loadable module support * Enable loadable module support (CONFIG_MODULES) [Y/n/?] Set version information on all symbols for modules (CONFIG_MODVERSIONS) [N/y/?] Kernel daemon support (e.g. autoload of modules) (CONFIG_KERNELD) [Y/n/?] |
分別回答 Y,N,Y 的值就對了。其中 CONFIG_KERNELD 的 default 值是 N, 所以要注意一下。
我 review 了一下,覺得我自己寫得不是很能令人看得懂,不過至少可以給您一 個參考就是了,湊合著用吧。您自己的經驗才是最重要的。