How to customize u-boot with my changes

I want to customize u-boot with my changes. 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-toradex-nxp
	 ├── README.md
	 ├── recipes-bsp
	 │   └── u-boot
	 │   ├── files
	 │   │   ├── 0001-bootcount_implementation.patch
	 │   └── u-boot-toradex_2016.11.bbappend
	 
Our u-boot-toradex_2016.11.bbappend looks like below:
	
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
	 SRC_URI += "file://0001-bootcount_implementation.patch " 

our patch look like below:

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

diff --git a/include/configs/apalis_imx6.h b/include/configs/apalis_imx6.h
index fa40c629c3..69527089b4 100644
--- a/include/configs/apalis_imx6.h
+++ b/include/configs/apalis_imx6.h
@@ -158,6 +158,8 @@
 #define CONFIG_ENV_OVERWRITE
 #define CONFIG_CONS_INDEX		1
 #define CONFIG_BAUDRATE			115200
+#define CONFIG_BOOTCOUNT_LIMIT		1
+#define CONFIG_BOOTCOUNT_ENV
 
 /* Command definition */
 #undef CONFIG_CMD_LOADB
@@ -257,10 +259,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’ our changes doesn’t reflect in our default environment on target.
What could be the wrong here ? Please guide us.

And you already did the following:

env default -a
saveenv

yes I did.

But still no change in default environment.

Hi

Does your layout really look like this:

├── layer
      │   └── meta-toradex-nxp
      ├── README.md
      ├── recipes-bsp
      │   └── u-boot
      │   ├── files
      │   │   ├── 0001-bootcount_implementation.patch
      │   └── u-boot-toradex_2016.11.bbappend

Note that *.bb and *.bbappend files must be in a layer, e.g. in a location referenced from build/conf/bblayers.conf and within the layer they must be in a location as defined by the wildcard specification BBFILES in that layers ‘conf/layer.conf’.
Your bbappend looks to be outside of any layer and thus does not get parsed and has no effect.

Max

This is the complete structure. 
├── layer
	│   
	└── meta-toradex-nxp
		|-- conf
			|-- layer.conf
		├── README.md
	 	├── recipes-bsp
	 	│   └── u-boot
	 	│      	├── files
	        │   		├── 0001-bootcount_implementation.patch
	        └── u-boot-toradex_2016.11.bbappend

Can you attach the output file uboot.txt generated with ‘bitbake virtual/bootloader -e > uboot.txt’?