#vi start.c
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
static int __init hello_2_init(void)
{
printk("<1>Hello!world\n");
return 0;
}
module_init(hello_2_init);
#vi stop.c
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
static int __exit hello_2_exit(void)
{
printk("<1>Bye Bye\n");
}
module_exit(hello_2_init);
#vi Makefile
obj-m +=startstop.o
startstop=objs := start.o stop.o //多個source code所組成
#make -C /lib/modules/`uname -r`/build M=`pwd` modules
文章標籤
全站熱搜
