模块的源文件为hello.c,源码如下:
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/delay.h>
#define HELLO_MAJOR 231
#define DEVICE_NAME "HelloModule"
static int hello_open(struct inode *inode, struct file *file)
{
printk(KERN_EMERG "hello open.\n");
return 0;
}
static ssize_t hello_write(struct file

这篇博客介绍了如何通过修改Makefile来重命名Linux内核模块的.ko文件和模块名称。在默认情况下,hello.c源文件会被编译为hello.ko模块。通过在Makefile中将obj-m改为xmodule.o并设定其依赖为hello.o,可以将生成的模块文件命名为xmodule.ko,并在系统中显示为xmodule。
最低0.47元/天 解锁文章
1318

被折叠的 条评论
为什么被折叠?



