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

#include

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

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 ...

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以 ...

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 ...

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 ...

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

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐