mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Christoph Fritz <chf.fritz@googlemail.com>
To: barebox@lists.infradead.org
Subject: [PATCH 2/2] ARM OMAP: add support for loading Environment from UBI
Date: Fri, 21 Jun 2013 11:55:56 +0200	[thread overview]
Message-ID: <1371808556.3949.15.camel@mars> (raw)
In-Reply-To: <1371808410.3949.13.camel@mars>

This patch adds support to load environment from a static
UBI volume.

Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
---
 common/Kconfig   |   34 ++++++++++++++++++++++++++++++++++
 common/startup.c |   17 +++++++++++++++++
 2 files changed, 51 insertions(+)

diff --git a/common/Kconfig b/common/Kconfig
index d36ed13..058eb21 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -103,6 +103,40 @@ config MEMINFO
 config ENVIRONMENT_VARIABLES
 	bool "environment variables support"
 
+config ENVIRONMENT_IN_UBI
+	bool "Load Environment from an UBI static volume"
+	depends on UBI
+	depends on ENV_HANDLING
+	help
+	  Say Y here if you would like to attach UBI and load
+	  the environment from an UBI volume.
+
+if ENVIRONMENT_IN_UBI
+
+menu "Configure Loading Environment from UBI"
+
+config ENV_IN_UBI_PARTITION
+	string
+	default "/dev/root"
+	prompt "Filepath of mtd partition holding UBI volumes"
+	help
+	  Filepath of mtd partition holding UBI static volume with Barebox
+	  environment inside.  This value depends on your board partition
+	  layout. Default string value is "/dev/root".
+
+config ENV_IN_UBI_VOLNAME
+	string
+	default "/dev/ubi0.bareboxenv_0"
+	prompt "Filepath of UBI static volume holding environment"
+	help
+	  Filepath of UBI static volume holding Barebox environment inside the
+	  partition. This string value depends on your UBI volume name
+	  configuration scheme. Default string is "/dev/ubi0.bareboxenv_0".
+
+endmenu
+
+endif
+
 menu "memory layout"
 
 source "pbl/Kconfig"
diff --git a/common/startup.c b/common/startup.c
index ff00ca7..01c0e1d 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -117,6 +117,23 @@ void __noreturn start_barebox(void)
 	if (IS_ENABLED(CONFIG_ENV_HANDLING)) {
 		int ret;
 
+		if (IS_ENABLED(CONFIG_ENVIRONMENT_IN_UBI)) {
+#ifdef CONFIG_ENVIRONMENT_IN_UBI
+			char s[PATH_MAX + 32];
+			sprintf(s, "%s%s ", "ubiattach ",
+				CONFIG_ENV_IN_UBI_PARTITION);
+			ret = run_command(s, 0);
+			if (ret) {
+				sprintf(s, "%s%s ", "unable to ubiattach ",
+					CONFIG_ENV_IN_UBI_PARTITION);
+				pr_err(s);
+			} else {
+				default_environment_path =
+					CONFIG_ENV_IN_UBI_VOLNAME;
+			}
+#endif
+		}
+
 		ret = envfs_load(default_environment_path, "/env", 0);
 
 		if (ret && IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT)) {
-- 
1.7.10.4



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

  parent reply	other threads:[~2013-06-21  9:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-21  9:53 [PATCH 0/2] OMAP: Boot " Christoph Fritz
2013-06-21  9:55 ` [PATCH 1/2] ARM OMAP: MLO: add support for loading Barebox " Christoph Fritz
2013-06-25  4:22   ` Sascha Hauer
2013-06-21  9:55 ` Christoph Fritz [this message]
2013-06-25  5:26   ` [PATCH 2/2] ARM OMAP: add support for loading Environment " 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=1371808556.3949.15.camel@mars \
    --to=chf.fritz@googlemail.com \
    --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