mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/8] env: Make environment variable support optional
Date: Fri,  8 Apr 2011 16:56:12 +0200	[thread overview]
Message-ID: <1302274579-11158-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1302274579-11158-1-git-send-email-s.hauer@pengutronix.de>

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>
---
 commands/Kconfig      |    2 ++
 common/Kconfig        |    5 +++++
 common/Makefile       |    2 +-
 include/environment.h |   12 ++++++++++++
 4 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/commands/Kconfig b/commands/Kconfig
index 9d0c72d..a443501 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -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
diff --git a/common/Kconfig b/common/Kconfig
index ac83231..b493a31 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -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
diff --git a/common/Makefile b/common/Makefile
index 3fc66f4..c8a4332 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -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
diff --git a/include/environment.h b/include/environment.h
index 21a7ffa..1f22fcb 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -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);
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2011-04-08 14:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-08 14:56 Size reduction patches Sascha Hauer
2011-04-08 14:56 ` Sascha Hauer [this message]
2011-04-08 14:56 ` [PATCH 2/8] make command support optional Sascha Hauer
2011-04-08 14:56 ` [PATCH 3/8] add noshell support Sascha Hauer
2011-04-08 14:56 ` [PATCH 4/8] arm: compile icache command only when command support is present Sascha Hauer
2011-04-08 14:56 ` [PATCH 5/8] malloc: put common memory functions to seperate file Sascha Hauer
2011-04-08 14:56 ` [PATCH 6/8] add dummy_malloc functions Sascha Hauer
2011-04-08 14:56 ` [PATCH 7/8] ARM: make exception handling optional Sascha Hauer
2011-04-08 14:56 ` [PATCH 8/8] nand: make reading oob optional Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1302274579-11158-2-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox