yocto – create a meta layer with a bbappend file adding dts flle to raspberry pi kernel

huangapple go评论64阅读模式
英文:

yocto - create a meta layer with a bbappend file adding dts flle to raspberry pi kernel

问题

以下是翻译好的内容:

我正在使用 Yocto Kirkstone。我的目标是将一个dts文件添加到树莓派Linux内核中。我遵循了这个答案,最终创建了一个新的元层和这个目录结构:

meta-main-layer
meta-raspberrypi
meta-mydts/
├── conf
│    └── layer.conf
├── COPYING.MIT
├── README
└── recipes-kernel
    └── linux
        ├── linux-raspberrypi
        │    └── raspberrypi4-64
        │        └── my.dts
        └── linux-raspberrypi_5.15.bbappend

以及 linux-raspberrypi_5.15.bbappend 文件:

SRC_URI += "file://mydts.dts;subdir=git/arch/arm/boot/dts/overlays"

FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"

PACKAGE_ARCH = "${MACHINE_ARCH}"
KERNEL_DEVICETREE += "mydst.dtb"

meta-main-layer 是包含图像定义的层,它确实包括 meta-mydts,并且在其中添加了以下内容:

IMAGE_INSTALL:append += " mydts"

但出于某种原因,yocto 报错,说找不到目标 mydts,如下所示:

ERROR: Nothing RPROVIDES 'mydts' (but meta-main-layer/recipes-core/images/image-64.bb RDEPENDS on or otherwise requires it)
NOTE: Runtime target 'mydts' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['mydts']

如何将具有Linux内核补丁的元层变成可构建的内容?我漏掉了什么?

英文:

I'm working with Yocto Kirkstone. My goal is to add a dts file to the raspberry pi linux kernel. I followed this answer and ended up with a new meta-layer and this directory tree:

meta-main-layer
meta-raspberrypi
meta-mydts/
├── conf
│   └── layer.conf
├── COPYING.MIT
├── README
└── recipes-kernel
    └── linux
        ├── linux-raspberrypi
        │   └── raspberrypi4-64
        │       └── my.dts
        └── linux-raspberrypi_5.15.bbappend

and the linux-raspberrypi_5.15.bbappend:

SRC_URI += "file://mydts.dts;subdir=git/arch/arm/boot/dts/overlays"

FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"

PACKAGE_ARCH = "${MACHINE_ARCH}"
KERNEL_DEVICETREE += "mydst.dtb"

meta-main-layer is the layer with image definition, it does include the meta-mydts with

IMAGE_INSTALL:append += " mydts"

but for some reason yocto complains saying that there's no target mydts as below:

ERROR: Nothing RPROVIDES 'mydts' (but meta-main-layer/recipes-core/images/image-64.bb RDEPENDS on or otherwise requires it)
NOTE: Runtime target 'mydts' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['mydts']

How can a meta-layer with linux kernel patches be turned into something that is buildable? What am I missing?

答案1

得分: 1

你应该阅读Yocto文档RPROVIDE

基本上,你希望Bitbake能够识别你的元层。
当你希望在最终目标中部署一个包时,需要使用IMAGE_INSTALL:append。例如,如果在my_helloworld.bb中有SRC_URI += "helloworld.c",那么IMAGE_INSTALL:append = my_helloworld将在最终目标中添加你的二进制文件helloworld.o

现在你可以理解尝试将整个元层附加到IMAGE_INSTALL:append是不合理的。

使你的元层被Bitbake“发现”的正确方法是进入你的构建目录,在conf/bblayers.conf文件中的BBLAYERS变量中添加你的元层路径。

还要注意KERNEL_DEVICETREE += "mydst.dtb"中存在语法错误。
它应该是KERNEL_DEVICETREE += "mydts.dtb"

英文:

You should read Yocto documentation RPROVIDE.

Basically you want Bitbake to recognize your meta-layer.
IMAGE_INSTALL:append is needed when you want to deploy a package in your final target. For example you have SRC_URI += "helloword.c" in my_helloword.bb then
IMAGE_INSTALL:append = my_helloworld will add your binary helloword.o in final target.

Now you can understand trying to IMAGE_INSTALL:append a whole meta-layer is nonsense.

The proper way to make your meta-layer "discoverable" by bitbake is to go in your build directory, add in your conf/bblayers.conf file the path of your meta-layer in the variable BBLAYERS.

Also note that there is a syntax error in KERNEL_DEVICETREE += "mydst.dtb"
It should be KERNEL_DEVICETREE += "mydts.dtb"

答案2

得分: 1

我已经找到问题并决定在这里发布步骤。这基于@void_brain的答案和@bvarner的帖子。以下说明适用于Yocto Kirkstone 4.01

.dts*文件名必须包括-overlay.dts后缀,每个树莓派dt-overlay文件都必须遵循这个约定(步骤2)。请注意,Device Tree Blob.dtbo*文件不再可以包含这个后缀(步骤3)。

要添加自定义**-overlay.dts*文件,请按照以下步骤操作:

  1. 首先,使用source poky/oe-init-build-env进入yocto项目的环境,以便访问bitbake命令。稍后为**overlay-dts*文件创建一个新层:

    $ bitbake-layers create-layer meta-mydts
    
  2. 使用recipetool命令将**-overlay.dts文件导入新创建的meta层。它将创建recipes-kernel/linux目录,并包含一个linux-raspberrypi_%.bbappend文件。如果你的**-overlay.dts文件是为特定机器制作的,例如raspberrypi4-64,请在-wm参数中包括它的名称。

    recipetool appendsrcfile -wm raspberrypi4-64 . virtual/kernel path/to/mydts-overlay.dts 'arch/${ARCH}/boot/dts/overlays/mydts-overlay.dts'
    
  3. 在**.conf文件中添加KERNEL_DEVICETREE:append = "overlays/mydts.dtbo",不包括-overlay后缀,该文件可能是meta-mydts/conf/layer.conf*。这将告诉Yocto将你的**-overlay.dts文件构建成**.dtbo并将其包含在映像中。

  4. build/conf/bblayers.conf中包括meta-mydts层的路径,以便Yocto可以发现该层。

就是这样。要实现自动激活覆盖,请参考@bvarner的帖子

编辑:

对我来说最有效的覆盖激活机制是使用RPI_EXTRA_CONFIG变量。此变量应放在build/conf/local.conf中,如下所示:

RPI_EXTRA_CONFIG:append = "\ndtoverlay=mydts\n"

另一个位置是包含有图像配方的项目层的layer.conf

英文:

I've figured out the problem and decided to post the steps here. This is based on @void_brain answer and @bvarner post. Below instructions are up to date with Yocto Kirkstone 4.01.

The *.dts file name has to include -overlay.dts suffix, every raspberry pi dt-overlay file has to follow that convention (step 2). Keep in mind, that the Device Tree Blob or *.dtbo file can not include this suffix anymore (step 3).

To add a custom *-overlay.dts file, follow below steps:

  1. First, get into the environment of the yocto project with source poky/oe-init-build-env to get access to the bitbake command. Later create a new layer for the *overlay-dts file:

    $ bitbake-layers create-layer meta-mydts
    
  2. Import the *-overlay.dts file to the freshly created meta-layer with recipetool command. It will create recipes-kernel/linux directories with a linux-raspberrypi_%.bbappend file. If your *-overlay.dts file is made for a specific machine, for example raspberrypi4-64, include it's name with the -wm parameter.

    recipetool appendsrcfile -wm raspberrypi4-64 . virtual/kernel path/to/mydts-overlay.dts 'arch/${ARCH}/boot/dts/overlays/mydts-overlay.dts'
    
  3. Add KERNEL_DEVICETREE:append = " overlays/mydts.dtbo" without the -overlay suffix to *.conf file, that can be meta-mydts/conf/layer.conf. This will tell Yocto to build your *-overlay.dts file into a *.dtbo and include it in the image.

  4. Include the path to meta-mydts layer in build/conf/bblayers.conf, to make the layer discoverable for Yocto.

That's about it. For automatic activation of the overlay look into the @bvarner post post.

Edit:

The overlay activation mechanism that worked the best for me is with the use of RPI_EXTRA_CONFIG variable. This variable should be put in the build/conf/local.conf, as below:

RPI_EXTRA_CONFIG:append = "\ndtoverlay=mydts\n"

The other location is layer.conf of the layer of your project that has a recipe for the image.

huangapple
  • 本文由 发表于 2023年3月9日 19:39:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/75684094.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定