4,436
社区成员
发帖
与我相关
我的任务
分享
/*
* $Id: hello.c,v 1.5 2004/10/26 03:32:21 corbet Exp $
*/
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE( "Dual BSD/GPL ");
static int hello_init(void)
{
printk(KERN_ALERT "Hello, world\n ");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world\n ");
}
module_init(hello_init);
module_exit(hello_exit);
ifeq ($(KERNELRELEASE),)
KDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
modules:
$(MAKE) -C $(KDIR) M=$(PWD) modules
modules_install:
$(MAKE) -C $(KDIR) M=$(PWD) modules_install
clean:
rm -rf *.ko *.o *.mod.c
.PHONY:modules modules_install clean
else
obj-m := hello.o
endif