linux - 无法插入某些 Linux 模块。各种错误

标签 linux module kernel

我正在尝试插入 W1_ds2431.ko 模块,它是 Linux 内核驱动程序的一部分。我确定它是针对正确的内核( 4.9.0 )构建的,因为它也是使用相同的工具构建的。

到目前为止,我已成功插入其他模块,例如 w1_therm.ko 和 DMA 模块,但我无法插入我想要的模块。

uname -a:

Linux zynq 4.9.0-xilinx-v2017.2 #1 SMP PREEMPT Tue Aug 7 20:15:30 CEST 2018 armv7l armv7l armv7l GNU/Linux

dmesg:

    [    1.194791] Driver for 1-wire Dallas network protocol.
    [    2.830092] w1_gpio: disagrees about version of symbol module_layout
    [    2.836798] w1_ds2431: disagrees about version of symbol module_layout

    [  641.626862] w1_therm: no symbol version for module_layout

sudo modprobe w1-gpio:(与 w1_ds2431 相同)

modprobe: ERROR: could not insert 'w1_gpio': Exec format error

modinfo w1_ds2431.ko:

alias:          w1-family-0x2D
description:    w1 family 2d driver for DS2431, 1kb EEPROM
author:         Bernhard Weirich <bernhard.weirich riedel.net>
license:        GPL
depends:        wire
intree:         Y
vermagic:       4.9.0-xilinx-v2017.2 SMP preempt mod_unload modversions ARMv7 p2v8 

lsmod:

Module                  Size  Used by
w1_therm                4468  0
axidmaio                9237  0

我不知道如何解决这个问题。我尝试了各种方式来插入这些模块。

最佳答案

记录在案以及遇到此问题的任何其他人;问题是由于设备树实现不当造成的。内核调试有些误导。

我的 dts 文件条目现在看起来像:

    onewire_tm: onewire@0 {
            compatible = "w1-gpio";
            gpios = <&gpio0 9 0>;

            eeprom1: eeprom@0 {
                     compatible ="maxim,w1_ds2431";
            };

如果配置正常,内核会扫描合适的单线设备并在/sys/bus/w1/devices 中创建虚拟文件夹

在那里您可以找到作为文件夹的芯片 ID,您可以读取/写入芯片。 在这种特定情况下,它是一个 eeprom 芯片。

测试写做:

echo 222 > /sys/bus/w1/devices/2d-000004375e73/eeprom

回读:

cat /sys/bus/w1/devices/2d-000004375e73/eeprom

这会给你:

222

关于linux - 无法插入某些 Linux 模块。各种错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51891874/

相关文章:

linux - 未找到体系结构 x86_64、macOS Sierra

linux - 如何通过SLIP、串口向wifi模块发送命令?

angular - 使用 SystemJS-builder 捆绑 Angular 2 提前编译器文件

node.js - 你如何制作 Hapi.JS 插件/模块?

linux - insmod : ERROR: could not insert module : No child processes

linux - 使用 ack 搜索多个模式(单词)?

linux - 用于检查创建的 AMI 是否可用的脚本,

linux - 将 grep 搜索从多个文件粘贴到一个新文件

c -/proc 文件系统挂起我的系统

linux - 我们可以在内核空间调用系统调用吗?