mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-25 14:56:03 +00:00
cmd: nvedit: remove error check, handle with Kconfig
Avoid error messages when SPL,TPL,VPL build don't have the environment options of the main build. This is needed when defined(CONFIG_ENV_IS_IN_xxx) is changed to CONFIG_IS_ENABLED(ENV_IS_IN_xxx). Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
This commit is contained in:
parent
11910550b6
commit
289aa6a371
2 changed files with 15 additions and 34 deletions
32
cmd/nvedit.c
32
cmd/nvedit.c
|
@ -43,28 +43,6 @@
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
#if defined(CONFIG_ENV_IS_IN_EEPROM) || \
|
|
||||||
defined(CONFIG_ENV_IS_IN_FLASH) || \
|
|
||||||
defined(CONFIG_ENV_IS_IN_MMC) || \
|
|
||||||
defined(CONFIG_ENV_IS_IN_FAT) || \
|
|
||||||
defined(CONFIG_ENV_IS_IN_EXT4) || \
|
|
||||||
defined(CONFIG_ENV_IS_IN_NAND) || \
|
|
||||||
defined(CONFIG_ENV_IS_IN_NVRAM) || \
|
|
||||||
defined(CONFIG_ENV_IS_IN_ONENAND) || \
|
|
||||||
defined(CONFIG_ENV_IS_IN_SPI_FLASH) || \
|
|
||||||
defined(CONFIG_ENV_IS_IN_REMOTE) || \
|
|
||||||
defined(CONFIG_ENV_IS_IN_UBI)
|
|
||||||
|
|
||||||
#define ENV_IS_IN_DEVICE
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(ENV_IS_IN_DEVICE) && \
|
|
||||||
!defined(CONFIG_ENV_IS_NOWHERE)
|
|
||||||
# error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|MMC|FAT|EXT4|\
|
|
||||||
NAND|NVRAM|ONENAND|SATA|SPI_FLASH|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Maximum expected input data size for import command
|
* Maximum expected input data size for import command
|
||||||
*/
|
*/
|
||||||
|
@ -596,7 +574,7 @@ static int do_env_edit(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_CMD_EDITENV */
|
#endif /* CONFIG_CMD_EDITENV */
|
||||||
|
|
||||||
#if defined(CONFIG_CMD_SAVEENV) && defined(ENV_IS_IN_DEVICE)
|
#if defined(CONFIG_CMD_SAVEENV) && !IS_ENABLED(CONFIG_ENV_IS_DEFAULT)
|
||||||
static int do_env_save(struct cmd_tbl *cmdtp, int flag, int argc,
|
static int do_env_save(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||||
char *const argv[])
|
char *const argv[])
|
||||||
{
|
{
|
||||||
|
@ -1105,7 +1083,7 @@ static int do_env_info(struct cmd_tbl *cmdtp, int flag,
|
||||||
int eval_flags = 0;
|
int eval_flags = 0;
|
||||||
int eval_results = 0;
|
int eval_results = 0;
|
||||||
bool quiet = false;
|
bool quiet = false;
|
||||||
#if defined(CONFIG_CMD_SAVEENV) && defined(ENV_IS_IN_DEVICE)
|
#if defined(CONFIG_CMD_SAVEENV) && !IS_ENABLED(CONFIG_ENV_IS_DEFAULT)
|
||||||
enum env_location loc;
|
enum env_location loc;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1148,7 +1126,7 @@ static int do_env_info(struct cmd_tbl *cmdtp, int flag,
|
||||||
|
|
||||||
/* evaluate whether environment can be persisted */
|
/* evaluate whether environment can be persisted */
|
||||||
if (eval_flags & ENV_INFO_IS_PERSISTED) {
|
if (eval_flags & ENV_INFO_IS_PERSISTED) {
|
||||||
#if defined(CONFIG_CMD_SAVEENV) && defined(ENV_IS_IN_DEVICE)
|
#if defined(CONFIG_CMD_SAVEENV) && !IS_ENABLED(CONFIG_ENV_IS_DEFAULT)
|
||||||
loc = env_get_location(ENVOP_SAVE, gd->env_load_prio);
|
loc = env_get_location(ENVOP_SAVE, gd->env_load_prio);
|
||||||
if (ENVL_NOWHERE != loc && ENVL_UNKNOWN != loc) {
|
if (ENVL_NOWHERE != loc && ENVL_UNKNOWN != loc) {
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
|
@ -1229,7 +1207,7 @@ static struct cmd_tbl cmd_env_sub[] = {
|
||||||
#if defined(CONFIG_CMD_RUN)
|
#if defined(CONFIG_CMD_RUN)
|
||||||
U_BOOT_CMD_MKENT(run, CONFIG_SYS_MAXARGS, 1, do_run, "", ""),
|
U_BOOT_CMD_MKENT(run, CONFIG_SYS_MAXARGS, 1, do_run, "", ""),
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_CMD_SAVEENV) && defined(ENV_IS_IN_DEVICE)
|
#if defined(CONFIG_CMD_SAVEENV) && !IS_ENABLED(CONFIG_ENV_IS_DEFAULT)
|
||||||
U_BOOT_CMD_MKENT(save, 1, 0, do_env_save, "", ""),
|
U_BOOT_CMD_MKENT(save, 1, 0, do_env_save, "", ""),
|
||||||
#if defined(CONFIG_CMD_ERASEENV)
|
#if defined(CONFIG_CMD_ERASEENV)
|
||||||
U_BOOT_CMD_MKENT(erase, 1, 0, do_env_erase, "", ""),
|
U_BOOT_CMD_MKENT(erase, 1, 0, do_env_erase, "", ""),
|
||||||
|
@ -1320,7 +1298,7 @@ static char env_help_text[] =
|
||||||
#if defined(CONFIG_CMD_RUN)
|
#if defined(CONFIG_CMD_RUN)
|
||||||
"env run var [...] - run commands in an environment variable\n"
|
"env run var [...] - run commands in an environment variable\n"
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_CMD_SAVEENV) && defined(ENV_IS_IN_DEVICE)
|
#if defined(CONFIG_CMD_SAVEENV) && !IS_ENABLED(CONFIG_ENV_IS_DEFAULT)
|
||||||
"env save - save environment\n"
|
"env save - save environment\n"
|
||||||
#if defined(CONFIG_CMD_ERASEENV)
|
#if defined(CONFIG_CMD_ERASEENV)
|
||||||
"env erase - erase environment\n"
|
"env erase - erase environment\n"
|
||||||
|
|
17
env/Kconfig
vendored
17
env/Kconfig
vendored
|
@ -55,20 +55,23 @@ config ENV_MAX_ENTRIES
|
||||||
be generous and should work in most cases. This setting can be used
|
be generous and should work in most cases. This setting can be used
|
||||||
to tune behaviour; see lib/hashtable.c for details.
|
to tune behaviour; see lib/hashtable.c for details.
|
||||||
|
|
||||||
config ENV_IS_NOWHERE
|
config ENV_IS_DEFAULT
|
||||||
bool "Environment is not stored"
|
def_bool y if !ENV_IS_IN_EEPROM && !ENV_IS_IN_EXT4 && \
|
||||||
default y if !ENV_IS_IN_EEPROM && !ENV_IS_IN_EXT4 && \
|
|
||||||
!ENV_IS_IN_FAT && !ENV_IS_IN_FLASH && \
|
!ENV_IS_IN_FAT && !ENV_IS_IN_FLASH && \
|
||||||
!ENV_IS_IN_MMC && !ENV_IS_IN_NAND && \
|
!ENV_IS_IN_MMC && !ENV_IS_IN_NAND && \
|
||||||
!ENV_IS_IN_NVRAM && !ENV_IS_IN_ONENAND && \
|
!ENV_IS_IN_NVRAM && !ENV_IS_IN_ONENAND && \
|
||||||
!ENV_IS_IN_REMOTE && !ENV_IS_IN_SPI_FLASH && \
|
!ENV_IS_IN_REMOTE && !ENV_IS_IN_SPI_FLASH && \
|
||||||
!ENV_IS_IN_UBI
|
!ENV_IS_IN_UBI
|
||||||
|
select ENV_IS_NOWHERE
|
||||||
|
|
||||||
|
config ENV_IS_NOWHERE
|
||||||
|
bool "Environment is not stored"
|
||||||
help
|
help
|
||||||
Define this if you don't want to or can't have an environment stored
|
Define this if you don't care whether or not an environment is stored
|
||||||
on a storage medium. In this case the environment will still exist
|
on a storage medium. In this case the environment will still exist
|
||||||
while U-Boot is running, but once U-Boot exits it will not be
|
while U-Boot is running, but once U-Boot exits it may not be
|
||||||
stored. U-Boot will therefore always start up with a default
|
stored. If no other ENV_IS_IN_ is defined, U-Boot will always start
|
||||||
environment.
|
up with the default environment.
|
||||||
|
|
||||||
config ENV_IS_IN_EEPROM
|
config ENV_IS_IN_EEPROM
|
||||||
bool "Environment in EEPROM"
|
bool "Environment in EEPROM"
|
||||||
|
|
Loading…
Add table
Reference in a new issue