diff options
author | John Klug <john.klug@multitech.com> | 2017-04-06 11:16:06 -0500 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2017-04-06 11:16:06 -0500 |
commit | d4672b8ae8809d5314ef235a4a84a3bf6ce3b77f (patch) | |
tree | ea9b1f0b4309d1bb577339ee74103ee30ae9b55b /recipes-bsp | |
parent | 87223519b59a8bf42d05f8f8b4ac76c0b811c990 (diff) | |
download | meta-multitech-d4672b8ae8809d5314ef235a4a84a3bf6ce3b77f.tar.gz meta-multitech-d4672b8ae8809d5314ef235a4a84a3bf6ce3b77f.tar.bz2 meta-multitech-d4672b8ae8809d5314ef235a4a84a3bf6ce3b77f.zip |
Add patch for CRC Debug to u-boot
Diffstat (limited to 'recipes-bsp')
-rw-r--r-- | recipes-bsp/u-boot/u-boot-2012.10/u-boot-env-crc-dbg.patch | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/recipes-bsp/u-boot/u-boot-2012.10/u-boot-env-crc-dbg.patch b/recipes-bsp/u-boot/u-boot-2012.10/u-boot-env-crc-dbg.patch new file mode 100644 index 0000000..3671645 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-2012.10/u-boot-env-crc-dbg.patch @@ -0,0 +1,58 @@ + + Print out CRC values for environment + +diff --git a/common/env_nand.c b/common/env_nand.c +index 79e8033..9a9bac7 100644 +--- a/common/env_nand.c ++++ b/common/env_nand.c +@@ -83,15 +83,22 @@ int env_init(void) + #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,calc_crc,tmp_env2->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 = saved_crc == tmp_env1->crc; ++ printf("env_relocate_spec: crc1_ok=%d saved crc=0x%x calculated crc=0x%x flags=%d\n", ++ crc1_ok,calc_crc,tmp_env1->crc,tmp_env1->flags); + + if (!crc1_ok && !crc2_ok) { + gd->env_addr = 0; +@@ -333,6 +340,7 @@ void env_relocate_spec(void) + #if !defined(ENV_IS_EMBEDDED) + 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); +@@ -347,9 +355,14 @@ void env_relocate_spec(void) + + if (readenv(CONFIG_ENV_OFFSET_REDUND, (u_char *) tmp_env2)) + puts("No Valid Redundant Environment Area found\n"); +- +- crc1_ok = crc32(0, tmp_env1->data, ENV_SIZE) == tmp_env1->crc; +- crc2_ok = crc32(0, tmp_env2->data, ENV_SIZE) == tmp_env2->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,calc_crc,tmp_env1->crc,tmp_env1->flags); ++ 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,calc_crc,tmp_env2->crc,tmp_env2->flags); + + if (!crc1_ok && !crc2_ok) { + set_default_env("!bad CRC"); |