为 5.10.0-rc5 构建内核,但当我执行 insmod 时,它抱怨它是 5.4.21
我曾经针对 5.4.21 构建内核模块,但今天我针对 5.10.0-rc5 构建它。
但是当我在虚拟机中启动 linux 5.10.0-rc5 后执行 insmod 时,它会这样抱怨。
/test1 # insmod axpu_ldd_kc.ko
[ 3331.286276] axpu_ldd_kc: version magic '5.4.21 SMP preempt mod_unload aarch64' should be '5.10.0-rc5 SMP preempt mod_unload aarch64'
insmod: can't insert 'axpu_ldd_kc.ko': invalid module format
因此,5.4.21 设置用于驱动程序。我为 5.10.0-rc5 构建的模块的 Makefile 是这样的。
export CROSS_COMPILE:=aarch64-none-linux-gnu-
export ARCH:=arm64
obj-m += axpu_ldd_kc.o
# test for ubuntu
export KDIR:=/home/ckim/ProjX/LinuxDevDrv/kernel-release-RD-INFRA-2020.11.30
ccflags-y:=-I/home/ckim/ProjX/QEMU/qemu-6.2.0/hw/misc
ccflags-y+=-I../../../../../axpusim/axpu
ccflags-y+=-I$(PWD)
all:
make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KDIR) M=$(PWD) modules
clean:
make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KDIR) M=$(PWD) clean
有什么问题吗? (/home/ckim/ProjX/LinuxDevDrv/kernel-release-RD-INFRA-2020.11.30 目录是 5.10.0-rc5)
已解决:
感谢您的评论。我发现出了什么问题。在VM中,我使用tftp来获取驱动程序和应用程序。为了获取驱动程序,我执行了 tftp -g -r axpu_ldd_kc.ko 129.254.32.30。我认为我的机器的 tftp 服务器目录(129.254.32.30)是 /opt/tftp 并将驱动程序和应用程序放在那里。但事实证明我的 tftp 服务器目录是 /srv/tftp (ubuntu 20.04,在 /etc/default/tftpd-hpa 中设置)。所以我在 /srv/tftp 中使用旧的驱动程序文件。 :) 我忘记了 /srv/tftp 是新的服务器目录。
I used to build my kernel module against 5.4.21 but today I built it against 5.10.0-rc5.
But when I do insmod after linux 5.10.0-rc5 is booted in a virtual machine, it complains like this.
/test1 # insmod axpu_ldd_kc.ko
[ 3331.286276] axpu_ldd_kc: version magic '5.4.21 SMP preempt mod_unload aarch64' should be '5.10.0-rc5 SMP preempt mod_unload aarch64'
insmod: can't insert 'axpu_ldd_kc.ko': invalid module format
So somewhere the 5.4.21 setting is used for the driver. My Makefile for the module build for 5.10.0-rc5 is like this.
export CROSS_COMPILE:=aarch64-none-linux-gnu-
export ARCH:=arm64
obj-m += axpu_ldd_kc.o
# test for ubuntu
export KDIR:=/home/ckim/ProjX/LinuxDevDrv/kernel-release-RD-INFRA-2020.11.30
ccflags-y:=-I/home/ckim/ProjX/QEMU/qemu-6.2.0/hw/misc
ccflags-y+=-I../../../../../axpusim/axpu
ccflags-y+=-I$(PWD)
all:
make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KDIR) M=$(PWD) modules
clean:
make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KDIR) M=$(PWD) clean
What can be wrong? (the /home/ckim/ProjX/LinuxDevDrv/kernel-release-RD-INFRA-2020.11.30 directory is 5.10.0-rc5)
SOLVED :
thanks for the comments. I found what was wrong. In the VM, I used tftp to get the driver and application. To get the driver I did tftp -g -r axpu_ldd_kc.ko 129.254.32.30. And I thought my tftp server directory of my machine (129.254.32.30) is /opt/tftp and placed the driver and app there. But it turns out my tftp server directory was /srv/tftp (ubuntu 20.04, set in /etc/default/tftpd-hpa). So I was using old driver file in /srv/tftp. :) I have forgot /srv/tftp is the new server directory.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论