测试环境:qinlin
原因:/lib/modules/4.19.90-25.23.v2101.ky10.x86_64/build没有指向正确的kernel source
[root@localhost 4.19.90-25.23.v2101.ky10.x86_64]# ls -al
总用量 16276
drwxr-xr-x 8 root root 4096 2月 15 15:06 .
drwxr-xr-x 5 root root 128 2月 15 15:19 …**
-rw-r–r-- 1 root root 362 1月 3 19:02 bls.conf
lrwxrwxrwx 1 root root 48 1月 3 19:02 build -> /usr/src/kernels/4.19.90-25.23.v2101.ky10.x86_64
-rw-r–r-- 1 root root 188616 1月 3 19:02 config
drwxr-xr-x 2 root root 6 1月 3 19:02 extra
drwxr-xr-x 4 root root 32 2月 15 15:06 internal
drwxr-xr-x 13 root root 141 2月 15 15:06 kernel
-rw-r–r-- 1 root root 873673 2月 15 15:06 modules.alias
-rw-r–r-- 1 root root 839636 2月 15 15:06 modules.alias.bin
-rw-r–r-- 1 root root 666 1月 3 19:02 modules.block
-rw-r–r-- 1 root root 7675 1月 3 19:02 modules.builtin
-rw-r–r-- 1 root root 0 2月 15 15:06 modules.builtin.alias.bin
-rw-r–r-- 1 root root 10040 2月 15 15:06 modules.builtin.bin
-rw-r–r-- 1 root root 281318 2月 15 15:06 modules.dep
-rw-r–r-- 1 root root 391219 2月 15 15:06 modules.dep.bin
-rw-r–r-- 1 root root 433 2月 15 15:06 modules.devname
-rw-r–r-- 1 root root 149 1月 3 19:02 modules.drm
-rw-r–r-- 1 root root 82 1月 3 19:02 modules.modesetting
-rw-r–r-- 1 root root 1608 1月 3 19:02 modules.networking
-rw-r–r-- 1 root root 99386 1月 3 19:02 modules.order
-rw-r–r-- 1 root root 614 2月 15 15:06 modules.softdep
-rw-r–r-- 1 root root 412128 2月 15 15:06 modules.symbols
-rw-r–r-- 1 root root 500035 2月 15 15:06 modules.symbols.bin
lrwxrwxrwx 1 root root 5 1月 3 19:02 source -> build
-rw-r–r-- 1 root root 345053 1月 3 19:02 symvers.gz
-rw------- 1 root root 3727275 1月 3 19:02 System.map
drwxr-xr-x 2 root root 6 1月 3 19:01 updates
drwxr-xr-x 2 root root 40 2月 15 15:06 vdso
-rwxr-xr-x 1 root root 8927104 1月 3 19:02 vmlinuz
-rw-r–r-- 1 root root 176 1月 3 19:00 .vmlinuz.hmac
drwxr-xr-x 2 root root 6 1月 3 19:01 weak-updates
[root@localh我的终端上,标注的那两行会一闪一闪的,提示我链接有问题。
原因是没有内核开发包,下载安装即可:
yum install kernel-devel-$(uname -r)
有的内核版本可以下载成功,有的还是找不到对应的包,会报错:No package kernel-devel-3.10.0-1127.el7.x86_64 available.
可以不指定内核版本下载安装:
yum install kernel-devel
然后替换软连接:
cd /lib/modules/4.19.90-25.23.v2101.ky10.x86_64/
rm -f build
ln -s /usr/src/kernels/4.19.90-25.23.v2101.ky10.x86_64/ build
安装完再去make你自己的代码。