我正在尝试在我的 Fedora 34 上为 Heber X10i I/O 控制器构建驱动程序,但我未能将模块插入内核,显示“模块格式无效”。
我遵循了所有可用的教程/提示/问答,但仍然没有成功运行它,我是否在 Fedora 方面遇到了一些错误?任何有远见的想法都会受到欢迎。
生成文件:
xline-objs := xline_driver.o
obj-m := xline.o
KVERSION:=$(shell uname -r)
KDIR:= /lib/modules/$(KVERSION)/build
PWD:= $(shell pwd)
modules:
$(MAKE) -C $(KDIR) M=$(PWD) modules
install: modules
$(MAKE) -C $(KDIR) M=$(PWD) modules_install
depmod -a
clean:
$(MAKE) -C $(KDIR) M=$(PWD) clean
all: install
编译顺利,结果 xline.ko 存在,它的 modinfo 如下:
filename: /lib/modules/5.13.12-200.fc34.x86_64/extra/xline.ko
author: Heber Limited <http://www.heber.co.uk>
description: Heber X-line Kernel Driver
license: GPL
alias: usb:v0FB6p3FCEd*dc*dsc*dp*ic*isc*ip*in*
alias: usb:v0FB6p3FCDd*dc*dsc*dp*ic*isc*ip*in*
alias: usb:v0FB6p3FCCd*dc*dsc*dp*ic*isc*ip*in*
alias: usb:v0FB6p3FCBd*dc*dsc*dp*ic*isc*ip*in*
alias: usb:v0FB6p3FCAd*dc*dsc*dp*ic*isc*ip*in*
alias: usb:v0FB6p3FC9d*dc*dsc*dp*ic*isc*ip*in*
alias: usb:v0FB6p3FC8d*dc*dsc*dp*ic*isc*ip*in*
alias: usb:v0FB6p3FC7d*dc*dsc*dp*ic*isc*ip*in*
alias: usb:v0FB6p3FC4d*dc*dsc*dp*ic*isc*ip*in*
alias: usb:v0FB6p3FC3d*dc*dsc*dp*ic*isc*ip*in*
alias: usb:v0FB6p3FC6d*dc*dsc*dp*ic*isc*ip*in*
alias: usb:v0FB6p3FC5d*dc*dsc*dp*ic*isc*ip*in*
depends:
retpoline: Y
name: xline
vermagic: 5.13.12-200.fc34.x86_64 SMP mod_unload
sig_id: PKCS#7
signer: Owner
sig_key: 34:F4:D8:C0:AB:0D:8D:1A:42:F8:BE:92:03:57:7E:7E:00:81:0E:06
sig_hashalgo: sha512
signature: 0F:9F:01:85:BF:64:E8:49:03:2E:74:0D:4C:C4:DE:A8:9C:82:67:4A:
20:41:24:F6:C3:73:41:00:6A:84:20:C9:37:94:CF:1B:95:43:C6:3D:
E2:5C:B4:7F:28:D0:5F:DA:58:C2:54:CC:AD:D8:00:A5:CA:72:56:CF:
FD:81:01:CC:3D:C9:CB:8C:C2:FF:80:DD:89:34:CB:5E:E6:15:BC:37:
83:8C:4A:D1:44:A9:05:BE:B7:28:C6:6A:76:F3:11:F8:7A:07:CF:75:
BC:13:6A:41:BE:A4:40:43:84:D9:2F:5F:F9:EC:77:E2:1E:B5:FA:18:
8F:02:54:2E:0A:4C:33:41:52:2A:66:69:04:1A:58:C2:0C:17:27:C6:
FA:3B:B6:35:B3:77:6D:F0:73:0A:BA:93:9E:89:FE:48:F8:11:23:BA:
FF:7E:C8:3C:38:43:77:C0:74:31:89:65:70:C4:BB:17:5A:76:B5:C7:
D3:74:B0:B9:11:BE:02:28:40:DE:07:5E:81:AE:17:E3:D0:65:81:71:
B0:5D:0D:2F:65:41:3E:14:AE:D7:32:6A:2C:A4:FD:FE:A2:B9:C6:13:
10:59:EC:EB:9D:B2:1A:DD:3C:F4:C7:3A:0B:48:CA:FC:81:0E:D1:88:
18:A3:5E:69:F8:55:5E:2C:4B:34:14:DF:F0:E4:B6:E3
猫 /proc/版本:
Linux version 5.13.12-200.fc34.x86_64 (mockbuild@bkernel01.iad2.fedoraproject.org) (gcc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-1), GNU ld version 2.35.2-4.fc34) #1 SMP Wed Aug 18 13:27:18 UTC 2021
gcc --版本:
gcc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-1)
ld --版本:
GNU ld version 2.35.2-5.fc34
dmesg:
module: x86/modules: Skipping invalid relocation target, existing value is nonzero for type 1, loc 00000000afa6010b, val ffffffffc19e9af2
yum 列表安装 | grep 内核:
kernel.x86_64 5.11.12-300.fc34 @anaconda
kernel.x86_64 5.13.10-200.fc34 @updates
kernel.x86_64 5.13.12-200.fc34 @updates
kernel-core.x86_64 5.11.12-300.fc34 @anaconda
kernel-core.x86_64 5.13.10-200.fc34 @updates
kernel-core.x86_64 5.13.12-200.fc34 @updates
kernel-devel.x86_64 5.13.10-200.fc34 @updates
kernel-devel.x86_64 5.13.12-200.fc34 @updates
kernel-headers.x86_64 5.13.3-200.fc34 @updates
kernel-modules.x86_64 5.11.12-300.fc34 @anaconda
kernel-modules.x86_64 5.13.10-200.fc34 @updates
kernel-modules.x86_64 5.13.12-200.fc34 @updates
kernel-modules-extra.x86_64 5.11.12-300.fc34 @anaconda
kernel-modules-extra.x86_64 5.13.10-200.fc34 @updates
kernel-modules-extra.x86_64 5.13.12-200.fc34 @updates
kernel-tools.x86_64 5.13.6-200.fc34 @updates
kernel-tools-libs.x86_64 5.13.6-200.fc34 @updates
我试图找到 kernel-headers 5.13.12 但没有成功。
一句话:驱动程序代码 xline_driver.c 已过时,所以我修复了它 - 但这应该是一个可执行问题(如果有的话)。
编辑:代码的整个过程适用于 linux-mint (ubuntu) 5.4.0-74-generic (为什么不在 Fedora 上?)