Yocto 加载内核模块 [英] Yocto load kernel module
问题描述
我尝试将内核模块添加到 yocto 映像并在启动时加载它.
I try to add a kernel module to a yocto image and load it on boot.
我创建了一个配方来构建和安装内核模块.这是 Makefile 内容的一部分:
I create a recipe to build and install a kernel module. Here's a part of the Makefile content:
modules_install: test_driver.ko
install -d $(MODULES_DIR)
install -m 0755 $< $(MODULES_DIR)
在我的 build/conf/local.conf 中,我添加了包(子系统是我的模块配方的名称):
In my build/conf/local.conf, I add the package (subsystem being the name of my module recipe):
IMAGE_INSTALL_append = "子系统"
构建镜像后,我可以在 MODULES_DIR 目录中找到 .ko 文件(即 /lib/modules/(shell uname -r)/kernel/drivers/test
).
After building the image, I can find the .ko file inside the MODULES_DIR directory (being /lib/modules/(shell uname -r)/kernel/drivers/test
).
我现在想做的是在启动时加载这个模块.我发现了一些关于 KERNEL_MODULE_AUTOLOAD
和 MACHINE_ESSENTIAL_*/MACHINE_EXTRA_*
的线索.所以我在 build/conf/local.conf
或我的模块中尝试 KERNEL_MODULE_AUTOLOAD += "subsystem"
甚至 KERNEL_MODULE_AUTOLOAD += "test_driver"
配方,但我无法在启动时加载驱动程序.
I want to do now is to load this module on boot. I found some clues about KERNEL_MODULE_AUTOLOAD
and MACHINE_ESSENTIAL_*/MACHINE_EXTRA_*
.
So I try KERNEL_MODULE_AUTOLOAD += "subsystem"
or even KERNEL_MODULE_AUTOLOAD += "test_driver"
in build/conf/local.conf
or in my module recipe, but I couldn't have the driver loaded on boot.
我正在使用 fsl-image-machine-test 图像(相扑版).
I'm working against the fsl-image-machine-test image (sumo version).
推荐答案
KERNEL_MODULE_AUTOLOAD 需要在 local.conf 文件之外.我现在把它放在我的模块配方中.
The KERNEL_MODULE_AUTOLOAD need to be outside of the local.conf file. I put it now in my module recipe.
它需要加载模块的名称而不是配方,就我而言:
It needs to load the name of the module not the recipe, in my case :
KERNEL_MODULE_AUTOLOAD += "test_driver"
.
这篇关于Yocto 加载内核模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!