diff options
author | John Klug <john.klug@multitech.com> | 2017-04-06 14:13:38 -0500 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2017-04-24 11:43:22 -0500 |
commit | 7e398b750ba30882c96c296494b80576465a7118 (patch) | |
tree | 5bbd62933e118f7f04ed532c1110d6fa57c77047 /recipes-bsp/multitech/u-boot-linux-utils | |
parent | cff3a694b8b95686002295831f3cf4d72b748274 (diff) | |
download | meta-multitech-7e398b750ba30882c96c296494b80576465a7118.tar.gz meta-multitech-7e398b750ba30882c96c296494b80576465a7118.tar.bz2 meta-multitech-7e398b750ba30882c96c296494b80576465a7118.zip |
2nd attempt:patch to prevent inadvertant erasure of environment and allow deliberate erasure
Diffstat (limited to 'recipes-bsp/multitech/u-boot-linux-utils')
-rw-r--r-- | recipes-bsp/multitech/u-boot-linux-utils/crc_erase.patch | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/recipes-bsp/multitech/u-boot-linux-utils/crc_erase.patch b/recipes-bsp/multitech/u-boot-linux-utils/crc_erase.patch index 67cd5ef..5d78703 100644 --- a/recipes-bsp/multitech/u-boot-linux-utils/crc_erase.patch +++ b/recipes-bsp/multitech/u-boot-linux-utils/crc_erase.patch @@ -3,7 +3,7 @@ # Allow the deliberate erasure of the environment with the # clearenv command. diff --git a/src/u_boot.c b/src/u_boot.c -index e240475..f10eaa3 100644 +index e240475..94f18ed 100644 --- a/src/u_boot.c +++ b/src/u_boot.c @@ -64,6 +64,8 @@ static int write_uboot_env(const char *device, struct environment *env) @@ -54,7 +54,7 @@ index e240475..f10eaa3 100644 crc1_ok = 0; } -@@ -315,20 +324,26 @@ int main(int argc, char *argv[]) { +@@ -315,20 +324,27 @@ int main(int argc, char *argv[]) { error("read_uboot_env failed"); return 1; } @@ -75,8 +75,10 @@ index e240475..f10eaa3 100644 crc2_ok = 0; } - if (!crc1_ok && !crc2_ok) { +- if (!crc1_ok && !crc2_ok) { - error("both environments are bad: loading DEFAULT_ENV"); ++ if (!crc1_ok && !crc2_ok && env1->crc == 0xffffffff && ++ (env1->flags == 0xff) && (env2->flags == 0xff) && (env2->crc == 0xffffffff)) { + error("both environments are bad: not loading DEFAULT_ENV"); env = env1; env->flags = 0; @@ -85,7 +87,7 @@ index e240475..f10eaa3 100644 } else if (crc1_ok && !crc2_ok) { env = env1; } else if (!crc1_ok && crc2_ok) { -@@ -353,6 +368,9 @@ int main(int argc, char *argv[]) { +@@ -353,6 +369,9 @@ int main(int argc, char *argv[]) { err = cmd_printenv(env, argc, argv); } else if (!tokcmp(cmd, "setenv")) { err = cmd_setenv(env, argc, argv); |