//file:hello_module.c
#define MODULE
#include
int init_module(void)
{
printk("Hello, world/n");
return 0;
}
void cleanup_module(void)
{
printk("Goodbye cruel world/n");
}
再进行编译等等
gcc -c hello_module.c -D__KERNEL__ -DMODULE -I /usr/src/linux-2.4/include -O -Wall
insmod ./hello_module.o
rmmod hello_module
在系统日志上可看到输出结果
cat /var/log/messages
Linux 2.4模块编译实例
最新推荐文章于 2024-09-16 11:19:03 发布