diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/cmd_nvedit.c | 21 | ||||
-rw-r--r-- | common/env_common.c | 9 |
2 files changed, 28 insertions, 2 deletions
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index cf718e7..c1980da 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -5,7 +5,7 @@ * (C) Copyright 2001 Sysgo Real-Time Solutions, GmbH <www.elinos.com> * Andreas Heppel <aheppel@sysgo.de> * - * Copyright (C) 2010-2011 Freescale Semiconductor, Inc. + * Copyright (C) 2010-2012 Freescale Semiconductor, Inc. * * See file CREDITS for list of people who contributed to this * project. @@ -427,6 +427,16 @@ int do_setenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return _do_setenv (flag, argc, argv); } +#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE) +int do_destroyenv(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + printf("invalidate the CRC\n"); + env_crc_destroy(); + printf("write invalidate enviroment data to storage\n"); + return saveenv() ? 1 : 0; +} +#endif + /************************************************************************ * Prompt for environment variable */ @@ -616,6 +626,15 @@ U_BOOT_CMD( " - delete environment variable 'name'" ); +#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE) +U_BOOT_CMD( + destroyenv, CONFIG_SYS_MAXARGS, 0, do_destroyenv, + "destroy enviroment variables stored in medium", + "\n - destroy all environment variables in medium" + "\n after reset the default settings will be used" +); +#endif + #if defined(CONFIG_CMD_ASKENV) U_BOOT_CMD( diff --git a/common/env_common.c b/common/env_common.c index 21ea543..2f7fae6 100644 --- a/common/env_common.c +++ b/common/env_common.c @@ -4,7 +4,9 @@ * * (C) Copyright 2001 Sysgo Real-Time Solutions, GmbH <www.elinos.com> * Andreas Heppel <aheppel@sysgo.de> - + * + * Copyright (C) 2012 Freescale Semiconductor, Inc. + * * See file CREDITS for list of people who contributed to this * project. * @@ -153,6 +155,11 @@ void env_crc_update (void) env_ptr->crc = crc32(0, env_ptr->data, ENV_SIZE); } +void env_crc_destroy(void) +{ + env_ptr->crc += 1; +} + static uchar env_get_char_init (int index) { uchar c; |