0

I built the yocto image for my board . Now I need to apply this patch

First, how do I figure out which recipe the patch goes to? Second, how do I apply this patch?

(I checked similar question but its patching yocto system itself, I don't want that)

I can list all my recipes with this command I found

bitbake-layers show-recipes

But I still don't know which of these recipes builds the file drivers/rpmsg/virtio_rpmsg_bus.c, the file I need to patch.

I also found three directories that have this c file:

find . -name virtio_rpmsg_bus.c
./build_wayland/tmp/work-shared/imx8mm-var-dart/kernel-source/drivers/rpmsg/virtio_rpmsg_bus.c
./build_wayland/tmp/work/aarch64-fslc-linux/linux-libc-headers/5.4-r0/linux-5.4/drivers/rpmsg/virtio_rpmsg_bus.c
./build_wayland/tmp/work/aarch64-mx8mm-fslc-linux/linux-imx-headers/5.4-r0/git/drivers/rpmsg/virtio_rpmsg_bus.c

These recipe folders have recipes-kernel/linux directory

sources/meta-freescale-3rdparty/recipes-kernel
sources/meta-freescale/recipes-kernel
sources/poky/meta-skeleton/recipes-kernel
sources/poky/meta/recipes-kernel
sources/poky/meta-yocto-bsp/recipes-kernel
sources/meta-virtualization/recipes-kernel
sources/meta-variscite-fslc/recipes-kernel
sources/meta-openembedded/meta-gnome/recipes-kernel
sources/meta-openembedded/meta-initramfs/recipes-kernel
sources/meta-openembedded/meta-networking/recipes-kernel
sources/meta-openembedded/meta-oe/recipes-kernel

I don't know which of these recipes might be building my c file virtio_rpmsg_bus.c

4

1 回答 1

0

So I haven't done the build myself but here is what I could gather (this is a bit of a long shot on certain points... hope everything works, I'm open to discussion if that's not the case).

Finding the recipe to patch: In my opinion this might be often tricky to find what recipe does what in Yocto. If I'm not mistaken (which is very much a possibility) you should have a layer called meta-xilinx-bsp. Wihtin this layer there should be recipes-kernel/linux/linux_xlnx_[version].bb. This should be the recipe the patch should go to.

Applying the patch: To apply the patch the simplest way is to append the recipe.

  • Create the folder structure: In your own layer you need to reproduce the structure where the recipe is in the original layer. Here: meta-myLayer/recipes-kernel/linux/. In this folder create linux-xlnx_%.bbappend.
  • Create a .bbappend file: With this structure and name yocto will know this is an append to the original linux-xlnx_[verion_number].bb recipe. The % is put here instead of a version number. This is a wildcard and will append any version of the linux-xlnx recipe. Should you want to append only a specific version you can replace % by a version number.
  • Add the patch file to your directory: To do so create a folder called linux-xlnx next to you recipe. And within this folder create your patch file by copying the content you have in something like my-xlnx-patch.patch
  • Reference the patch file in the .bbappend: Indicate the file path in your linux-xlnx_%.bbappend as follow:
    FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
    SRC_URI_append = " \
         file://my-xlnx-patch.patch \
         "
    

I'm not 100% sure you need the first line but this will tell yocto that you have a patch file for this recipe and if I'm not mistaken yocto will take care of applying it.

于 2021-10-06T15:03:26.117 回答