summaryrefslogtreecommitdiff
path: root/recipes-bsp/u-boot/u-boot-2016.09.01/printeepromcrc.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-bsp/u-boot/u-boot-2016.09.01/printeepromcrc.patch')
-rw-r--r--recipes-bsp/u-boot/u-boot-2016.09.01/printeepromcrc.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/recipes-bsp/u-boot/u-boot-2016.09.01/printeepromcrc.patch b/recipes-bsp/u-boot/u-boot-2016.09.01/printeepromcrc.patch
new file mode 100644
index 0000000..19fca02
--- /dev/null
+++ b/recipes-bsp/u-boot/u-boot-2016.09.01/printeepromcrc.patch
@@ -0,0 +1,56 @@
+diff -raNu old/common/env_nand.c new/common/env_nand.c
+--- old/common/env_nand.c 2017-05-11 16:27:26.160067136 -0500
++++ new/common/env_nand.c 2017-05-11 16:44:12.134434145 -0500
+@@ -68,15 +68,22 @@
+ #if defined(ENV_IS_EMBEDDED) || defined(CONFIG_NAND_ENV_DST)
+ int crc1_ok = 0, crc2_ok = 0;
+ env_t *tmp_env1;
++ uint32_t calc_crc;
+
+ #ifdef CONFIG_ENV_OFFSET_REDUND
+ env_t *tmp_env2;
+
+ tmp_env2 = (env_t *)((ulong)env_ptr + CONFIG_ENV_SIZE);
+- crc2_ok = crc32(0, tmp_env2->data, ENV_SIZE) == tmp_env2->crc;
++ calc_crc = crc32(0, tmp_env2->data, ENV_SIZE);
++ crc2_ok = (calc_crc == tmp_env2->crc);
++ printf("env_relocate_spec: crc2_ok=%d saved crc=0x%x calculated crc=0x%x flags=%d\n",
++ crc2_ok,tmp_env2->crc,calc_crc,tmp_env2->flags);
+ #endif
+ tmp_env1 = env_ptr;
+- crc1_ok = crc32(0, tmp_env1->data, ENV_SIZE) == tmp_env1->crc;
++ calc_crc = crc32(0, tmp_env1->data, ENV_SIZE);
++ crc1_ok = (calc_crc == tmp_env1->crc);
++ printf("env_relocate_spec: crc1_ok=%d saved crc=0x%x calculated crc=0x%x flags=%d\n",
++ crc1_ok,tmp_env1->crc,calc_crc,tmp_env1->flags);
+
+ if (!crc1_ok && !crc2_ok) {
+ gd->env_addr = 0;
+@@ -317,6 +324,7 @@
+ int read1_fail = 0, read2_fail = 0;
+ int crc1_ok = 0, crc2_ok = 0;
+ env_t *ep, *tmp_env1, *tmp_env2;
++ uint32_t calc_crc;
+
+ tmp_env1 = (env_t *)malloc(CONFIG_ENV_SIZE);
+ tmp_env2 = (env_t *)malloc(CONFIG_ENV_SIZE);
+@@ -334,11 +342,16 @@
+ else if (read1_fail || read2_fail)
+ puts("*** Warning - some problems detected "
+ "reading environment; recovered successfully\n");
+-
++ calc_crc = crc32(0, tmp_env1->data, ENV_SIZE);
+ crc1_ok = !read1_fail &&
+- (crc32(0, tmp_env1->data, ENV_SIZE) == tmp_env1->crc);
++ (calc_crc == tmp_env1->crc);
++ printf("env_relocate_spec: crc1_ok=%d saved crc=0x%x calculated crc=0x%x flags=%d\n",
++ crc1_ok,tmp_env1->crc,calc_crc,tmp_env1->flags);
++ calc_crc = crc32(0, tmp_env2->data, ENV_SIZE);
+ crc2_ok = !read2_fail &&
+- (crc32(0, tmp_env2->data, ENV_SIZE) == tmp_env2->crc);
++ (calc_crc == tmp_env2->crc);
++ printf("env_relocate_spec: crc2_ok=%d saved crc=0x%x calculated crc=0x%x flags=%d\n",
++ crc2_ok,tmp_env2->crc,calc_crc,tmp_env2->flags);
+
+ if (!crc1_ok && !crc2_ok) {
+ set_default_env("!bad CRC");