Search code examples
linux-kernelyoctobitbake

Can yocto apply a patch file pulled from a seperate git repo rather than included in the recipe?


I have a kernel patch that I'm using in multiple yocto recipes. Every example that I can find just puts the .patch file in the recipe folder, like this:

FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://0001-example.patch"

I would prefer to be able to update the patch in a single place rather than every recipe that uses it. I'd like to just check the .patch file itself into a git repo that is referenced from all the recipes that use the patch, but it looks like only the file fetcher knows how handle patch files and not the git fetcher.

Is there a workaround to support this use case?


Solution

  • I can't think of a straighforward way to apply this patch without modifying all .bb or adding .bbappend for each, neither with the git repo trick you are mentioning.

    But if you can modify all your kernel recipes at least once you can use a .inc file that is common to all the kernels you have. Even better if you alredy have a .inc file that is common to all kernels.

    You can add the following contents inside a meta-yourmeta/recipes-kernel-common/kernel_patch.inc (or change name/paths as desired):

    Add this line

    SRC_URI += "file://0001-example.patch"

    Also add that patch to meta-yourmeta/recipes-kernel-common/files/

    Then on all recipes do:

    include kernel_patch.inc

    This will make it common to all kernels and the patch should apply to all of them.