Add support of opts erase for env in ext4,
this opts is used by command 'env erase'.
This command only fill the env file (CONFIG_ENV_EXT4_FILE)
with 0, the CRC and the saved environment becomes invalid.
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
return 0;
}
+static int env_ext4_erase(void)
+{
+ env_t env_new;
+ int err;
+
+ memset(&env_new, 0, sizeof(env_t));
+
+ err = env_ext4_save_buffer(&env_new);
+ if (err)
+ return err;
+
+ gd->env_valid = ENV_INVALID;
+ puts("done\n");
+
+ return 0;
+}
+
static int env_ext4_load(void)
{
ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
ENV_NAME("EXT4")
.load = env_ext4_load,
.save = ENV_SAVE_PTR(env_ext4_save),
+ .erase = CONFIG_IS_ENABLED(CMD_ERASEENV) ? env_ext4_erase :
+ NULL,
};