目标
我想在我的Yocto映像中添加一个linux内核源树中可用的触摸屏驱动程序(链接带您到goodix.c)。我基本上需要把它作为一个内核模块来添加。
解决方案
我遵循Yocto手册的合并树外模块部分。我的基础是他们的例子内核模块配方,称为你好-国防部。
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"。这实际上是我们所需要的。
发布于 2021-06-22 15:14:15
我以前已经为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//extra/${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.bbgoodix-驱动器_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文件。
注:
如果在上游Linux内核中存在goodix.c,这意味着您可以在以下文件中找到它:
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中编译和传送它。
发布于 2021-07-14 11:24:33
我正在用一个答案更新我的问题,这个答案还描述了如何创建一个简单的内核模块bitbake文件。
文件名称和位置
fookernel-module-foo (需要kernel-module-前缀)├── conf
│ └── layer.conf
├── COPYING.MIT
├── README
├── recipes-kernel
│ └── linux
│ ├── kernel-module-foo.bbBitbake文件
# 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"https://stackoverflow.com/questions/68084407
复制相似问题