Patching u-boot "can't find file to patch", how to fetch source?

cancel
Showing results for 
Search instead for 
Did you mean: 

Patching u-boot "can't find file to patch", how to fetch source?

Jump to solution
6,594 Views
series8217
Contributor II

I'm trying to patch mx6dqscm.c in u-boot IMX with a bbappend file in my custom layer. I get the following error:

ERROR: u-boot-imx-2016.03-r0 do_patch: Command Error: 'quilt --quiltrc /home/ubuntu/imx6/
build-x11/tmp/sysroots/x86_64-linux/etc/quiltrc push' exited with 1  Output:
Applying patch 0001-my-uboot-patch.patch
can't find file to patch at input line 5

I checked buildir/tmp/work/imx6dqscm_1gb_custom-poky-linux-gnueabi/u-boot-imx/2016.03-r0/git and there is no source here. It seems the source code for u-boot-imx was never fetched. It seems like bitbake is trying to apply the patches before the source is fetched. Why?

I ran `bitbake -c -f fetchall uboot-imx`, but still no source files in tmp/work...  is this a sign something else is wrong?

Here is the relevant part of my tree:

meta-my-layer/recipes-bsp/u-boot/u-boot-imx_2016.03.bbappend
meta-my-layer/recipes-bsp/u-boot/u-boot-imx/imx6dqscm-1gb-custom/0001-my-uboot-patch.patch

Content of my bappend file, u-boot-imx_2016.03.bbappend:

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI_imx6dqscm-1gb-custom += "file://0001-my-uboot-patch.patch"

SRCBRANCH = "scm-imx_v2016.03_4.1.15_2.0.0_ga"
SRCREV = "${AUTOREV}"

COMPATIBLE_MACHINE = "(mx6)"

My patch starts with:

diff --git a/board/freescale/mx6dqscm/mx6dqscm.c b/board/freescale/mx6dqscm/mx6dqscm.c
index de08e95..4a20001 100644
--- a/board/freescale/mx6dqscm/mx6dqscm.c
+++ b/board/freescale/mx6dqscm/mx6dqscm.c

It looks just like my kernel patches, which work correctly.

UPDATE #1 2018/04/19:  If I run `bitbake -c unpack -f u-boot-imx` the source tree gets populated. This implies that the combination of fetch and unpack would get the sources and put them into the working directory, and that bitbake is trying to apply my patch before the `unpack` step. What's going on here?

UPDATE #2 2018/04/19: Added my machine-specific SRC_URI above.  It seems this is related to the behavior. I'm not using this in my working kernel bbappend.  I looked at the fetch and unpack logs, and they only work on one file (my first patch) then stop. Seems like a strong hint that my SRC_URI is malformed.

Labels (4)
1 Solution
3,892 Views
series8217
Contributor II

I found the problem. It's on the following line in my bbappend:

SRC_URI_imx6dqscm-1gb-custom += "file://0001-my-uboot-patch.patch"

This doesn't work. The machine-specific SRC_URI addition is ignored.

It seems that machine-specific SRC_URI needs to use:

 SRC_URI_append_machine = "file://patch-file "

Instead of:

 SRC_URI_machine += "file://patch-file"

Note that SRC_URI_append requires an explicit trailing space so that fetch can split the SRC_URI to get each separate file path:

SRC_URI_append_imx6dqscm-1gb-custom = "file://0001-my-uboot-patch-1.patch "

For multiple patch files this needs to be done in one line:

SRC_URI_append_imx6dqscm-1gb-custom = "file://0001-my-uboot-patch-1.patch \
                                       file://0002-my-uboot-patch-2.patch \
                                       "

I'm not sure if this would also work:

SRC_URI_imx6dqscm-1gb-custom = ""
SRC_URI_imx6dqscm-1gb-custom += "file://0001-my-uboot-patch-1.patch"
SRC_URI_imx6dqscm-1gb-custom += "file://0002-my-uboot-patch-2.patch"

View solution in original post

4 Replies
3,893 Views
series8217
Contributor II

I found the problem. It's on the following line in my bbappend:

SRC_URI_imx6dqscm-1gb-custom += "file://0001-my-uboot-patch.patch"

This doesn't work. The machine-specific SRC_URI addition is ignored.

It seems that machine-specific SRC_URI needs to use:

 SRC_URI_append_machine = "file://patch-file "

Instead of:

 SRC_URI_machine += "file://patch-file"

Note that SRC_URI_append requires an explicit trailing space so that fetch can split the SRC_URI to get each separate file path:

SRC_URI_append_imx6dqscm-1gb-custom = "file://0001-my-uboot-patch-1.patch "

For multiple patch files this needs to be done in one line:

SRC_URI_append_imx6dqscm-1gb-custom = "file://0001-my-uboot-patch-1.patch \
                                       file://0002-my-uboot-patch-2.patch \
                                       "

I'm not sure if this would also work:

SRC_URI_imx6dqscm-1gb-custom = ""
SRC_URI_imx6dqscm-1gb-custom += "file://0001-my-uboot-patch-1.patch"
SRC_URI_imx6dqscm-1gb-custom += "file://0002-my-uboot-patch-2.patch"
3,892 Views
raja_sj
Contributor I

Hi Steven,

Even I am facing the same kind of issue said by you.

I am unable to resolve it still, can you help me.

These are bitbake error logs related to issue.

ERROR: busybox-1.29.3-r0 do_patch: Command Error: 'quilt --quiltrc /media/raja.sj/_My-data/cal2poky-config/scripts/yocto_build/poky/build/tmp/work/cortexa9t2hf-neon-poky-linux-gnueabi/busybox/1.29.3-r0/recipe-sysroot-native/etc/quiltrc push' exited with 0 Output:
Applying patch 0001-persist-OS-logs-cal2.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:

I am not getting how to resolve the issue.

how to provide the proper SRC_URI_xxx for my board.what should be filled in "xxx", to resolve the issue.

I have created patch using quilt

0 Kudos
3,892 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Steven

one can try to follow SCM-i.MX 6 Series Yocto Linux Patch Release Notes and User's Guide on

Quick Start Board for SCM-i.MX 6DQ|NXP 

CodeAurora sources:

uboot scm-imx_v2016.03_4.1.15_2.0.0_ga

uboot-imx - i.MX U-Boot 

scm-imx_4.1.15_2.0.0_ga

linux-imx - i.MX Linux kernel 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
3,892 Views
series8217
Contributor II

Hi Igor,

Thank you for the reply. I'm familiar with the documents you linked to -- My build environment is configured according to the SCM-i.MX 6 Yocto user's guide, and I can find the u-boot source in git.

The problem I'm having is that bitbake is not fetching the sources before trying to apply my patch, so I get the following error during the do_patch part of the u-boot build in Yocto:

ERROR: u-boot-imx-2016.03-r0 do_patch: Command Error: 'quilt --quiltrc /home/ubuntu/imx6/
build-x11/tmp/sysroots/x86_64-linux/etc/quiltrc push' exited with 1  Output:
Applying patch 0001-my-uboot-patch.patch
can't find file to patch at input line 5

I'm trying to understand why this is happening. To help with the diagnosis I checked if the u-boot source files were present in the tmp/work directory and they are not. `bitbake -c -f fetchall uboot-imx` doesn't put them there either. What could be causing this problem?

0 Kudos