无法向 Yocto 映像添加简单的内核模块 目标解决方案问题来源编辑编辑解决方案文件名和位置Bitbake 文件

如何解决无法向 Yocto 映像添加简单的内核模块 目标解决方案问题来源编辑编辑解决方案文件名和位置Bitbake 文件

目标

我想将 linux kernel source tree 中可用的触摸屏驱动程序添加到我的 Yocto 图像(链接会将您带到 goodix.c)。我基本上需要将其添加为内核模块。

解决方案

我遵循 Yocto Mega 手册的 Incorporating Out-of-Tree Modules 部分。我基于他们的示例内核模块配方,称为 hello-mod

  1. 在配方 goodix-9271_0.1.bb 中:RPROVIDES_${PN} = "kernel-module-goodix"
  2. 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/*"

编辑

  1. 该错误基本上表示未提供 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 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 &lt;select id=&quot;xxx&quot;&gt; SELECT di.id, di.name, di.work_type, di.updated... &lt;where&gt; &lt;if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 &lt;property name=&quot;dynamic.classpath&quot; value=&quot;tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-