- 论坛徽章:
- 0
|
回复 3# beyondfly
感谢大神,成功了,但是没有输出,下面是新代码的过程:
[oracle@localhost ~]$ su -
密码:
上一次登录:六 8月 16 16:13:07 CST 2014pts/0 上
[root@localhost ~]# cd /home/oracle/my_kernel_iptables/
[root@localhost my_kernel_iptables]# cat aaa.c
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
static int hello_init(void)
{
printk("<1>aaaaa!\n");
return 0;
}
static void hello_exit(void)
{
printk("<1>hello\n");
}
module_init(hello_init);
module_exit(hello_exit);
[root@localhost my_kernel_iptables]# cat Makefile
ifneq ($(KERNELRELEASE),)
obj-m:=aaa.o
else
KERNELDIR:=/lib/modules/$(shell uname -r)/build
PWD:=$(shell pwd)
default:;$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
clean:;rm -rf *.o *.mod.c *.mod.o *.ko
endif
[root@localhost my_kernel_iptables]# make
make -C /lib/modules/3.15.8-200.fc20.x86_64/build M=/home/oracle/my_kernel_iptables modules
make[1]: 进入目录“/usr/src/kernels/3.15.8-200.fc20.x86_64”
Building modules, stage 2.
MODPOST 1 modules
make[1]: 离开目录“/usr/src/kernels/3.15.8-200.fc20.x86_64”
[root@localhost my_kernel_iptables]# insmod aaa.ko
[root@localhost my_kernel_iptables]# lsmod |grep aaa
aaa 12496 0
[root@localhost my_kernel_iptables]# rmmod aaa
[root@localhost my_kernel_iptables]#
但是insmod rmmod为什么都没有输出那?
|
|