9
0
Fork 0

env: Make environment variable support optional

Environment variables are only useful in interactive environments.
Make it optional on our way to support a noninteractive barebox.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2011-04-01 15:06:49 +02:00
parent 64cc568eda
commit 71a4899e18
4 changed files with 20 additions and 1 deletions

View File

@ -29,11 +29,13 @@ config CMD_LOADENV
prompt "loadenv"
config CMD_EXPORT
depends on ENVIRONMENT_VARIABLES
tristate
prompt "export"
config CMD_PRINTENV
tristate
depends on ENVIRONMENT_VARIABLES
prompt "printenv"
config CMD_READLINE

View File

@ -62,6 +62,9 @@ config LOCALVERSION_AUTO
config BOARDINFO
string
config ENVIRONMENT_VARIABLES
bool "environment variables support"
menu "memory layout "
config HAVE_MMU
@ -219,12 +222,14 @@ choice
config SHELL_HUSH
bool "hush parser"
select ENVIRONMENT_VARIABLES
help
Enable hush support. This is the most advanced shell available
for barebox.
config SHELL_SIMPLE
bool "Simple parser"
select ENVIRONMENT_VARIABLES
help
simple shell. No if/then, no return values from commands, no loops
endchoice

View File

@ -15,7 +15,7 @@ obj-y += command.o
obj-$(CONFIG_CONSOLE_FULL) += console.o
obj-$(CONFIG_CONSOLE_SIMPLE) += console_simple.o
obj-$(CONFIG_DIGEST) += digest.o
obj-y += env.o
obj-$(CONFIG_ENVIRONMENT_VARIABLES) += env.o
obj-$(CONFIG_CMD_BOOTM) += image.o
obj-y += startup.o
obj-y += misc.o

View File

@ -44,8 +44,20 @@ struct env_context *get_current_context(void);
char *var_val(struct variable_d *);
char *var_name(struct variable_d *);
#ifdef CONFIG_ENVIRONMENT_VARIABLES
const char *getenv(const char *);
int setenv(const char *, const char *);
#else
static inline char *getenv(const char *var)
{
return NULL;
}
static inline int setenv(const char *var, const char *val)
{
return 0;
}
#endif
int env_pop_context(void);
int env_push_context(void);