Yocto 树外模块安装问题(版本不兼容)

发布于 2025-01-13 00:58:42 字数 2176 浏览 1 评论 0原文

我有外部模块(设备驱动程序),我尝试在我的系统中使用它。不幸的是,系统在日志中说我的模块无法在启动过程中添加:

[FAILED] Failed to start Load Kernel Modules.

好吧,我尝试手动插入此模块:

root@reynolds:~# modprobe foo
modprobe: FATAL: Module foo not found in directory /lib/modules/5.15.10-dd1e40c-dirty-60e4bf

现在问题很明显:内核版本与模块版本不同:

root@reynolds:~# uname -a
Linux reynolds 5.15.10-dd1e40c-dirty-60e4b0f #1 Mon Feb 7 15:30:00 UTC 2022 armv5tejl armv5tejl armv5tejl GNU/Linux

然后我输入: root@reynolds~# ls /lib/modules/ 并按 Tab 键。我得到:

root@reynolds~# ls /lib/modules/5.15.10-dd1e40c-dirty-a787ea8/

所以,根本原因是版本不兼容: 5.15.10-dd1e40c-dirty-60e4b0f != 5.15.10-dd1e40c-dirty-a787ea8

当然,根据在 Yocto 手册中,“继承模块”出现在配方中:

SUMMARY = "Foo kernel driver"
DESCRIPTION = "Foo kernel driver"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263"
inherit module
SRC_URI = " \
            file://Makefile  \
            file://foo.c \
            file://LICENSE \
          "
S = "${WORKDIR}"
RPROVIDES:${PN} += "kernel-module-foo"

Makefile 对于树外也是“经典的”模块:

obj-m := foo.o
SRC := $(shell pwd)
all:
        $(MAKE) -C $(KERNEL_SRC) M=$(SRC) #"modules" can be added there, no changes
modules_install:
        $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install
clean:
        rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c
        rm -f Module.markers Module.symvers modules.order
        rm -rf .tmp_versions Modules.symvers

任何事情都是相当正确的,但是......

我该如何解决它? 我尝试解决这个问题的方法:

1:将 DEPENDS 添加到模块配方中: DEPENDS += “linux-aspeed”

不成功

2:

bitbake -ccleansstate linux-aspeed foo
bitbake -ccompile foo (to push foo module to compile immediately after linux-aspeed kernel)
bitbake obmc-phosphor-image

不成功

3:直接在 local.conf 中添加依赖:

MACHINE_ESSENTIAL_EXTRA_RDEPENDS += " kernel-module-foo"

不成功。

同样的问题仍然存在:linux-aspeed 版本与映像中的模块版本不同。

您还建议检查什么来解决这个问题?

I have external module (device driver) which I try to use in my system. Unfortunately, system says in log that my module cannot be added during boot process:

[FAILED] Failed to start Load Kernel Modules.

Well, I tried to insert this module manually:

root@reynolds:~# modprobe foo
modprobe: FATAL: Module foo not found in directory /lib/modules/5.15.10-dd1e40c-dirty-60e4bf

Now the problem is obvious: the kernel version is different from the module version:

root@reynolds:~# uname -a
Linux reynolds 5.15.10-dd1e40c-dirty-60e4b0f #1 Mon Feb 7 15:30:00 UTC 2022 armv5tejl armv5tejl armv5tejl GNU/Linux

Then I typed:
root@reynolds~# ls /lib/modules/ and press Tab. I got:

root@reynolds~# ls /lib/modules/5.15.10-dd1e40c-dirty-a787ea8/

So, root cause is versions incompatibility: 5.15.10-dd1e40c-dirty-60e4b0f != 5.15.10-dd1e40c-dirty-a787ea8

Of course, in accordance with Yocto manual, “inherit module” presents in the recipe:

SUMMARY = "Foo kernel driver"
DESCRIPTION = "Foo kernel driver"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263"
inherit module
SRC_URI = " \
            file://Makefile  \
            file://foo.c \
            file://LICENSE \
          "
S = "${WORKDIR}"
RPROVIDES:${PN} += "kernel-module-foo"

Makefile is also “classical” for out-of-tree module:

obj-m := foo.o
SRC := $(shell pwd)
all:
        $(MAKE) -C $(KERNEL_SRC) M=$(SRC) #"modules" can be added there, no changes
modules_install:
        $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install
clean:
        rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c
        rm -f Module.markers Module.symvers modules.order
        rm -rf .tmp_versions Modules.symvers

Anything is rather correct, but...

How can I fix it?
What I did trying to fix that:

1: Added DEPENDS into module recipe:
DEPENDS += “linux-aspeed”

Unsuccessfully

2:

bitbake -ccleansstate linux-aspeed foo
bitbake -ccompile foo (to push foo module to compile immediately after linux-aspeed kernel)
bitbake obmc-phosphor-image

Unsuccessfully

3: Added dependency directly in local.conf:

MACHINE_ESSENTIAL_EXTRA_RDEPENDS += " kernel-module-foo"

Unsuccesfully.

The same problem remains: linux-aspeed version is different from module version in an image.

What else would you recommend to check for fixing that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文