#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







文章標籤
全站熱搜
創作者介紹
創作者 布拉怡 的頭像
布拉怡

nini的部落格

布拉怡 發表在 痞客邦 留言(0) 人氣(10)