版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010631857/article/details/78414250
驱动文件hellop.c
-----------------------------------------------------------
#include <linux/init.h>
#include <linux/module.h>
#include<linux/moduleparam>
static char *who="world";
static int howmany=1;
module_param(who,charp,S_IRUGO);
module_param(howmany,int,S_IRUGO);
static int _init hello_init(void)
{
int i;
for(i=0;i<howmany;i++)
{
prink(KERN_WARNING "%d"helllo,%s\n",i,who);
}
return 0;
}
static void _exit hello_exit(void)
{
prink(KERN_WARNING "goodbye world\n");
}
module_init(hello_init);
module_exit(hello_exit);
MODULE_LICENSE("GPL");
--------------------------------------------------------------
可以用下面命令装载模块
insmod hellop howmany=10 who=“lwj”