I am using yocto. It doesn't support ft5x06sbased touchscreens, so I decided to add a patch. But when I added the patch file, I got the following errors:
ERROR: Command Error: exit status: 1 Output:
Applying patch 0026-imx6q-smx6-edt-ft5x06.patch
patching file Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
patching file drivers/input/touchscreen/edt-ft5x06.c
Hunk #22 FAILED at 751.
Hunk #23 succeeded at 811 (offset -1 lines).
Hunk #24 FAILED at 922.
Hunk #25 FAILED at 959.
Hunk #26 FAILED at 995.
Hunk #27 FAILED at 1009.
Hunk #28 succeeded at 1077 (offset 17 lines).
5 out of 28 hunks FAILED -- rejects in file drivers/input/touchscreen/edt-ft5x06.c
Patch 0026-imx6q-smx6-edt-ft5x06.patch does not apply (enforce with -f)
ERROR: Function failed: patch_do_patch
ERROR: Logfile of failure stored in: /home/safedrive/test/build/tmp/work/smarc_samx6i-poky-linux-gnueabi/linux-smx6/3.10.17-r0/temp/log.do_patch.29885
ERROR: Task 70 (/home/safedrive/test/sources/meta-fsl-arm-extra/recipes-kernel/linux/linux-smx6_3.10.17.bb, do_patch) failed with exit code '1'
How can I solve this?
The problem is related to task do_patch() executed by BitBake which in Yocto is a tasks scheduler and executor.
Read more in BitBake User Manual
But the error you're facing isn't caused by Yocto components. The error message says that your patch could not be applied to desired file because it's invalid.
Generally .patch is ordered in pieces called hunks generated via diff tool.
Example of a single hunk (from Diff Utility article @ wiki)
@@ -5,16 +11,10 @@
be shown if it doesn't
change. Otherwise, that
would not be helping to
-compress the size of the
-changes.
-This paragraph contains
-text that is outdated.
-It will be deleted in the
-near future.
+compress anything.
In the wiki article you can read how to interpret such a hunk, but making it short: line with - means that specific patch will remove it, line with + is going to be added by patch. Line without any marks are placed for reference (context) and will remain the same.
Now, in your error message it is written:
5 out of 28 hunks FAILED -- rejects in file drivers/input/touchscreen/edt-ft5x06.c Patch 0026-imx6q-smx6-edt-ft5x06.patch does not apply (enforce with -f)
It meas that your patch contains 28 hunks as presented above, and 5 of them could not be applied because are invalid - patch tool can't apply those changes because corresponding lines are different than in file you have used as a reference.
It also can be seen that your patch is numbered as 0026, so the probable cause of failure is that other patches applied before your one changed the file structure: ensure that as a reference you are using the source with all existing patches applied.
I assume that you use *.bbappend or *.bb file to add your patch by appending the SRC_URI variable. The order in applying patches is the same as the order of listed files. So if your patch is the newest one it should look like:
SRC_URI += "file://0001-<patch_name>.patch \
file://0002-<patch_name>.patch \
(...)
file://0026-imx6q-smx6-edt-ft5x06.patch \
"
And the last remark: if you're using Yocto release >= 1.8 there is a handy thing called devtool (Yocto Mega Manual: devtool) and it simplifies working with temporary sources a lot.
EDIT: Question from comment:
Yes I want to know why bitbake return this error message
Simply because your patch can be applied because it doesn't fit on the target sources.
For a specific recipe a set of task is executed, see: BitBake manual: Execution chapter. You can list the tasks by passing: bitbake -c listtasks -f <recipe_name>. do_patch() is one of the common tasks and it fails because of wrong patch.
Try this:
Remove your patch from SRC_URI.
Execute: bitbake -c cleanall -f <recipe_name>
Execute: bitbake -c build -f <recipe_name>
Find the directory with sources you need to patch: bitbake -e <your_recipe_name> | grep ^S= and go there.
Copy the file/files you need to patch. Add to them your changes where you need. Create new patch via diff tool. As a reference use original file/files and as a changed the one(s) with your modifications, e.g.: diff --ruN original_src modified_src > 0026-patch-name.patch.
Move patch to appropriate directory and add it to SRC_URI.
Rebuild the target recipe: bitbake -c cleanall -f <recipe_name> && bitbake -c build -f <recipe_name>
Please notice: <recipe_name> should be passed without the .bb extension.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With