Search code examples
yoctopatch

Machine specific PATCH application from different layer yocto


I want to apply one patch which is machine specific(old-silicon) from my custom meta layer, for that I defined MACHINEOVERRIDES in my meta-dcu/conf/machine/old_silicon.conf

MACHINEOVERRIDES =. "old_silicon:"

Then I applied my patch in meta-dcu/recipes-rzg2l/recipes-bsp/trusted-firmware-a/trusted-firmware-a.bbappend

SRC_URI_old_silicon += "file://0002-trusted-firmware-a-add-rd-wr-64-bit-reg-workaround.patch"

But I am getting error:

ERROR: trusted-firmware-a-v2.6+git-r0 do_patch: Applying patch '0002-trusted-firmware-a-add-rd-wr-64-bit-reg-workaround.patch' on target directory '/build/tmp/work/old_silicon-poky-linux/trusted-firmware-a/v2.6+git-r0/git' Command Error: 'quilt --quiltrc /build/tmp/work/old_silicon-poky-linux/trusted-firmware-a/v2.6+git-r0/recipe-sysroot-native/etc/quiltrc push' exited with 0 Output: Applying patch 0002-trusted-firmware-a-add-rd-wr-64-bit-reg-workaround.patch can't find file to patch at input line 5 Perhaps you used the wrong -p or --strip option? The text leading up to this was: No file to patch. Skipping patch. 6 out of 6 hunks ignored patch unexpectedly ends in middle of line


Solution

  • You added the patch properly (otherwise bitbake would've complained that the patch didnt exist), I'd still recommend you switch to the append syntax to avoid errors:

    SRC_URI_append_old_sillicon = " file://0002-trusted-firmware-a-add-rd-wr-64-bit-reg-workaround.patch"
    

    Your error is that your patch is being applied, however when quilt is applying your patch it can't find the file that its supposed to be modified (presumably gicv3_private.h).

    Typically the file does exist and youre just trying to apply it in the wrong directory or something, hence why bitbake is suggesting to use the -p or --strip options for quilt, this would be the case if for example:

    The patch is trying to modify

    drivers/arm/gic/v3/gicv3_private.h
    

    but the file is actually at

    src/drivers/arm/gic/v3/gicv3_private.h
    

    (or something similar)

    Take a look at striplevel and patchdir in SRC_URI, setting these properly is probably what you want.