如何解决无法向 Yocto 映像添加简单的内核模块 目标解决方案问题来源编辑编辑解决方案文件名和位置Bitbake 文件
目标
我想将 linux kernel source tree 中可用的触摸屏驱动程序添加到我的 Yocto 图像(链接会将您带到 goodix.c)。我基本上需要将其添加为内核模块。
解决方案
我遵循 Yocto Mega 手册的 Incorporating Out-of-Tree Modules 部分。我基于他们的示例内核模块配方,称为 hello-mod。
- 在配方
goodix-9271_0.1.bb
中:RPROVIDES_${PN} = "kernel-module-goodix"
- 在
layer.conf
中:MACHINE_EXTRA_RDEPENDS += "kernel-module-goodix"
问题
我的构建在 do_rootfs
中始终失败:
Error:
Problem: package packagegroup-base-1.0-r83.imx6ul_var_dart requires packagegroup-machine-base,but none of the providers can be installed
- package packagegroup-base-extended-1.0-r83.imx6ul_var_dart requires packagegroup-base,but none of the providers can be installed
- package packagegroup-machine-base-1.0-r83.imx6ul_var_dart requires kernel-module-goodix,but none of the providers can be installed
- conflicting requests
- nothing provides kernel-module-goodix-5.4.3-imx6ul+gb40ccfdb73ea needed by goodix-9271-0.1-r0.imx6ul_var_dart
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
阅读本节的文档后,我无法理解的是为什么会发生此错误。我尝试调整配方名称(删除内核模块前缀等),但似乎没有任何效果。出了什么问题?
来源
inherit module logging
# Driver for Goodix touchscreens
SUMMARY = "Generic driver for Goodix touchscreens"
DESCRIPTION = "Support for Goodix 1151,5663,5688,917S,9286,911,9271,9110,927,928,912,9147,and 967 touchscreens"
# License
LICENSE = "GPL-2.0"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
# Compatibility
COMPATIBLE_MACHINE = "(imx)"
# Package name
RPROVIDES_${PN} = "kernel-module-goodix"
# Source
S = "${WORKDIR}"
SRC_URI = "file://Makefile \
file://goodix.c"
# Functions
do_install() {
bbwarn "Installing Goodix kernel module ..."
bbwarn "KERNEL_SRC = ${KERNEL_SRC}"
bbwarn "KERNEL_VERSION = ${KERNEL_VERSION}"
bbwarn "WORKDIR = ${WORKDIR}"
cd ${S}
xz goodix.ko
install --verbose -d ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/input/touchscreen
install --verbose -m 0644 goodix.ko.xz ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/input/touchscreen
}
# Reference included files
FILES_${PN} = "/lib/modules/${KERNEL_VERSION}/kernel/drivers/input/touchscreen/*"
编辑
- 该错误基本上表示未提供
kernel-module-goodix-5.3.4-imx6ul+gb40ccfdb73ea
。我没有那样命名我的包裹。那么为什么它会在那里寻找带有后缀5.3.4-imx6ul+gb40ccfdb73ea
的东西?
编辑(解决方案)
对于阅读本文但对接受的答案不满意的任何人。只是知道我原来的食谱有什么问题是我没有命名我的实际食谱"kernel-module-<name>.bb"
。这实际上是所需要的。
解决方法
我之前为 UART 蓝牙驱动程序创建了一个配方,它对我来说很好用,这里是配方:
#
# FNLINK BLUETOOTH 8822 KERNEL DRIVER
#
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""
SRC_URI = "file://uart_bt.zip"
S = "${WORKDIR}/bluetooth_uart_driver"
inherit module
EXTRA_OEMAKE_append_task-install = " -C ${STAGING_KERNEL_DIR} M=${S}"
EXTRA_OEMAKE += "KDIR=${STAGING_KERNEL_DIR}"
将 S 更改为“bluetooth_uart_driver”,因为 zip 文件包含具有以下内容的目录:
ifneq ($(KERNELRELEASE),)
obj-m := hci_uart.o
hci_uart-y := hci_ldisc.o hci_h4.o hci_rtk_h5.o rtk_coex.o
#EXTRA_CFLAGS += -DDEBUG
else
PWD := $(shell pwd)
KVER := $(shell uname -r)
KDIR := /lib/modules/$(KVER)/build
all:
$(MAKE) -C $(KDIR) M=$(PWD) modules
clean:
rm -rf *.o *.mod.c *.mod.o *.ko *.symvers *.order *.a
endif
这对我来说效果很好,并且 .ko 文件已生成并传送到 /lib/modules/${KVER}/extra 中,因此您可以覆盖 do_install 函数并将其安装在您想要的位置。
简单测试:
我下载了 goodix.c 驱动程序并使用此 Makefile 为其创建了自定义配方(我修改了旧的 BT Makefile):
ifneq ($(KERNELRELEASE),)
obj-m := goodix.o
else
PWD := $(shell pwd)
KVER := $(shell uname -r)
KDIR := /lib/modules/$(KVER)/build
all:
$(MAKE) -C $(KDIR) M=$(PWD) modules
clean:
rm -rf *.o *.mod.c *.mod.o *.ko *.symvers *.order *.a
endif
我的食谱:
|meta-test/
|--> recipes-driver/
|--> files/
|--> goodix.c
|--> Makefile
|--> goodix-driver_0.1.bb
goodix-driver_0.1.bb:
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""
SRC_URI = "file://goodix.c file://Makefile"
S = "${WORKDIR}"
inherit module
EXTRA_OEMAKE_append_task-install = " -C ${STAGING_KERNEL_DIR} M=${S}"
EXTRA_OEMAKE += "KDIR=${STAGING_KERNEL_DIR}"
通过一个简单的 poky 构建,我能够生成 .ko 文件。
注意:
如果 goodix.c 存在于您的上游 Linux 内核中,这意味着您可以在以下位置找到它:
tmp/work/.../linux-../../git/drivers/input/touchscreen/goodix.c
这意味着您只需修补它而无需为其创建整个配方,您只需直接编辑它然后返回到 git 文件夹和:
git add drivers/input/touchscreen/goodix.c
git commit -m "My-updates"
git format-patch -1 -o /path/to/meta-custom/recipes-kernel/linux/files
现在,在 /path/to/meta-custom/recipes-kernel/linux/linux-xx_%.bbappend 添加:
SRC_URI_append = " file://My-updates.patch"
现在,不要忘记通过 menuconfig 激活它并将其标志添加到内核 defconfig 文件中,以便在 rootfs 中编译和发布。
,我正在用一个答案更新我的问题,该答案还描述了如何创建一个简单的内核模块 bitbake 文件。
文件名和位置
- 我的内核模块的名称:
foo
- 我的 bitbake 文件的名称:
kernel-module-foo
(需要kernel-module-
前缀) - 拓扑(见下文):
├── conf
│ └── layer.conf
├── COPYING.MIT
├── README
├── recipes-kernel
│ └── linux
│ ├── kernel-module-foo.bb
Bitbake 文件
# Bitbake class(es)
inherit module
# Dependencies
DEPENDS = "virtual/kernel"
# Metadata
SUMMARY = "Sample kernel module"
# Licensing
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5= 0835ade698e0bcf8506ecda2f7b4f302"
# Source
GIT_BRANCH = "my-branch"
SRC_URI = "git://<path-to-git-repo>;branch=${GIT_BRANCH}"
SRCREV = "<my-git-branch-src-revision>"
# OE build directives
EXTRA_OEMAKE_append_task-install = "-C ${STAGING_KERNEL_DIR} M=${S}"
EXTRA_OEMAKE += "KDIR=${STAGING_KERNEL_DIR}"
# Autoinstall (optionally disable)
KERNEL_MODULE_AUTOLOAD += "pwr_ctl_onoff"
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。