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-06 14:13:38 -0500 |
commit | e6fe39351d3363273365ef9be3c4ed4fa274e602 (patch) | |
tree | fb6ac10a4919bd8e756485bb09acccfe417ac100 /recipes-bsp/multitech | |
parent | 1c83ec7a7931d63a6ac7cc7a28c277ae802b0e8e (diff) | |
download | meta-multitech-e6fe39351d3363273365ef9be3c4ed4fa274e602.tar.gz meta-multitech-e6fe39351d3363273365ef9be3c4ed4fa274e602.tar.bz2 meta-multitech-e6fe39351d3363273365ef9be3c4ed4fa274e602.zip |
2nd attempt:patch to prevent inadvertant erasure of environment and allow deliberate erasure
Diffstat (limited to 'recipes-bsp/multitech')
-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); |