简体   繁体   English

BitBake中的任务do_patch()期间失败

[英]Failure during task do_patch() in BitBake

I am using yocto. 我正在使用yocto。 It doesn't support ft5x06sbased touchscreens, so I decided to add a patch. 它不支持基于ft5x06s的触摸屏,因此我决定添加一个补丁。 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. 问题与BitBake执行的任务do_patch()有关,后者在Yocto中是任务计划程序和执行程序。 Read more in BitBake User Manual BitBake用户手册中阅读更多内容

But the error you're facing isn't caused by Yocto components. 但是,您遇到的错误不是由Yocto组件引起的。 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. 一般来说.patch是个叫做有序hunks通过比较工具生成的。

Example of a single hunk (from Diff Utility article @ wiki ) 一个大块的示例(来自Diff Utility文章@ 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. 在Wiki文章中,您可以阅读如何解释这样的大块头,但要简短点:用-表示特定的补丁程序将删除它,用+表示的行将由补丁程序添加。 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) 28个大块中的5个失败-拒绝文件驱动程序/输入/触摸屏/edt-ft5x06.c修补程序0026-imx6q-smx6-edt-ft5x06.patch不适用(使用-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. 这意味着您的补丁程序包含28个如上所述的块,并且其中5个块无效,因为无效-补丁工具无法应用这些更改,因为对应的行与您用作参考的文件中的行不同。

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. 还可以看到,您的补丁程序编号为0026,因此失败的可能原因是在您更改文件结构之前应用了其他补丁程序:确保作为参考,您正在使用已应用所有现有补丁程序的源。

I assume that you use *.bbappend or *.bb file to add your patch by appending the SRC_URI variable. 我假设您使用*.bbappend*.bb文件通过附加SRC_URI变量来添加补丁。 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. 最后一句话:如果您使用的Yocto版本> = 1.8,则有一个方便的工具叫做devtoolYocto Mega Manual:devtool ),它大大简化了使用临时源的工作。

EDIT: Question from comment: 编辑:问题来自评论:

Yes I want to know why bitbake return this error message 是的,我想知道为什么bitbake返回此错误消息

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 . 有关特定配方的一组任务,请参见:《 BitBake手册:执行》一章 You can list the tasks by passing: bitbake -c listtasks -f <recipe_name> . 您可以通过以下方式列出任务: bitbake -c listtasks -f <recipe_name> do_patch() is one of the common tasks and it fails because of wrong patch. do_patch()是常见任务之一,由于修补错误而失败。

Try this: 尝试这个:

  1. Remove your patch from SRC_URI . SRC_URI删除补丁。

  2. Execute: bitbake -c cleanall -f <recipe_name> 执行: bitbake -c cleanall -f <recipe_name>

  3. Execute: bitbake -c build -f <recipe_name> 执行: bitbake -c build -f <recipe_name>

  4. Find the directory with sources you need to patch: bitbake -e <your_recipe_name> | grep ^S= 查找包含您需要修补的源的目录: bitbake -e <your_recipe_name> | grep ^S= bitbake -e <your_recipe_name> | grep ^S= and go there. bitbake -e <your_recipe_name> | grep ^S=然后去那里。

  5. Copy the file/files you need to patch. 复制您需要修补的文件。 Add to them your changes where you need. 在需要的地方向他们添加您的更改。 Create new patch via diff tool. 通过diff工具创建新补丁。 As a reference use original file/files and as a changed the one(s) with your modifications, eg: diff --ruN original_src modified_src > 0026-patch-name.patch . 作为参考,请使用原始文件,或对原始文件进行修改,例如diff --ruN original_src modified_src > 0026-patch-name.patch

  6. Move patch to appropriate directory and add it to SRC_URI . 将补丁移动到适当的目录并将其添加到SRC_URI

  7. Rebuild the target recipe: bitbake -c cleanall -f <recipe_name> && bitbake -c build -f <recipe_name> 重建目标配方: bitbake -c cleanall -f <recipe_name> && bitbake -c build -f <recipe_name>

Please notice: <recipe_name> should be passed without the .bb extension. 请注意: <recipe_name>应该不带.bb扩展名传递。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM