1. 程式人生 > >linux開機自動啟動核心模組

linux開機自動啟動核心模組

1.將編譯好的.ko模組放到目錄/lib/modules/`uname -r`/

2.注意特別重要的一步:在命令列輸入命令depmod,此命令是用來更新模組啟動配置表的,沒有depmod這個命令,就無法使用modprobe 命令來啟動模組。

3.建立/etc/sysconfig/modules/*.modules,例如要載入的模組叫helloworld.ko,然後vim建立helloworld.modules,內容為:modprobe helloworld

4.為*.modules檔案加可執行許可權,我這裡這就執行:chmod 755 helloworld.modules

5.重啟reboot

6.重啟後,檢視lsmod | grep “helloworld”

,就可以看到helloworld模組的資訊。

************************************************************************************

注意:增刪模組只能在root許可權下進行。

詳情可參考《鳥哥私房菜基礎篇》第二十章,模組那部分。