1、缺少Linux kernel头文件

To install just the headers in Ubuntu:

sudo apt-get install linux-headers-$(uname -r)

To install the entire Linux kernel source in Ubuntu:

sudo apt-get install linux-source

Note that you should use the kernel headers that match the kernel you are running.

2、内核模块编译过程ubuntu

源码 hello.c :

#include <linux/init.h>
#include <linux/module.h> MODULE_LICENSE("Dual BSD/GPL"); static int hello_init(void)
{
printk(KERN_ALERT "Hello, world\n");
return 0;
} static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world\n");
} module_init(hello_init);
module_exit(hello_exit);

Makefile文件

# at first type on ur terminal that $(uname -r) then u will get the version..
# that is using on ur system obj-m += hello.o KDIR =/usr/src/linux-headers-$(shell uname -r) all:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules clean:
rm -rf *.o *.ko *.mod.* *.symvers *.order

内核模块运行:

$ sudo insmod hello.ko
$ dmesg ==> u will get the output
$ sudo rmmod hello
$ dmesg

参考链接:http://stackoverflow.com/questions/16919512/linux-module-h-no-such-file-or-directory

linux/module.h: No such file or directory 内核模块编译过程的更多相关文章

  1. fatal error: linux/videodev.h: No such file or directory

    Run Build Command:"/usr/bin/make" "cmTC_162a3/fast"/usr/bin/make -f CMakeFiles/c ...

  2. linux/videodev.h: No such file or directory错误解决方法

    sudo apt-get install libv4l-dev* file yum install libv4l-dev* yum install libv4l-dev* 上面错误的问题是两个2.4以 ...

  3. linux e2fsprogs安装解决uuid/uuid.h: No such file or directory错误

    linux查看某个包是否安装    dpkg -l libuu*    用gcc编译发生nux 错误:fatal error: uuid/uuid.h: No such file or directo ...

  4. Linux安装redis报错:jemalloc/jemalloc.h: No such file or directory踩坑

    报错内容: 针对这个错误,我们可以在README.md 文件中看到解释: --------- Selecting a non-default memory allocator when buildin ...

  5. linux服务器安装pyspide关于rgnutls.h: No such file or directory 的解决方案

    In file included from src/docstrings.c:4:0: src/pycurl.h:148:30: fatal error: gnutls/gnutls.h: No su ...

  6. 【转】stropts.h: No such file or directory – How to Fix

    原文地址:stropts.h: No such file or directory – How to Fix 作者:xjc2694 It is a known issue that modern Li ...

  7. jemalloc/jemalloc.h: No such file or directory

    Redis 2.6.9 安装报错,提示: zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directoryzmalloc.h ...

  8. CentOS: make menuconfig error: curses.h: No such file or directory

    the problem  when use centos5 to build kernel or busybox step 1. Centos中关于 ncurses.h:no such file or ...

  9. lua.c:80:31: fatal error: readline/readline.h: No such file or directory

    make linuxcd src && make linuxmake[1]: Entering directory `/root/lua/lua-5.3.2/src'make all ...

随机推荐

  1. WebApplication和WebSite的区别

    不同点 1. 创建方式不同 一个是FILE->NEW->PROJECT->ASP.NET WEB APPLICATION 另外一个是 FILE->NEW->WEBSITE ...

  2. animation与transition

    animation 动画,无法直接决定开始时间 demo1 @-webkit-keyframes demo-animation1{ 0% { -webkit-transform:translate3d ...

  3. SqlBulkCopy类进行大数据(一万条以上)插入测试

    好多天没写博客了,刚刚毕业一个多月! 关于上一篇博客中提到的,在进行批量数据插入数据库的时候可以通过给存储过程传递一个类型为Table的参数进行相关操作,在这个过程中本人没有进行效率的测试.后来查找发 ...

  4. iOS-OC-基础-NSArray常用方法

    NSArray常用方法和属性 // ——————————————————————数组常用方法—————————————————————— // 1.计算数组元素的个数: count NSArray * ...

  5. 自定义带弹性效果的pageControl

    分三部分实现,在drawrect方法里画出灰色背景,根据pageCount创建对应个数的dotView放置在对应位置,并隐藏,创建一个CAShapeView类型的layer,根据scrollView的 ...

  6. hitTest:withEvent:方法(此方法可实现点击穿透、点击下层视图功能)

    此方法可实现点击穿透.点击下层视图功能 一. hitTest:withEvent:调用过程 iOS系统检测到手指触摸(Touch)操作时会将其放入当前活动Application的事件队列,UIAppl ...

  7. uva 1597 Searching the Web

    The word "search engine" may not be strange to you. Generally speaking, a search engine se ...

  8. 求a,b在区间上的公倍数个数

    给你两个数 a,b.问你区间 [1,N]中都是有多少个数是a,b的公倍数.当数据很大的时候,遍历肯定会超时.其实,我们可以首先求出 lcm(a,b).因为我们知道(a,b)公倍数都是它最小公倍数的倍数 ...

  9. hdu 1099 Lottery

    这是我第一次写博客,作为一个ACMer,经常进别人的博客,所以自己也想写写博客. HDU 1099 Lottery Time Limit: 2000/1000 MS (Java/Others)     ...

  10. java多线程什么时候释放锁—wait()、notify()

    由于等待一个锁定线程只有在获得这把锁之后,才能恢复运行,所以让持有锁的线程在不需要锁的时候及时释放锁是很重要的.在以下情况下,持有锁的线程会释放锁:    1. 执行完同步代码块.    2. 在执行 ...