【问题标题】:Failure during task do_patch() in BitBakeBitBake 中的任务 do_patch() 期间失败
【发布时间】:2016-09-16 06:53:46
【问题描述】:

我正在使用 yocto。它不支持基于 ft5x06s 的触摸屏,所以我决定添加一个补丁。但是当我添加补丁文件时,我得到了以下错误:

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'

我该如何解决这个问题?

【问题讨论】:

    标签: embedded-linux yocto bitbake


    【解决方案1】:

    问题与 BitBake 执行的任务do_patch() 有关,在 Yocto 中它是一个任务调度器和执行器。 阅读更多BitBake User Manual

    但是您面临的错误不是由 Yocto 组件引起的。 错误消息说您的补丁无法应用于所需的文件,因为它无效。

    通常.patch 是通过diff 工具生成的称为hunks 的片段。

    单个大块的示例(来自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.
    

    在 wiki 文章中您可以阅读如何解释这样的大块,但要简短:与- 的行表示特定补丁将删除它,与+ 的行将通过补丁添加。放置没有任何标记的行以供参考(上下文)并将保持不变。

    现在,在您的错误消息中写着:

    28 个大块中有 5 个失败 - 在文件驱动程序/输入/触摸屏/edt-ft5x06.c 中拒绝 补丁 0026-imx6q-smx6-edt-ft5x06.patch 不适用(使用 -f 强制执行)

    这意味着您的补丁包含上述 28 个大块,其中 5 个因无效而无法应用 - 补丁工具无法应用这些更改,因为相应的行与您用作参考的文件中的不同。

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

    我假设您使用*.bbappend*.bb 文件通过附加SRC_URI 变量来添加您的补丁。应用补丁的顺序与列出文件的顺序相同。所以如果你的补丁是最新的,它应该是这样的:

    SRC_URI += "file://0001-<patch_name>.patch \
                file://0002-<patch_name>.patch \
                (...)
                file://0026-imx6q-smx6-edt-ft5x06.patch \
               "
    

    最后一点:如果您使用的是 Yocto 版本 >= 1.8,那么有一个方便的东西叫做 devtool (Yocto Mega Manual: devtool),它大大简化了临时源的工作。

    编辑: 评论中的问题:

    是的,我想知道为什么 bitbake 会返回此错误消息

    只是因为您的补丁不适合目标源,因此可以应用。 对于特定配方执行一组任务,请参阅:BitBake manual: Execution chapter。您可以通过以下方式列出任务:bitbake -c listtasks -f &lt;recipe_name&gt;do_patch() 是常见任务之一,由于补丁错误而失败。

    试试这个:

    1. SRC_URI 中删除您的补丁。

    2. 执行:bitbake -c cleanall -f &lt;recipe_name&gt;

    3. 执行:bitbake -c build -f &lt;recipe_name&gt;

    4. 找到需要修补的源目录:bitbake -e &lt;your_recipe_name&gt; | grep ^S= 并前往那里。

    5. 复制您需要修补的文件。在您需要的地方添加您的更改。通过diff 工具创建新补丁。作为参考,使用原始文件/文件,并使用您的修改作为更改文件,例如:diff --ruN original_src modified_src &gt; 0026-patch-name.patch

    6. 将补丁移动到适当的目录并添加到SRC_URI

    7. 重建目标配方:bitbake -c cleanall -f &lt;recipe_name&gt; &amp;&amp; bitbake -c build -f &lt;recipe_name&gt;

    请注意:&lt;recipe_name&gt; 应该在没有.bb 扩展的情况下传递。

    【讨论】:

    • 您好,感谢您提供有关我的问题的宝贵信息。我已经按照你上面说的添加了补丁。您能告诉我如何理解上述错误消息以纠正该错误。
    • 现在很好用!你到底想知道什么?为什么 BitBake 从您的问题返回错误或为什么未应用补丁?
    • 是的,我想知道为什么 bitbake 会返回这个错误信息!
    猜你喜欢
    • 2021-07-14
    • 1970-01-01
    • 1970-01-01
    • 2017-07-26
    • 2020-05-05
    • 2014-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多