insmod模块时候出现loading out-of-tree module taints kernel

对后续的内核insmod并无影响,可以不用管。

编译ko的linux系统内核与insmod模块的linux系统的内核树不一样导致的。

通过uname -r命令发现,2个系统的发行版号不一样。最好是找2个内核版本一样的进行编译,下述方案可能会不成功。

在书写makefile的时候,改成(insmod模块的linux系统)的内核编译,通过命令uname -r查看linux系统的发行版号。

#Makefile 2.6

obj-m:=name.o
KDIR:=/lib/modules/$(shell uname -r)/build    #需要更改
PWD:=$(shell pwd)
default:
    $(MAKE) -C $(KDIR) M=$(PWD) modules

clean:
    rm -f *.o *.ko *.symvers *.order *.mod.* *.ko.*

需要更改KDIR

insmod模块的linux系统上执行:
[root@localhost ~]# uname -r 3.10.0-693.el7.x86_64

更改编译ko的makefile文件

#Makefile 2.6

obj-m:=name.o
KDIR:=/lib/modules/3.10.0-693.el7.x86_64 /build    #更改成功
PWD:=$(shell pwd)
default:
    $(MAKE) -C $(KDIR) M=$(PWD) modules
clean:
    rm -f *.o *.ko *.symvers *.order *.mod.* *.ko.*
原文地址:https://www.cnblogs.com/ggzhangxiaochao/p/13359172.html