yoctopatch

Yocto kernel patch "previously applied" error


I have a DTS patch file that adds an EEPROM to the devicetree. I have a .bbappend recipe with these simple lines

PATCHTOOL = "git"
SRC_URI += " \
  file://0001-imx6dl-custom.dts.patch \
"

I started bitbake and the patch is applied and the image generated.

I tweaked some other things. When I started bitbake again, I received a an error at do_patch step, saying this:

NOTE: Executing Tasks
NOTE: Setscene tasks completed
ERROR: linux-custom-5.4-r0 do_patch: Applying '0001-imx6dl-custom.dts.patch' failed:
checking file arch/arm/boot/dts/imx6dl-custom.dts
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
1 out of 1 hunk ignored
ERROR: Logfile of failure stored in: /home/user/yocto/build/tmp/work/custom_imx6dl_r027-poky-linux-gnueabi/linux-custom/5.4-r0/temp/log.do_patch.19802
ERROR: Task (/home/user/yocto/sources/meta-custom/recipes-kernel/linux-mod/linux-custom_5.4.bb:do_patch) failed with exit code '1'

The dts file in work-shared have the patch applied. If I do a git log in the work-shared folder I see the last commit of my kernel source (where the dts is NOT patched) and an extra commmit by oe.pathc@oe that applies my patch. So it looks like everything is ok. Still, I get this error.

What can be the cause of this?

I did some extra test. I removed the patch and the .bbappend that applies it from my kernel recipe. Strangely enough, it looks like bitbake is still trying to apply the patch. When I run bitbake I get

Loaded 4146 entries from dependency cache.
WARNING: /home/user/yocto/sources/meta-custom/recipes-kernel/linux/linux-custom_5.4.bb: Unable to get checksum for linux-custom SRC_URI entry 0001-imx6dl-custom.dts.patch: file could not be found

0001-imx6dl-custom.dts.patch was indeed deleted, but so it was the .bbappend file. Why is it still looking for it? I tried various clean commands (bitbake -c clean linux-custom, bitbake -fc cleanall linux-custom), but still bitbake is looking for the patch. And I still get the "previously applied" patch error!

Is there some history that won't get deleted in my Yocto workflow? What am I missing?


Solution

  • Turns out I made a dumb mistake.

    I copied the kernel "linux-custom" recipe folder to "linux-custom-mod" ad a backup copy, and tweaked the former, thinking only "linux-custom" would be used by Yocto. But Yocto looks for all .bb and .bbappend files, so it added the recipes in "linux-custom-mod", too. So, it always parsed the .bbappend file in "linux-custom-mod", always trying to patch the DTS. When the patch was left in the original "linux-custom" folder, it actually (and correctly) applies the patch twice, hence the error message.

    My bad