有了系統呼叫的經驗,新增模組還是很順利的。
【實驗環境】
fedora,核心2.6.21.6
【實驗步驟】
1. cd /root/homework/module
2. vi process.c
3. 加入如下**:
4. vi makefile
5. 加入如下**
obj-m :=process.o
all:
make -c /lib/modules/$(shell uname -r)/build m=$(shell pwd) modules
clean:
make -c /lib/modules/$(shell uname -r)/build m=$(shell pwd) clean
6. make
7. /sbin/init 3 進入字元介面
8. insmod process.ko 顯示結果
9. rmmod process.ko 移出核心,顯示結果
linux靜態新增模組
靜態模組編譯 本文為實現在核心的.kernel drivers char新增 hello模組 wiwa tech sourcecodes kernel drivers char mkdir hello在hello資料夾下,建立以下檔案 hello.c kconfig makefile hello.c...
Linux向核心新增模組
linux核心程式設計的基礎是向核心新增自己的模組。下面就以hellomod為例,簡單的介紹一下向核心新增模組。1 編寫 hellomod.c include 所有的模組都要使用標頭檔案module.h include 標頭檔案kernel.h包含了常用的核心函式 include 包含了巨集 ini...
linux下新增libpcap模組
tar xvf libpcap 1.1.1.tar.gz 解壓 cdlibpcap 1.1.1 進入到路徑下 configure make 接著就是 make install 這時候又可能會提示yacc d grammar.y make yacc 命令未找到 make grammar.c 錯誤 12...