X86 LINUX Driver "Hello world!" example

mail:[email protected]

qq:196568501

author:DriveMonkey

phone:13410905075


Source:

#include <linux/init.h>
#include <linux/module.h>

MODULE_LICENSE("Dual BSD/GPL");

static int mmap_init(void)
{
	printk(KERN_ALERT"Hello world!\n");

	return 0;
}

static void mmap_exit(void)
{
	printk(KERN_ALERT"Bye World!\n");
}

module_init(mmap_init);
module_exit(mmap_exit);

Makefile:

#obj-$(CONFIG_MMP_TEST)			+= mmap.o

obj-m := mmap.o  
KERNELDR := /usr/src/linux-headers-2.6.32-38-generic/
PWD := $(shell pwd)  
modules:  
	$(MAKE) -C $(KERNELDR) M=$(PWD) modules  
moduels_install:  
	$(MAKE) -C $(KERNELDR) M=$(PWD) modules_install  
clean:  
	rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions  



你可能感兴趣的:(X86 LINUX Driver "Hello world!" example)