Ubuntu Linux下练驱动
Makefile:
PWD = $(shell pwd)
KERNEL_SRC = /usr/src/linux-headers-2.6.32-28-generic/
obj-m := test.o
module-objs := test.o
all:
$(MAKE) -C $(KERNEL_SRC) M=$(PWD) modules
clean:
rm *.ko rm *.o
test.c:
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
//#include <stdio.h>
static int __init test_init(void)
{
printk("init module\n");
return 0;
}
static void __exit test_exit(void)
{
printk("exit modules\n");
}
module_init(test_init);
module_exit(test_exit);
相关推荐
farwang 2020-11-25
星愿心愿 2020-11-24
tianhuak 2020-11-24
zhjn0 2020-11-24
昭君出塞 2020-11-23
bluecarrot 2020-11-23
linuxwcj 2020-10-21
以梦为马不负韶华 2020-10-20
彼岸随笔 2020-10-20
yutou0 2020-10-17
applecarelte 2020-10-16
ourtimes 2020-10-16
waterhorse 2020-09-19
MRFENGG 2020-11-11
rainandtear 2020-10-30
kyssfanhui 2020-10-20
liuhangtiant 2020-10-20