[英]How to insert kernel module from userspace app?
I am looking for one thing: 我在寻找一件事:
How can i insert kernel module from userspace program? 如何从用户空间程序插入内核模块? can anyone please provide me any example related to this scenario?
谁能给我提供与此情况有关的任何示例吗?
Thanks 谢谢
Raheel 拉海尔
After a little search, I found that there's a system call named 稍作搜索后,我发现有一个名为
#include <linux/module.h>
int init_module(const char *name, struct module *image);
You can take a look at this man page if you want further details. 如果需要更多详细信息,可以查看此手册页。
http://www.kernel.org/doc/man-pages/online/pages/man2/init_module.2.html http://www.kernel.org/doc/man-pages/online/pages/man2/init_module.2.html
Thank you Adel C Kod, I just resolved that issue, here I am posting a simple sample code: 谢谢Adel C Kod,我刚刚解决了这个问题,在这里我发布了一个简单的示例代码:
char cmnd[10];
if (strcmp(cmnd, "insert")==0) {
system ("/sbin/insmod /home/xyzUBUNtu/Desktop/MyMod/kernel1.ko");
printf("Your Module inserted");
return 1;
}
thanks 谢谢
Raheel.. Raheel ..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.