How to add patch for u-boot

I want to add patch for u-boot. For that I have done "bitbake u-boot-toradex -c do_unpack". After that I have added my changes in /include/configs/apalis_imx6.h file.
Then I have compile the u-boot source code using "bitbake u-boot-toradex -c compile -f" and  created my patch with my changes.
Added my patch in the following way:

├── layer
	 
	│   
	└── meta-mylayer
		|-- conf
			|-- layer.conf
		├── README.md
	 	├── recipes-bsp
	 	│     └── u-boot
	 	│      	├── files
	        │   		├── 0001-dtb_modification.patch
	        └── u-boot-toradex_2016.11.bbappend

our patch look like below:

---
 include/configs/apalis_imx6.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/configs/apalis_imx6.h b/include/configs/apalis_imx6.h
index fa40c629c3..27021ab1ff 100644
--- a/include/configs/apalis_imx6.h
+++ b/include/configs/apalis_imx6.h
@@ -257,10 +257,10 @@
 		"${fdt_file} && setenv dtbparam \" - ${fdt_addr_r}\" && true\0"
 
 #ifndef CONFIG_TDX_APALIS_IMX6_V1_0
-#define FDT_FILE "imx6q-apalis-eval.dtb"
-#define FDT_FILE_V1_0 "imx6q-apalis_v1_0-eval.dtb"
+#define FDT_FILE "imx6q-apalis-ixora-v1.1.dtb"
+#define FDT_FILE_V1_0 "imx6q-apalis-ixora-v1.1.dtb"
 #else
-#define FDT_FILE "imx6q-apalis_v1_0-eval.dtb"
+#define FDT_FILE "imx6q-apalis-ixora-v1.1.dtb"
 #endif
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	BOOTENV \
-- 

However when we compile using 'bitbake -k console-tdx-image', it is giving following error:

WARNING: u-boot-toradex-2016.11+gitAUTOINC+83a53c1c0c-r0 do_fetch: Failed to fetch URL file://0001-dtb_modification.patch, attempting MIRRORS if available
ERROR: u-boot-toradex-2016.11+gitAUTOINC+83a53c1c0c-r0 do_fetch: Fetcher failure: Unable to find file file://0001-dtb_modification.patch anywhere. The paths that were searched were:
    /home/embadmin/Project/oe-core/build/../layers/meta-tgu/recipes-bsp/u-boot/u-boot-toradex/angstrom
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex-2016.11+gitAUTOINC+83a53c1c0c/angstrom
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex/angstrom
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/files/angstrom
    /home/embadmin/Project/oe-core/build/../layers/meta-tgu/recipes-bsp/u-boot/u-boot-toradex/apalis-imx6
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex-2016.11+gitAUTOINC+83a53c1c0c/apalis-imx6
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex/apalis-imx6
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/files/apalis-imx6
    /home/embadmin/Project/oe-core/build/../layers/meta-tgu/recipes-bsp/u-boot/u-boot-toradex/mx6q
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex-2016.11+gitAUTOINC+83a53c1c0c/mx6q
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex/mx6q
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/files/mx6q
    /home/embadmin/Project/oe-core/build/../layers/meta-tgu/recipes-bsp/u-boot/u-boot-toradex/imxgpu3d
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex-2016.11+gitAUTOINC+83a53c1c0c/imxgpu3d
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex/imxgpu3d
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/files/imxgpu3d
    /home/embadmin/Project/oe-core/build/../layers/meta-tgu/recipes-bsp/u-boot/u-boot-toradex/imxgpu2d
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex-2016.11+gitAUTOINC+83a53c1c0c/imxgpu2d
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex/imxgpu2d
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/files/imxgpu2d
    /home/embadmin/Project/oe-core/build/../layers/meta-tgu/recipes-bsp/u-boot/u-boot-toradex/imxvpu
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex-2016.11+gitAUTOINC+83a53c1c0c/imxvpu
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex/imxvpu
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/files/imxvpu
    /home/embadmin/Project/oe-core/build/../layers/meta-tgu/recipes-bsp/u-boot/u-boot-toradex/imxipu
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex-2016.11+gitAUTOINC+83a53c1c0c/imxipu
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex/imxipu
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/files/imxipu
    /home/embadmin/Project/oe-core/build/../layers/meta-tgu/recipes-bsp/u-boot/u-boot-toradex/mx6
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex-2016.11+gitAUTOINC+83a53c1c0c/mx6
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex/mx6
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/files/mx6
    /home/embadmin/Project/oe-core/build/../layers/meta-tgu/recipes-bsp/u-boot/u-boot-toradex/imx
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex-2016.11+gitAUTOINC+83a53c1c0c/imx
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex/imx
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/files/imx
    /home/embadmin/Project/oe-core/build/../layers/meta-tgu/recipes-bsp/u-boot/u-boot-toradex/armv7a
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex-2016.11+gitAUTOINC+83a53c1c0c/armv7a
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex/armv7a
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/files/armv7a
    /home/embadmin/Project/oe-core/build/../layers/meta-tgu/recipes-bsp/u-boot/u-boot-toradex/arm
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex-2016.11+gitAUTOINC+83a53c1c0c/arm
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex/arm
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/files/arm
    /home/embadmin/Project/oe-core/build/../layers/meta-tgu/recipes-bsp/u-boot/u-boot-toradex/
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex-2016.11+gitAUTOINC+83a53c1c0c/
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex/
    /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/files/
    /home/embadmin/Project/oe-core/build/downloads
ERROR: u-boot-toradex-2016.11+gitAUTOINC+83a53c1c0c-r0 do_fetch: Fetcher failure for URL: 'file://0001-dtb_modification.patch'. Unable to fetch URL from any source.
ERROR: u-boot-toradex-2016.11+gitAUTOINC+83a53c1c0c-r0 do_fetch: Function failed: base_do_fetch
ERROR: Logfile of failure stored in: /home/embadmin/Project/oe-core/build/tmp-glibc/work/apalis_imx6-angstrom-linux-gnueabi/u-boot-toradex/2016.11+gitAUTOINC+83a53c1c0c-r0/temp/log.do_fetch.29446
ERROR: Task (/home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex_2016.11.bb:do_fetch) failed with exit code '1'
NOTE: Tasks Summary: Attempted 5336 tasks of which 5335 didn't need to be rerun and 1 failed.
NOTE: Writing buildhistory

Summary: 1 task failed:
  /home/embadmin/Project/oe-core/build/../layers/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-toradex_2016.11.bb:do_fetch
Summary: There were 2 WARNING messages shown.
Summary: There were 3 ERROR messages shown, returning a non-zero exit code.


What could be the wrong here ? Please guide us.

Hi @Nitish ,

Welcome to Toradex Community!

It looks like your SRC_URI in .bbappend is creating the issue.
For better understanding, can you please attach your .bbappend file.

Also see the similar question here.