public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Patrice Chotard <patrice.chotard@st.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 07/14] env: enable saveenv command when one CONFIG_ENV_IS_IN is activated
Date: Fri, 10 May 2019 18:11:24 +0200	[thread overview]
Message-ID: <1557504691-26188-8-git-send-email-patrice.chotard@st.com> (raw)
In-Reply-To: <1557504691-26188-1-git-send-email-patrice.chotard@st.com>

From: Patrick Delaunay <patrick.delaunay@st.com>

Introduce ENV_IS_IN_DEVICE to test if one the
CONFIG_ENV_IS_IN_ is defined and support the command
saveenv even if CONFIG_ENV_IS_NOWHERE is activated

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
---

 cmd/nvedit.c | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index 24a6cf7..5d723ac 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -39,18 +39,24 @@
 
 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_SATA)		&& \
-	!defined(CONFIG_ENV_IS_IN_SPI_FLASH)	&& \
-	!defined(CONFIG_ENV_IS_IN_REMOTE)	&& \
-	!defined(CONFIG_ENV_IS_IN_UBI)		&& \
+#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_SATA)		|| \
+	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
@@ -749,7 +755,7 @@ ulong env_get_ulong(const char *name, int base, ulong default_val)
 }
 
 #ifndef CONFIG_SPL_BUILD
-#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
+#if defined(CONFIG_CMD_SAVEENV) && defined(ENV_IS_IN_DEVICE)
 static int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc,
 		       char * const argv[])
 {
@@ -1205,7 +1211,7 @@ static cmd_tbl_t cmd_env_sub[] = {
 #if defined(CONFIG_CMD_RUN)
 	U_BOOT_CMD_MKENT(run, CONFIG_SYS_MAXARGS, 1, do_run, "", ""),
 #endif
-#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
+#if defined(CONFIG_CMD_SAVEENV) && defined(ENV_IS_IN_DEVICE)
 	U_BOOT_CMD_MKENT(save, 1, 0, do_env_save, "", ""),
 #endif
 	U_BOOT_CMD_MKENT(set, CONFIG_SYS_MAXARGS, 0, do_env_set, "", ""),
@@ -1280,7 +1286,7 @@ static char env_help_text[] =
 #if defined(CONFIG_CMD_RUN)
 	"env run var [...] - run commands in an environment variable\n"
 #endif
-#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
+#if defined(CONFIG_CMD_SAVEENV) && defined(ENV_IS_IN_DEVICE)
 	"env save - save environment\n"
 #endif
 #if defined(CONFIG_CMD_NVEDIT_EFI)
-- 
1.9.1

  parent reply	other threads:[~2019-05-10 16:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-10 16:11 [U-Boot] [PATCH 00/14] Add saveenv support for STM32MP1 Patrice Chotard
2019-05-10 16:11 ` [U-Boot] [PATCH 01/14] Prepare v2019.07-rc1 Patrice Chotard
2019-05-10 16:11 ` [U-Boot] [PATCH 02/14] stm32mp1: activate NAND and NOR support on EV1 Patrice Chotard
2019-05-10 16:11 ` [U-Boot] [PATCH 03/14] stm32mp1: support dynamic MTDPARTS Patrice Chotard
2019-05-10 16:11 ` [U-Boot] [PATCH 04/14] env: ext4: Allow overriding interface, device and partition Patrice Chotard
2019-05-10 16:11 ` [U-Boot] [PATCH 05/14] board: stm32mp1: Add env_ext4_get_dev_part() and env_ext4_get_intf() Patrice Chotard
2019-05-10 16:11 ` [U-Boot] [PATCH 06/14] env: allow ENV_IS_NOWHERE with other storage target Patrice Chotard
2019-05-10 16:11 ` Patrice Chotard [this message]
2019-05-10 16:11 ` [U-Boot] [PATCH 08/14] configs: stm32mp15: Enable ENV_IS_IN_EXT4 and all relative flags Patrice Chotard
2019-05-10 16:11 ` [U-Boot] [PATCH 09/14] stm32mp1: Add env_get_location() Patrice Chotard
2019-05-10 16:11 ` [U-Boot] [PATCH 10/14] mtd: Fix get_mtdparts() Patrice Chotard
2019-05-10 16:11 ` [U-Boot] [PATCH 11/14] stm32mp1: Move ENV_SIZE to Kconfig Patrice Chotard
2019-05-10 16:11 ` [U-Boot] [PATCH 12/14] configs: stm32mp15: Enable ENV_IS_IN_UBI Patrice Chotard
2019-05-10 16:11 ` [U-Boot] [PATCH 13/14] configs: stm32mp15: Enable ENV_IS_SPI_FLASH Patrice Chotard
2019-05-10 16:11 ` [U-Boot] [PATCH 14/14] stm32mp1: Update env_get_location for NOR support Patrice Chotard
2019-05-10 16:18 ` [U-Boot] [PATCH 00/14] Add saveenv support for STM32MP1 Patrice CHOTARD

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=1557504691-26188-8-git-send-email-patrice.chotard@st.com \
    --to=patrice.chotard@st.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox