All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Klotzbuecher <mk@mkio.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/6] env: ubi: support configurable VID offset
Date: Mon, 15 Apr 2019 17:32:02 +0200	[thread overview]
Message-ID: <20190415153206.3472-3-mk@mkio.de> (raw)
In-Reply-To: <20190415153206.3472-1-mk@mkio.de>

From: Hamish Guthrie <hamish.guthrie@kistler.com>

Signed-off-by: Hamish Guthrie <hamish.guthrie@kistler.com>
Signed-off-by: Markus Klotzbuecher <markus.klotzbuecher@kistler.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: Kyungmin Park <kmpark@infradead.org>
---
 env/Kconfig |  6 ++++++
 env/ubi.c   | 17 +++++++++++++----
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/env/Kconfig b/env/Kconfig
index 44c47220c2..595b658c26 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -519,6 +519,12 @@ config ENV_UBI_VOLUME_REDUND
 	help
 	  Name of the redundant volume that you want to store the environment in.
 
+config ENV_UBI_VID_OFFSET
+	int "ubi environment VID offset"
+	depends on ENV_IS_IN_UBI
+	help
+	  UBI VID offset for environment.
+
 endif
 
 config USE_DEFAULT_ENV_FILE
diff --git a/env/ubi.c b/env/ubi.c
index 1dfdf0a8c8..67379f2557 100644
--- a/env/ubi.c
+++ b/env/ubi.c
@@ -15,6 +15,15 @@
 #include <ubi_uboot.h>
 #undef crc32
 
+#define _QUOTE(x) #x
+#define QUOTE(x) _QUOTE(x)
+
+#ifdef CONFIG_ENV_UBI_VID_OFFSET
+ #define UBI_VID_OFFSET QUOTE(CONFIG_ENV_UBI_VID_OFFSET)
+#else
+ #define UBI_VID_OFFSET NULL
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_CMD_SAVEENV
@@ -28,7 +37,7 @@ static int env_ubi_save(void)
 	if (ret)
 		return ret;
 
-	if (ubi_part(CONFIG_ENV_UBI_PART, NULL)) {
+	if (ubi_part(CONFIG_ENV_UBI_PART, UBI_VID_OFFSET)) {
 		printf("\n** Cannot find mtd partition \"%s\"\n",
 		       CONFIG_ENV_UBI_PART);
 		return 1;
@@ -70,7 +79,7 @@ static int env_ubi_save(void)
 	if (ret)
 		return ret;
 
-	if (ubi_part(CONFIG_ENV_UBI_PART, NULL)) {
+	if (ubi_part(CONFIG_ENV_UBI_PART, UBI_VID_OFFSET)) {
 		printf("\n** Cannot find mtd partition \"%s\"\n",
 		       CONFIG_ENV_UBI_PART);
 		return 1;
@@ -111,7 +120,7 @@ static int env_ubi_load(void)
 	tmp_env1 = (env_t *)env1_buf;
 	tmp_env2 = (env_t *)env2_buf;
 
-	if (ubi_part(CONFIG_ENV_UBI_PART, NULL)) {
+	if (ubi_part(CONFIG_ENV_UBI_PART, UBI_VID_OFFSET)) {
 		printf("\n** Cannot find mtd partition \"%s\"\n",
 		       CONFIG_ENV_UBI_PART);
 		set_default_env(NULL, 0);
@@ -148,7 +157,7 @@ static int env_ubi_load(void)
 	 */
 	memset(buf, 0x0, CONFIG_ENV_SIZE);
 
-	if (ubi_part(CONFIG_ENV_UBI_PART, NULL)) {
+	if (ubi_part(CONFIG_ENV_UBI_PART, UBI_VID_OFFSET)) {
 		printf("\n** Cannot find mtd partition \"%s\"\n",
 		       CONFIG_ENV_UBI_PART);
 		set_default_env(NULL, 0);
-- 
2.20.1

  parent reply	other threads:[~2019-04-15 15:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-15 15:32 [U-Boot] [PATCH 0/6] miscellaneous ubispl and ubi improvements Markus Klotzbuecher
2019-04-15 15:32 ` [U-Boot] [PATCH 1/6] env: ubi: KConfig: add CONFIG_ENV_UBI_VOLUME_REDUND Markus Klotzbuecher
2019-04-30  4:54   ` Heiko Schocher
2019-05-02  7:15     ` Markus Klotzbuecher
2019-05-09  8:59     ` Markus Klotzbuecher
2019-05-09 11:17       ` Heiko Schocher
2019-05-09 15:49         ` Markus Klotzbuecher
2019-05-09 18:42           ` mk at mkio.de
2019-04-15 15:32 ` Markus Klotzbuecher [this message]
2019-04-30  4:57   ` [U-Boot] [PATCH 2/6] env: ubi: support configurable VID offset Heiko Schocher
2019-04-15 15:32 ` [U-Boot] [PATCH 3/6] ubi: fix UBI_SILENCE_MSG Markus Klotzbuecher
2019-04-30  4:59   ` Heiko Schocher
2019-04-15 15:32 ` [U-Boot] [PATCH 4/6] ubispl: migrate configuration to Kconfig Markus Klotzbuecher
2019-04-30  4:59   ` Heiko Schocher
2019-04-15 15:32 ` [U-Boot] [PATCH 5/6] ubispl: add support for loading volumes by name Markus Klotzbuecher
2019-04-30  5:15   ` Heiko Schocher
2019-04-15 15:32 ` [U-Boot] [PATCH 6/6] ubispl: introduce separate CONFIG_UBI_SPL_SILENCE_MSG Markus Klotzbuecher
2019-04-30  5:16   ` Heiko Schocher
2019-04-16  3:52 ` [U-Boot] [PATCH 0/6] miscellaneous ubispl and ubi improvements Heiko Schocher
2019-04-16  4:03   ` Heiko Schocher
2019-04-16  5:14     ` Markus Klotzbuecher
2019-04-17  6:34   ` Markus Klotzbuecher

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=20190415153206.3472-3-mk@mkio.de \
    --to=mk@mkio.de \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.