//我的hello.c,makefile请从我的资源中下载
/*第一个驱动程序hello world*/
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");//告诉内核,该模块才用了自由许可证,否则转载时会遭到内核抱怨
static int hello_init(void)//装载时运行
{
printk(KERN_ALERT "hello world! This is a first drivers of WYJ./n");//printk()内核态的输出函数;KERN_ALERT,显示的优先级
return 0;
}
static void hello_exit(void)//卸载时运行
{
printk(KERN_ALERT "Goodbye,cruel world. My first drivers is over!/n");
}
module_init(hello_init); //指定装载时调用的函数
module_exit(hello_exit); //指定卸载时调用的函数
//存在问题:printk的字符串中若中间有'/n'则只能显示一半.
/*第一个驱动程序hello world*/
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");//告诉内核,该模块才用了自由许可证,否则转载时会遭到内核抱怨
static int hello_init(void)//装载时运行
{
printk(KERN_ALERT "hello world! This is a first drivers of WYJ./n");//printk()内核态的输出函数;KERN_ALERT,显示的优先级
return 0;
}
static void hello_exit(void)//卸载时运行
{
printk(KERN_ALERT "Goodbye,cruel world. My first drivers is over!/n");
}
module_init(hello_init); //指定装载时调用的函数
module_exit(hello_exit); //指定卸载时调用的函数
//存在问题:printk的字符串中若中间有'/n'则只能显示一半.