env: ext4: corrections and add test for env in ext4
v4 cover env: ext4: corrections and add test for env in ext4
Hi,
V4 of the serie [1]: rebase on master branch and solve the SPL size issue for board with SPL_ENV_IS_NOWHERE=y (pointed by Tom Rini in [2])
The buildman result for these boards are:
-------------------------------------------------tools/buildman/buildman -b sssddsqqs T1042RDB_PI_NAND_SECURE_BOOT am335x_guardian am335x_guardian am335x_evm j721e_evm_r5 ls1021atwr_sdcard_ifc_SECURE_BOOT ls1043ardb_nand_SECURE_BOOT ls1043ardb_sdcard_SECURE_BOOT ls1046ardb_qspi_spl ls1088ardb_sdcard_qspi_SECURE_BOOT T1042RDB_PI_NAND_SECURE_BOOT -sS
Summary of 25 commits for 13 boards (12 threads, 1 job per thread) 01: Merge https://gitlab.denx.de/u-boot/custodians/u-boot-spi
aarch64: w+ ls1043ardb_sdcard_SECURE_BOOT ls1046ardb_sdcard_SECURE_BOOT ls1088ardb_sdcard_qspi_SECURE_BOOT
arm: w+ am335x_guardian j721e_evm_r5 ls1021atwr_sdcard_ifc_SECURE_BOOT
powerpc: w+ T1042RDB_PI_NAND_SECURE_BOOT
02: env: mmc: allow support of mmc_get_env_dev with OF_CONTROL
arm: (for 7/7 boards) all +4534.9 bss -4.6 data +4537.1 text +2.3
03: env: mmc: correct the offset returned by mmc_offset_try_partition
arm: (for 7/7 boards) bss +1.1 text -1.104: env: mmc: add redundancy support in mmc_offset_try_partition 05: stm32mp1: board: add support of CONFIG_ENV_IS_IN_MMC 06: stm32mp1: use a specific SD/eMMC partition for U-Boot enviromnent 07: configs:stm32mp1: activate env config in SPL
aarch64: (for 5/5 boards) all -1.8 rodata -1.8
arm: (for 7/7 boards) all +0.9 bss +3.4 rodata -2.6
08: cmd: env: add option for quiet output on env info
aarch64: (for 5/5 boards) all +1.8 rodata +1.8
arm: (for 7/7 boards) all -0.9 bss -3.4 rodata +2.609: cmd: env: check real location for env info command
10: configs: sandbox: Enable sub command 'env info'
11: test: env: add test for env info sub-command
12: env: add absolute path at CONFIG_ENV_EXT4_FILE
13: env: ext4: set gd->env_valid
14: env: sf: avoid space in backend name
aarch64: (for 5/5 boards) all -0.2 rodata -0.2
15: env: correctly handle env_load_prio
aarch64: (for 5/5 boards) all -8.0 spl/u-boot-spl:all -1.6 spl/u-boot-spl:text -1.6 text -8.0
arm: (for 7/7 boards) all -2.3 bss +3.4 spl/u-boot-spl:all -1.7 spl/u-boot-spl:text -1.7 text -5.7
16: env: nowhere: add .load ops
17: env: the ops driver load becomes mandatory in struct env_driver 18: cmd: env: add env load command
19: cmd: env: add env select command
20: configs: sandbox: activate env in ext4 support
21: configs: sandbox: activate command env select and env load 22: test: environment in ext4
23: env: ext4: introduce new function env_ext4_save_buffer 24: env: ext4: add support of command env erase
25: test: sandbox: add test for erase command
-------------------------------------------------
In this serie, I add sandbox test with CONFIG_ENV_IS_NOWHERE activated with EXT4 location: load, save and erase.
To test this feature, I add 2 new commands to change the ENV location:
- env select [target]
- env load
To be able to test invalid file (bad CRC), I also add the support of the command "env erase" for EXT4 env location.
[1] http://patchwork.ozlabs.org/project/uboot/list/?series=185725
[2] http://patchwork.ozlabs.org/project/uboot/patch/20200625075958.9868-6-patrick.delaunay at st.com/
Regards
Patrick
Changes in v4:
- don't use env_import in SPL to avoid to increase its size as it is only required for 'env load' command
Changes in v3:
- new
- new
- new: add load ops in nowhere
- new: load operation becomes mandatory
- new: add 'env load' command
- new: add 'env select' command
- change env_get_location to avoid gd->env_load_prio modification
- replace specific sandbox command by generic command 'env select' and 'env load'
- change title "sandbox: support the change of env location"
- replace specific sandbox command by generic command 'env select' and 'env load'
- update after Stephen Warren comments
- replace sandbox command by generic command 'env load' in test_env
Changes in v2:
- change cmd_tbl_t to struct cmd_tbl
- use CONFIG_IS_ENABLED to set .erase (same as .save)
Patrick Delaunay (14):
env: add absolute path at CONFIG_ENV_EXT4_FILE
env: ext4: set gd->env_valid
env: sf: avoid space in backend name
env: correctly handle env_load_prio
env: nowhere: add .load ops
env: the ops driver load becomes mandatory in struct env_driver
cmd: env: add env load command
cmd: env: add env select command
configs: sandbox: activate env in ext4 support
configs: sandbox: activate command env select and env load
test: environment in ext4
env: ext4: introduce new function env_ext4_save_buffer
env: ext4: add support of command env erase
test: sandbox: add test for erase command
board/sandbox/sandbox.c | 15 ++++ cmd/Kconfig | 11 +++ cmd/nvedit.c | 29 ++++++++ configs/sandbox64_defconfig | 7 ++ configs/sandbox_defconfig | 7 ++ configs/sandbox_flattree_defconfig | 7 ++ configs/sandbox_spl_defconfig | 7 ++ env/Kconfig | 2 +- env/env.c | 80 ++++++++++++++++++-- env/ext4.c | 54 ++++++++++++-- env/nowhere.c | 17 +++++ env/sf.c | 2 +- include/env.h | 15 +++- include/env_internal.h | 3 +- test/py/tests/test_env.py | 113 ++++++++++++++++++++++++++++- 15 files changed, 349 insertions(+), 20 deletions(-)
Signature · 1 line
2.17.1
PATCH v4 1/14 env: add absolute path at CONFIG_ENV_EXT4_FILE
Add the absolute path to the default value ofCONFIG_ENV_EXT4_FILE = "/uboot.env".
This patch avoid the error :
Saving Environment to EXT4... File System is consistent Please supply Absolute path
---
For information, it is the value used today by all the boards:
dragonboard820c_defconfig:29:CONFIG_ENV_EXT4_FILE="/uboot.env" hikey960_defconfig:25:CONFIG_ENV_EXT4_FILE="/uboot.env" stm32mp15_basic_defconfig:64:CONFIG_ENV_EXT4_FILE="/uboot.env" stm32mp15_trusted_defconfig:50:CONFIG_ENV_EXT4_FILE="/uboot.env"
(no changes since v1)
env/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
env/Kconfig +1 -1
@@ -473,7 +473,7 @@ config ENV_EXT4_DEVICE_AND_PART config ENV_EXT4_FILE string "Name of the EXT4 file to use for the environment" depends on ENV_IS_IN_EXT4 - default "uboot.env" + default "/uboot.env" help It's a string of the EXT4 file name. This file use to store the environment (explicit path to the file)
Signature · 1 line
2.17.1
PATCH v4 1/14 env: add absolute path at CONFIG_ENV_EXT4_FILE
Quoted 9 lines · Patrick Delaunay
Add the absolute path to the default value of
CONFIG_ENV_EXT4_FILE= "/uboot.env".This patch avoid the error :
Saving Environment to EXT4... File System is consistent Please supply Absolute pathReviewed-by Tom Rini <[email protected]>Signed-off-by Patrick Delaunay <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200731/3bb7bf7a/attachment.sig>
PATCH v4 2/14 env: ext4: set gd->env_valid
In reply to Patrick DelaunayAdd a missing initialization of gd->env_valid in env_ext4_load as it is already done in some other env device.
Set gd->env_valid = ENV_VALID in env_ext4_save() and env_ext4_load().
This patch allows to have a correct information in 'env info' command.
---
(no changes since v1)
env/ext4.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
env/ext4.c +8 -1
@@ -32,6 +32,8 @@#include <ext4fs.h> #include <mmc.h> +DECLARE_GLOBAL_DATA_PTR ; +__weak const char *env_ext4_get_intf (void ) {return (const char *)CONFIG_ENV_EXT4_INTERFACE ;
@@ -79,6 +81,7 @@ static int env_ext4_save(void) CONFIG_ENV_EXT4_FILE, ifname, dev, part);return 1 ; } + gd->env_valid =ENV_VALID ;puts ("done\n" );return 0 ;
@@ -124,7 +127,11 @@ static int env_ext4_load(void) goto err_env_relocate; } -return env_import (buf,1 ); + err =env_import (buf,1 ); +if (!err) + gd->env_valid =ENV_VALID ; + +return err; err_env_relocate:env_set_default (NULL ,0 );
Signature · 1 line
2.17.1
PATCH v4 2/14 env: ext4: set gd->env_valid
Quoted 9 lines · Patrick Delaunay
Add a missing initialization of
gd->env_validinenv_ext4_loadas it is already done in some other env device.Set
gd->env_valid=ENV_VALIDinenv_ext4_save()andenv_ext4_load().This patch allows to have a correct information in 'env info' command.
Reviewed-by Tom Rini <[email protected]>Signed-off-by Patrick Delaunay <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200731/b6dfc186/attachment.sig>
PATCH v4 3/14 env: sf: avoid space in backend name
In reply to Patrick DelaunayRemove space in ENV backend name for SPI Flash (SF) to avoid issue with env select command.
---
(no changes since v3)
Changes in v3:
- new
env/sf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
env/sf.c +1 -1
@@ -305,7 +305,7 @@ static int env_sf_init(void)U_BOOT_ENV_LOCATION (sf) = { .location =ENVL_SPI_FLASH , -ENV_NAME ("SPI Flash" ) +ENV_NAME ("SPIFlash" ) .load = env_sf_load, .save =CONFIG_IS_ENABLED (SAVEENV ) ?ENV_SAVE_PTR (env_sf_save) :NULL , #if defined(INITENV) && (CONFIG_ENV_ADDR != 0x0)
Signature · 1 line
2.17.1
PATCH v4 3/14 env: sf: avoid space in backend name
Quoted 4 lines · Patrick Delaunay
Remove space in ENV backend name for SPI Flash (SF) to avoid issue with env select command.
Signed-off-by Patrick Delaunay <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200731/d1626722/attachment.sig>
PATCH v4 4/14 env: correctly handle env_load_prio
In reply to Patrick DelaunayOnly update gd->env_load_prio in generic function env_load() and no more in the weak function env_get_location() which is called in many place (for example in env_driver_lookup, even for ENVOP_SAVE operation).
This patch is a preliminary step to use env_driver_lookup()/ env_get_location() in new function env_select() without updating gd->env_load_prio.
---
(no changes since v3)
Changes in v3:
- new
env/env.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
env/env.c +4 -3
@@ -131,8 +131,6 @@ __weak enum env_location env_get_location(enum env_operation op, int prio)if (prio >=ARRAY_SIZE (env_locations))return ENVL_UNKNOWN ; - gd->env_load_prio = prio; -return env_locations[prio]; }
@@ -204,6 +202,8 @@ int env_load(void) ret = drv->load ();if (!ret) {printf ("OK\n" ); + gd->env_load_prio = prio; +return 0 ; }else if (ret == -ENOMSG ) {/* Handle "bad CRC" case */
@@ -227,7 +227,8 @@ int env_load(void)debug ("Selecting environment with bad CRC\n" ); else best_prio =0 ; -env_get_location (ENVOP_LOAD , best_prio); + + gd->env_load_prio = best_prio;return -ENODEV ; }
Signature · 1 line
2.17.1
PATCH v4 4/14 env: correctly handle env_load_prio
Quoted 10 lines · Patrick Delaunay
Only update
gd->env_load_prioin generic functionenv_load()and no more in the weak functionenv_get_location()which is called in many place (for example inenv_driver_lookup, even forENVOP_SAVEoperation).This patch is a preliminary step to use env_driver_lookup()/
env_get_location()in new functionenv_select()without updatinggd->env_load_prio.Signed-off-by Patrick Delaunay <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200731/aa1b25c5/attachment.sig>
PATCH v4 5/14 env: nowhere: add .load ops
In reply to Patrick DelaunayAdd the ops .load for nowhere ENV backend to load the default environment.
This ops is needed for the command 'env load'
---
Changes in v4:
- don't use env_import in SPL to avoid to increase its size as it is only required for 'env load' command
Changes in v3:
- new: add load ops in nowhere
env/nowhere.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
env/nowhere.c +17 -0
@@ -27,8 +27,25 @@ static int env_nowhere_init(void)return 0 ; } +static int env_nowhere_load (void ) +{ +/* +* for SPL, set env_valid = ENV_INVALID is enougth as env_get_char() +* return the default env if env_get is used +* and SPL don't used env_import to reduce its size +* For U-Boot proper, import the default environment to allow reload. +*/ +if (!IS_ENABLED (CONFIG_SPL_BUILD )) +env_set_default (NULL ,0 ); + + gd->env_valid =ENV_INVALID ; + +return 0 ; +} +U_BOOT_ENV_LOCATION (nowhere) = { .location =ENVL_NOWHERE , .init = env_nowhere_init, + .load = env_nowhere_load,ENV_NAME ("nowhere" ) };
Signature · 1 line
2.17.1
PATCH v4 5/14 env: nowhere: add .load ops
Quoted 6 lines · Patrick Delaunay
Add the ops .load for nowhere ENV backend to load the default environment.
This ops is needed for the command 'env load'
Signed-off-by Patrick Delaunay <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200731/d532b4d4/attachment.sig>
PATCH v4 6/14 env: the ops driver load becomes mandatory in struct env_driver
In reply to Patrick DelaunayThe ops driver load becomes mandatory in struct env_drive, change the comment for this ops and remove unnecessary test.
---
(no changes since v3)
Changes in v3:
- new: load operation becomes mandatory
env/env.c | 3 --- include/env_internal.h | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-)
env/env.c +0 -3
@@ -187,9 +187,6 @@ int env_load(void)for (prio =0 ; (drv =env_driver_lookup (ENVOP_LOAD , prio)); prio++) {int ret; -if (!drv->load) -continue ; -if (!env_has_inited (drv->location))continue ;
include/env_internal.h +1 -2
@@ -154,8 +154,7 @@ struct env_driver {/** * load() - Load the environment from storage * -* This method is optional. If not provided, no environment will be -* loaded. +* This method is required for loading environment * * @return 0 if OK, -ve on error */
Signature · 1 line
2.17.1
PATCH v4 6/14 env: the ops driver load becomes mandatory in struct env_driver
Quoted 4 lines · Patrick Delaunay
The ops driver load becomes mandatory in struct
env_drive, change the comment for this ops and remove unnecessary test.Signed-off-by Patrick Delaunay <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200731/6f06791b/attachment.sig>
PATCH v4 7/14 cmd: env: add env load command
In reply to Patrick DelaunayAdd the new command env load to load the environment from the current location gd->env_load_prio.
---
(no changes since v3)
Changes in v3:
- new: add 'env load' command
cmd/Kconfig | 6 ++++++ cmd/nvedit.c | 14 ++++++++++++++ env/env.c | 28 ++++++++++++++++++++++++++++ include/env.h | 7 +++++++ 4 files changed, 55 insertions(+)
cmd/Kconfig +6 -0
@@ -604,6 +604,12 @@ config CMD_NVEDIT_INFO [-q] : quiet output The result of multiple evaluations will be combined with AND. +config CMD_NVEDIT_LOAD + bool "env load" + help + Load all environment variables from the compiled-in persistent + storage. + endmenu menu "Memory commands"
cmd/nvedit.c +14 -0
@@ -794,6 +794,14 @@ U_BOOT_CMD( );#endif #endif + +#if defined(CONFIG_CMD_NVEDIT_LOAD ) +static int do_env_load (struct cmd_tbl *cmdtp,int flag,int argc, +char *const argv[]) +{ +return env_reload () ?1 :0 ; +} +#endif #endif /* CONFIG_SPL_BUILD */ int env_match (uchar *s1,int i2)
@@ -1346,6 +1354,9 @@ static struct cmd_tbl cmd_env_sub[] = {#endif #if defined(CONFIG_CMD_NVEDIT_INFO ) U_BOOT_CMD_MKENT(info, 3, 0, do_env_info, "", ""), +#endif +#if defined(CONFIG_CMD_NVEDIT_LOAD ) + U_BOOT_CMD_MKENT(load, 1, 0, do_env_load, "", ""), #endif U_BOOT_CMD_MKENT(print, CONFIG_SYS_MAXARGS, 1, do_env_print, "", ""),#if defined(CONFIG_CMD_RUN )
@@ -1442,6 +1453,9 @@ static char env_help_text[] = "env erase - erase environment\n"#endif #endif +#if defined(CONFIG_CMD_NVEDIT_LOAD ) + "env load - load environment\n" +#endif #if defined(CONFIG_CMD_NVEDIT_EFI )"env set -e [-nv][-bs][-rt][-at][-a][-i addr,size][-v] name [arg ...]\n" " - set UEFI variable; unset if '-i' or 'arg' not specified\n"
env/env.c +28 -0
@@ -230,6 +230,34 @@ int env_load(void)return -ENODEV ; } +int env_reload (void ) +{ +struct env_driver *drv; + + drv =env_driver_lookup (ENVOP_LOAD , gd->env_load_prio); +if (drv) { +int ret; + +printf ("Loading Environment from %s... " , drv->name); + +if (!env_has_inited (drv->location)) { +printf ("not initialized\n" ); +return -ENODEV ; + } + + ret = drv->load (); +if (ret) +printf ("Failed (%d)\n" , ret); +else +printf ("OK\n" ); + +if (!ret) +return 0 ; + } + +return -ENODEV ; +} +int env_save (void ) {struct env_driver *drv;
include/env.h +7 -0
@@ -265,6 +265,13 @@ int env_set_default_vars(int nvars, char *const vars[], int flags);*/ int env_load (void ); +/** +* env_reload() - Re-Load the environment from current storage +* +* @return 0 if OK, -ve on error +*/ +int env_reload (void ); +/** * env_save() - Save the environment to storage *
Signature · 1 line
2.17.1
PATCH v4 7/14 cmd: env: add env load command
Quoted 4 lines · Patrick Delaunay
Add the new command env load to load the environment from the current location
gd->env_load_prio.Signed-off-by Patrick Delaunay <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200731/918f5de9/attachment.sig>
PATCH v4 8/14 cmd: env: add env select command
In reply to Patrick DelaunayAdd the new command 'env select' to force the persistent storage of environment, saved in gd->env_load_prio.
---
(no changes since v3)
Changes in v3:
- new: add 'env select' command
cmd/Kconfig | 5 +++++ cmd/nvedit.c | 15 +++++++++++++++ env/env.c | 42 ++++++++++++++++++++++++++++++++++++++++++ include/env.h | 8 +++++++- 4 files changed, 69 insertions(+), 1 deletion(-)
cmd/Kconfig +5 -0
@@ -610,6 +610,11 @@ config CMD_NVEDIT_LOAD Load all environment variables from the compiled-in persistent storage. +config CMD_NVEDIT_SELECT + bool "env select" + help + Select the compiled-in persistent storage of environment variables. + endmenu menu "Memory commands"
cmd/nvedit.c +15 -0
@@ -802,6 +802,15 @@ static int do_env_load(struct cmd_tbl *cmdtp, int flag, int argc,return env_reload () ?1 :0 ; }#endif + +#if defined(CONFIG_CMD_NVEDIT_SELECT ) +static int do_env_select (struct cmd_tbl *cmdtp,int flag,int argc, +char *const argv[]) +{ +return env_select (argv[1 ]) ?1 :0 ; +} +#endif +#endif /* CONFIG_SPL_BUILD */ int env_match (uchar *s1,int i2)
@@ -1367,6 +1376,9 @@ static struct cmd_tbl cmd_env_sub[] = {#if defined(CONFIG_CMD_ERASEENV ) U_BOOT_CMD_MKENT(erase, 1, 0, do_env_erase, "", ""),#endif +#endif +#if defined(CONFIG_CMD_NVEDIT_SELECT ) + U_BOOT_CMD_MKENT(select, 2, 0, do_env_select, "", ""), #endif U_BOOT_CMD_MKENT(set, CONFIG_SYS_MAXARGS, 0, do_env_set, "", ""),#if defined(CONFIG_CMD_ENV_EXISTS )
@@ -1456,6 +1468,9 @@ static char env_help_text[] =#if defined(CONFIG_CMD_NVEDIT_LOAD ) "env load - load environment\n"#endif +#if defined(CONFIG_CMD_NVEDIT_SELECT ) + "env select [target] - select environment target\n" +#endif #if defined(CONFIG_CMD_NVEDIT_EFI )"env set -e [-nv][-bs][-rt][-at][-a][-i addr,size][-v] name [arg ...]\n" " - set UEFI variable; unset if '-i' or 'arg' not specified\n"
env/env.c +42 -0
45 lines not on this page · raw message
include/env.h +7 -1
@@ -286,6 +286,13 @@ int env_save(void);*/ int env_erase (void ); +/** +* env_select() - Select the environment storage +* +* @return 0 if OK, -ve on error +*/ +int env_select (const char *name); +/** * env_import() - Import from a binary representation into hash table *
@@ -349,5 +356,4 @@ int env_get_char(int index);* This is used for those unfortunate archs with crappy toolchains */ void env_reloc (void ); -#endif
Signature · 1 line
2.17.1
PATCH v4 8/14 cmd: env: add env select command
Quoted 4 lines · Patrick Delaunay
Add the new command 'env select' to force the persistent storage of environment, saved in
gd->env_load_prio.Signed-off-by Patrick Delaunay <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200731/1620a06d/attachment.sig>
PATCH v4 9/14 configs: sandbox: activate env in ext4 support
In reply to Patrick DelaunayActivate ENV in EXT4 support in sandbox.
The sandbox behavior don't change; the default environment with the nowhere backend (CONFIG_ENV_IS_NOWHERE)is still used:
the weak function env_get_location() return ENVL_NOWHERE for priority 0.
---
(no changes since v3)
Changes in v3:
- change env_get_location to avoid gd->env_load_prio modification
board/sandbox/sandbox.c | 15 +++++++++++++++ configs/sandbox64_defconfig | 4 ++++ configs/sandbox_defconfig | 4 ++++ configs/sandbox_flattree_defconfig | 4 ++++ configs/sandbox_spl_defconfig | 4 ++++ 5 files changed, 31 insertions(+)
board/sandbox/sandbox.c +15 -0
@@ -7,6 +7,7 @@#include <cpu_func.h> #include <cros_ec.h> #include <dm.h> +#include <env_internal.h> #include <init.h> #include <led.h> #include <os.h>
@@ -44,6 +45,20 @@ unsigned long timer_read_counter(void) }#endif +/* specific order for sandbox: nowhere is the first value, used by default */ +static enum env_location env_locations[] = { +ENVL_NOWHERE , +ENVL_EXT4 , +}; + +enum env_location env_get_location (enum env_operation op,int prio) +{ +if (prio >=ARRAY_SIZE (env_locations)) +return ENVL_UNKNOWN ; + +return env_locations[prio]; +} +int dram_init (void ) { gd->ram_size =CONFIG_SYS_SDRAM_SIZE ;
configs/sandbox64_defconfig +4 -0
@@ -83,6 +83,10 @@ CONFIG_OF_CONTROL=y CONFIG_OF_LIVE=y CONFIG_OF_HOSTFILE=y CONFIG_DEFAULT_DEVICE_TREE="sandbox64" +CONFIG_ENV_IS_NOWHERE=y +CONFIG_ENV_IS_IN_EXT4=y +CONFIG_ENV_EXT4_INTERFACE="host" +CONFIG_ENV_EXT4_DEVICE_AND_PART="0:0" CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y CONFIG_REGMAP=y
configs/sandbox_defconfig +4 -0
@@ -93,6 +93,10 @@ CONFIG_OF_CONTROL=y CONFIG_OF_LIVE=y CONFIG_OF_HOSTFILE=y CONFIG_DEFAULT_DEVICE_TREE="sandbox" +CONFIG_ENV_IS_NOWHERE=y +CONFIG_ENV_IS_IN_EXT4=y +CONFIG_ENV_EXT4_INTERFACE="host" +CONFIG_ENV_EXT4_DEVICE_AND_PART="0:0" CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y CONFIG_REGMAP=y
configs/sandbox_flattree_defconfig +4 -0
@@ -66,6 +66,10 @@ CONFIG_AMIGA_PARTITION=y CONFIG_OF_CONTROL=y CONFIG_OF_HOSTFILE=y CONFIG_DEFAULT_DEVICE_TREE="sandbox" +CONFIG_ENV_IS_NOWHERE=y +CONFIG_ENV_IS_IN_EXT4=y +CONFIG_ENV_EXT4_INTERFACE="host" +CONFIG_ENV_EXT4_DEVICE_AND_PART="0:0" CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y CONFIG_REGMAP=y
configs/sandbox_spl_defconfig +4 -0
@@ -81,6 +81,10 @@ CONFIG_SPL_OF_CONTROL=y CONFIG_OF_HOSTFILE=y CONFIG_DEFAULT_DEVICE_TREE="sandbox" CONFIG_SPL_OF_PLATDATA=y +CONFIG_ENV_IS_NOWHERE=y +CONFIG_ENV_IS_IN_EXT4=y +CONFIG_ENV_EXT4_INTERFACE="host" +CONFIG_ENV_EXT4_DEVICE_AND_PART="0:0" CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y CONFIG_SPL_DM=y
Signature · 1 line
2.17.1
PATCH v4 9/14 configs: sandbox: activate env in ext4 support
Quoted 7 lines · Patrick Delaunay
Activate ENV in EXT4 support in sandbox.
The sandbox behavior don't change; the default environment with the nowhere backend (CONFIG_ENV_IS_NOWHERE)is still used:
the weak functionenv_get_location()returnENVL_NOWHEREfor priority 0.Signed-off-by Patrick Delaunay <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200731/e59caf7c/attachment.sig>
PATCH v4 10/14 configs: sandbox: activate command env select and env load
In reply to Patrick DelaunayAdd support of environment location with the new env command:
'env select' and 'env load'
The ENV backend is selected by priority order
- 0 = "nowhere" (default at boot)
- 1 = "EXT4"
To test EXT4 env support, this backend is selected by name:
Quoted 1 line
env select EXT4
---
(no changes since v3)
Changes in v3:
- replace specific sandbox command by generic command 'env select' and 'env load'
- change title "sandbox: support the change of env location"
Changes in v2:
- change cmd_tbl_t to struct cmd_tbl
configs/sandbox64_defconfig | 2 ++ configs/sandbox_defconfig | 2 ++ configs/sandbox_flattree_defconfig | 2 ++ configs/sandbox_spl_defconfig | 2 ++ 4 files changed, 8 insertions(+)
configs/sandbox64_defconfig +2 -0
@@ -31,6 +31,8 @@ CONFIG_CMD_ENV_CALLBACK=y CONFIG_CMD_ENV_FLAGS=y CONFIG_CMD_NVEDIT_EFI=y CONFIG_CMD_NVEDIT_INFO=y +CONFIG_CMD_NVEDIT_LOAD=y +CONFIG_CMD_NVEDIT_SELECT=y CONFIG_LOOPW=y CONFIG_CMD_MD5SUM=y CONFIG_CMD_MEMINFO=y
configs/sandbox_defconfig +2 -0
@@ -35,6 +35,8 @@ CONFIG_CMD_ENV_CALLBACK=y CONFIG_CMD_ENV_FLAGS=y CONFIG_CMD_NVEDIT_EFI=y CONFIG_CMD_NVEDIT_INFO=y +CONFIG_CMD_NVEDIT_LOAD=y +CONFIG_CMD_NVEDIT_SELECT=y CONFIG_LOOPW=y CONFIG_CMD_MD5SUM=y CONFIG_CMD_MEMINFO=y
configs/sandbox_flattree_defconfig +2 -0
@@ -25,6 +25,8 @@ CONFIG_CMD_BOOTEFI_HELLO=y CONFIG_CMD_ASKENV=y CONFIG_CMD_GREPENV=y CONFIG_CMD_NVEDIT_INFO=y +CONFIG_CMD_NVEDIT_LOAD=y +CONFIG_CMD_NVEDIT_SELECT=y CONFIG_LOOPW=y CONFIG_CMD_MD5SUM=y CONFIG_CMD_MEMINFO=y
configs/sandbox_spl_defconfig +2 -0
@@ -35,6 +35,8 @@ CONFIG_CMD_GREPENV=y CONFIG_CMD_ENV_CALLBACK=y CONFIG_CMD_ENV_FLAGS=y CONFIG_CMD_NVEDIT_INFO=y +CONFIG_CMD_NVEDIT_LOAD=y +CONFIG_CMD_NVEDIT_SELECT=y CONFIG_LOOPW=y CONFIG_CMD_MD5SUM=y CONFIG_CMD_MEMINFO=y
Signature · 1 line
2.17.1
PATCH v4 10/14 configs: sandbox: activate command env select and env load
Quoted 11 lines · Patrick Delaunay
Add support of environment location with the new env command:
'env select' and 'env load'The ENV backend is selected by priority order
- 0 = "nowhere" (default at boot)
- 1 = "EXT4"To test EXT4 env support, this backend is selected by name:
Quoted 1 line
env select EXT4
Signed-off-by Patrick Delaunay <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200731/46a45561/attachment.sig>
PATCH v4 11/14 test: environment in ext4
In reply to Patrick DelaunayAdd basic test to persistent environment in ext4:
save and load in host ext4 file 'uboot.env'.
On first execution an empty EXT4 file system is created in persistent data dir: env.ext4.img.
---
(no changes since v3)
Changes in v3:
- replace specific sandbox command by generic command 'env select' and 'env load'
- update after Stephen Warren comments
test/py/tests/test_env.py | 97 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 96 insertions(+), 1 deletion(-)
test/py/tests/test_env.py +96 -1
@@ -4,6 +4,10 @@ # Test operation of shell commands relating to environment variables. +import os +import os.path +from subprocess import call, check_call, CalledProcessError + import pytest import u_boot_utils
@@ -374,7 +378,6 @@ def test_env_info(state_test_env): @pytest.mark.buildconfigspec('cmd_nvedit_info') @pytest.mark.buildconfigspec('cmd_echo') def test_env_info_sandbox(state_test_env): - """Test 'env info' command result with several options on sandbox with a known ENV configuration: ready & default & persistent """
@@ -399,3 +402,95 @@ def test_env_info_sandbox(state_test_env): response = c.run_command('env info -d -p -q') response = c.run_command('echo $?') assert response == "1" + +def mk_env_ext4(state_test_env): + + """Create a empty ext4 file system volume.""" + c = state_test_env.u_boot_console + filename = 'env.ext4.img' + persistent = c.config.persistent_data_dir + '/' + filename + fs_img = c.config.result_dir + '/' + filename + + if os.path.exists(persistent): + c.log.action('Disk image file ' + persistent + ' already exists') + else: + try: + u_boot_utils.run_and_log(c, 'dd if=/dev/zero of=%s bs=1M count=16' % persistent) + u_boot_utils.run_and_log(c, 'mkfs.ext4 -O ^metadata_csum %s' % persistent) + except CalledProcessError: + call('rm -f %s' % persistent, shell=True) + raise + + u_boot_utils.run_and_log(c, ['cp', '-f', persistent, fs_img]) + return fs_img + + at pytest.mark.boardspec('sandbox') + at pytest.mark.buildconfigspec('cmd_echo') + at pytest.mark.buildconfigspec('cmd_nvedit_info') + at pytest.mark.buildconfigspec('cmd_nvedit_load') + at pytest.mark.buildconfigspec('cmd_nvedit_select') + at pytest.mark.buildconfigspec('env_is_in_ext4') +def test_env_ext4(state_test_env): + + """Test ENV in EXT4 on sandbox.""" + c = state_test_env.u_boot_console + fs_img = '' + try: + fs_img = mk_env_ext4(state_test_env) + + c.run_command('host bind 0 %s' % fs_img) + + response = c.run_command('ext4ls host 0:0') + assert 'uboot.env' not in response + + # force env location: EXT4 (prio 1 in sandbox) + response = c.run_command('env select EXT4') + assert 'Select Environment on EXT4: OK' in response + + response = c.run_command('env save') + assert 'Saving Environment to EXT4' in response + + response = c.run_command('env load') + assert 'Loading Environment from EXT4... OK' in response + + response = c.run_command('ext4ls host 0:0') + assert '8192 uboot.env' in response + + response = c.run_command('env info') + assert 'env_valid = valid' in response + assert 'env_ready = true' in response + assert 'env_use_default = false' in response + + response = c.run_command('env info -p -d') + assert 'Environment was loaded from persistent storage' in response + assert 'Environment can be persisted' in response + + response = c.run_command('env info -d -q') + assert response == "" + response = c.run_command('echo $?') + assert response == "1" + + response = c.run_command('env info -p -q') + assert response == "" + response = c.run_command('echo $?') + assert response == "0" + + # restore env location: NOWHERE (prio 0 in sandbox) + response = c.run_command('env select nowhere') + assert 'Select Environment on nowhere: OK' in response + + response = c.run_command('env load') + assert 'Loading Environment from nowhere... OK' in response + + response = c.run_command('env info') + assert 'env_valid = invalid' in response + assert 'env_ready = true' in response + assert 'env_use_default = true' in response + + response = c.run_command('env info -p -d') + assert 'Default environment is used' in response + assert 'Environment cannot be persisted' in response + + finally: + if fs_img: + call('rm -f %s' % fs_img, shell=True)
Signature · 1 line
2.17.1
PATCH v4 11/14 test: environment in ext4
Quoted 7 lines · Patrick Delaunay
Add basic test to persistent environment in ext4:
save and load in host ext4 file 'uboot.env'.On first execution an empty EXT4 file system is created in persistent data dir: env.ext4.img.
Signed-off-by Patrick Delaunay <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200731/73ea437d/attachment.sig>
PATCH v4 11/14 test: environment in ext4
In reply to Patrick Delaunaytest/py/tests/test_env.py def test_env_info_sandbox(state_test_env): · line 419
Quoted 11 lines · Patrick Delaunay
Add basic test to persistent environment in ext4:
save and load in host ext4 file 'uboot.env'.On first execution an empty EXT4 file system is created in persistent data dir: env.ext4.img.
test/py/tests/test_env.py +2
-0+def mk_env_ext4(state_test_env): + u_boot_utils.run_and_log(c, 'mkfs.ext4 -O ^metadata_csum %s' % persistent)
Is "-O ^metadata_csum" necessary? The mkfs.ext4 in Ubuntu 16.04 doesn't support that option, which causes this command to fail.
PATCH v4 11/14 test: environment in ext4
Quoted 7 lines · Stephen Warren
Quoted 5 lines · Patrick Delaunay
Add basic test to persistent environment in ext4:
save and load in host ext4 file 'uboot.env'.On first execution an empty EXT4 file system is created in persistent data dir: env.ext4.img.
Quoted 8 lines
test/py/tests/test_env.py def test_env_info_sandbox(state_test_env): · line 419
Quoted 5 lines
test/py/tests/test_env.py +2
-0+def mk_env_ext4(state_test_env): + u_boot_utils.run_and_log(c, 'mkfs.ext4 -O ^metadata_csum %s' % persistent)Is "-O ^metadata_csum" necessary? The mkfs.ext4 in Ubuntu 16.04 doesn't support that option, which causes this command to fail.
Yes, it's required because we don't support that feature in our ext4 codebase and newer tools default to enabling that. Supporting that flag is on my wishlist of items.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200803/d77f7714/attachment.sig>
PATCH v4 11/14 test: environment in ext4
Quoted 12 lines · Tom Rini
Quoted 11 lines · Stephen Warren
Quoted 9 lines · Patrick Delaunay
Add basic test to persistent environment in ext4:
save and load in host ext4 file 'uboot.env'.On first execution an empty EXT4 file system is created in persistent data dir: env.ext4.img.
test/py/tests/test_env.py +1
-0+def mk_env_ext4(state_test_env):
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
+
u_boot_utils.run_and_log(c, 'mkfs.ext4 -O ^metadata_csum %s' % persistent)Is "-O ^metadata_csum" necessary? The mkfs.ext4 in Ubuntu 16.04 doesn't support that option, which causes this command to fail.
Yes, it's required because we don't support that feature in our ext4 codebase and newer tools default to enabling that. Supporting that flag is on my wishlist of items.
Hmm. Is there a way to detect that, and only use the flag when necessary?
PATCH v4 11/14 test: environment in ext4
Quoted 15 lines · Stephen Warren
Quoted 14 lines · Tom Rini
Quoted 13 lines · Stephen Warren
Quoted 11 lines · Patrick Delaunay
Add basic test to persistent environment in ext4:
save and load in host ext4 file 'uboot.env'.On first execution an empty EXT4 file system is created in persistent data dir: env.ext4.img.
test/py/tests/test_env.py +2
-0+def mk_env_ext4(state_test_env): + u_boot_utils.run_and_log(c, 'mkfs.ext4 -O ^metadata_csum %s' % persistent)
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Is "-O ^metadata_csum" necessary? The mkfs.ext4 in Ubuntu 16.04 doesn't support that option, which causes this command to fail.
Yes, it's required because we don't support that feature in our ext4 codebase and newer tools default to enabling that. Supporting that flag is on my wishlist of items.
Hmm. Is there a way to detect that, and only use the flag when necessary?
I'm not sure. I mean, we could put the above in a try/except?
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200803/8f77b990/attachment.sig>
PATCH v4 12/14 env: ext4: introduce new function env_ext4_save_buffer
In reply to Patrick DelaunaySplit the function env_ext4_save to prepare the erase support.
---
(no changes since v1)
env/ext4.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-)
env/ext4.c +20 -8
@@ -44,9 +44,8 @@ __weak const char *env_ext4_get_dev_part(void)return (const char *)CONFIG_ENV_EXT4_DEVICE_AND_PART ; } -static int env_ext4_save (void ) +static int env_ext4_save_buffer (env_t *env_new) { -env_t env_new;struct blk_desc *dev_desc =NULL ;struct disk_partition info;int dev, part;
@@ -54,10 +53,6 @@ static int env_ext4_save(void)const char *ifname =env_ext4_get_intf ();const char *dev_and_part =env_ext4_get_dev_part (); - err =env_export (&env_new); -if (err) -return err; - part =blk_get_device_part_str (ifname, dev_and_part, &dev_desc, &info,1 );if (part <0 )
@@ -72,7 +67,7 @@ static int env_ext4_save(void)return 1 ; } - err =ext4fs_write (CONFIG_ENV_EXT4_FILE , (void *)&env_new, + err =ext4fs_write (CONFIG_ENV_EXT4_FILE , (void *)env_new,sizeof (env_t),FILETYPE_REG );ext4fs_close ();
@@ -81,9 +76,26 @@ static int env_ext4_save(void) CONFIG_ENV_EXT4_FILE, ifname, dev, part);return 1 ; } - gd->env_valid =ENV_VALID ; +return 0 ; +} + +static int env_ext4_save (void ) +{ +env_t env_new; +int err; + + err =env_export (&env_new); +if (err) +return err; + + err =env_ext4_save_buffer (&env_new); +if (err) +return err; + + gd->env_valid =ENV_VALID ;puts ("done\n" ); +return 0 ; }
Signature · 1 line
2.17.1
PATCH v4 12/14 env: ext4: introduce new function env_ext4_save_buffer
Quoted 3 lines · Patrick Delaunay
Split the function
env_ext4_saveto prepare the erase support.Signed-off-by Patrick Delaunay <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200731/24fa2465/attachment.sig>
PATCH v4 13/14 env: ext4: add support of command env erase
In reply to Patrick DelaunayAdd 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.
---
(no changes since v2)
Changes in v2:
- use CONFIG_IS_ENABLED to set .erase (same as .save)
env/ext4.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
env/ext4.c +19 -0
@@ -99,6 +99,23 @@ static int env_ext4_save(void)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 );
@@ -156,4 +173,6 @@ U_BOOT_ENV_LOCATION(ext4) = {ENV_NAME ("EXT4" ) .load = env_ext4_load, .save = ENV_SAVE_PTR(env_ext4_save), + .erase =CONFIG_IS_ENABLED (CMD_ERASEENV ) ? env_ext4_erase : + NULL, };
Signature · 1 line
2.17.1
PATCH v4 13/14 env: ext4: add support of command env erase
Quoted 7 lines · Patrick Delaunay
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 <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200731/7facd073/attachment.sig>
PATCH v4 14/14 test: sandbox: add test for erase command
In reply to Patrick DelaunayAdd test for the erase command tested on ENV in EXT4.
---
(no changes since v3)
Changes in v3:
- replace sandbox command by generic command 'env load' in test_env
configs/sandbox64_defconfig | 1 + configs/sandbox_defconfig | 1 + configs/sandbox_flattree_defconfig | 1 + configs/sandbox_spl_defconfig | 1 + test/py/tests/test_env.py | 16 ++++++++++++++++ 5 files changed, 20 insertions(+)
configs/sandbox64_defconfig +1 -0
@@ -27,6 +27,7 @@ CONFIG_CMD_BOOTEFI_HELLO=y # CONFIG_CMD_ELF is not set CONFIG_CMD_ASKENV=y CONFIG_CMD_GREPENV=y +CONFIG_CMD_ERASEENV=y CONFIG_CMD_ENV_CALLBACK=y CONFIG_CMD_ENV_FLAGS=y CONFIG_CMD_NVEDIT_EFI=y
configs/sandbox_defconfig +1 -0
@@ -31,6 +31,7 @@ CONFIG_CMD_ABOOTIMG=y # CONFIG_CMD_ELF is not set CONFIG_CMD_ASKENV=y CONFIG_CMD_GREPENV=y +CONFIG_CMD_ERASEENV=y CONFIG_CMD_ENV_CALLBACK=y CONFIG_CMD_ENV_FLAGS=y CONFIG_CMD_NVEDIT_EFI=y
configs/sandbox_flattree_defconfig +1 -0
@@ -24,6 +24,7 @@ CONFIG_CMD_BOOTEFI_HELLO=y # CONFIG_CMD_ELF is not set CONFIG_CMD_ASKENV=y CONFIG_CMD_GREPENV=y +CONFIG_CMD_ERASEENV=y CONFIG_CMD_NVEDIT_INFO=y CONFIG_CMD_NVEDIT_LOAD=y CONFIG_CMD_NVEDIT_SELECT=y
configs/sandbox_spl_defconfig +1 -0
@@ -32,6 +32,7 @@ CONFIG_CMD_BOOTEFI_HELLO=y # CONFIG_CMD_ELF is not set CONFIG_CMD_ASKENV=y CONFIG_CMD_GREPENV=y +CONFIG_CMD_ERASEENV=y CONFIG_CMD_ENV_CALLBACK=y CONFIG_CMD_ENV_FLAGS=y CONFIG_CMD_NVEDIT_INFO=y
test/py/tests/test_env.py +16 -0
@@ -475,6 +475,22 @@ def test_env_ext4(state_test_env): response = c.run_command('echo $?') assert response == "0" + response = c.run_command('env erase') + assert 'OK' in response + + response = c.run_command('env load') + assert 'Loading Environment from EXT4... ' in response + assert 'bad CRC, using default environment' in response + + response = c.run_command('env info') + assert 'env_valid = invalid' in response + assert 'env_ready = true' in response + assert 'env_use_default = true' in response + + response = c.run_command('env info -p -d') + assert 'Default environment is used' in response + assert 'Environment can be persisted' in response + # restore env location: NOWHERE (prio 0 in sandbox) response = c.run_command('env select nowhere') assert 'Select Environment on nowhere: OK' in response
Signature · 1 line
2.17.1
PATCH v4 14/14 test: sandbox: add test for erase command
Quoted 3 lines · Patrick Delaunay
Add test for the erase command tested on ENV in EXT4.
Signed-off-by Patrick Delaunay <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200731/b516ca0c/attachment.sig>