yoctobitbakeyocto-recipe

How to apply patch in yocto


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


Solution

  • 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.

    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.