![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Linux kernel module
RichardYSteven
这个作者很懒,什么都没留下…
展开
-
One linux kernel module example
Source file: hello_world.c=================================#include #include MODULE_LICENSE("Dual BSD/GPL");static int hello_init(void){ printk(KERN_ALERT "Hello, world/n");原创 2009-07-29 12:25:00 · 834 阅读 · 0 评论 -
Cross compile the kernel module
实验了一下如何cross compile一把 kernel module。 挺简单的。 只要改动Makefile就可以了。 # If KERNELRELEASE is defined, weve been invoked from the# kernel build system and can use its language.CROSS_COMPILE = /opt/t原创 2009-08-03 14:28:00 · 1784 阅读 · 0 评论 -
Kernel Module with /proc/sys support
#include #include #include MODULE_LICENSE("Dual BSD/GPL");unsigned int hello_log;static ctl_table powersave_nap_ctl_table[]={ { .ctl_name = KERN_PPC_POWERSAVE_NAP, .原创 2009-07-31 13:57:00 · 809 阅读 · 0 评论 -
unknown symbol class_create
This is really a joke. http://forums.fedoraforum.org/showthread.php?t=97742 Solution is: MODULE_LICENSE("GPL");原创 2009-08-31 14:15:00 · 2966 阅读 · 1 评论 -
Kernel Module 的安装, 卸载 和 查询
Module的安装 insmod 或者 modprobe It differs in that it will look at the module to be loaded to seewhether it references any symbols that are not currently defined in the kernel.原创 2009-07-09 22:18:00 · 2067 阅读 · 0 评论 -
解决version magic 不一致的问题
<br />http://tldp.org/LDP/lkmpg/2.6/html/x380.html<br />编译完一个kernel module后,如果安装这个module的机器运行的不是一致的kernel,会报<br />insmod: error inserting 'poet_atkm.ko': -1 Invalid module format<br /><br />仔细看一下/var/log/message 文件可以发现是说, version magic不一致。<br />Jun 4 22转载 2010-11-17 11:39:00 · 18341 阅读 · 2 评论 -
Nonblock I/O 及其使用
<br />这是个很有趣的topic,而且这个东东影响到了kernel/driver和application之间的交互。<br /> <br />首先要来说下这个概念的东东。 当应用程序被block后,这个程序就进入了sleep状态。有可能会block的地方有:<br />1. open<br />2. read<br />3. write<br /> <br />一般情况下,文件的读写是阻塞的,可以通过fcntl()函数来设置为非阻塞读写。且这一点需要driver的配合。 <br />好,来看看一个实原创 2010-11-24 17:22:00 · 1720 阅读 · 0 评论 -
如何在kernel模块中使用已经编译好的obj文件
这也是一时心血来潮,觉得好玩。 在Document/kbuild/modules.txt中看到这么一段--- 3.3 Binary Blobs Some external modules need to include an object file as a blob. kbuild has support for this, but requires the原创 2012-01-18 17:50:56 · 3097 阅读 · 0 评论 -
pktgen的使用
1. 编译pktgen模块选中 config NET_PKTGEN2. 安装pktgen模块modprobe pktgen原创 2013-07-19 11:19:21 · 6280 阅读 · 2 评论