All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] spl: saveenv: adding saveenv support in SPL
@ 2016-09-26 12:56 Ravi Babu
  2016-09-27  0:32 ` Simon Glass
  0 siblings, 1 reply; 7+ messages in thread
From: Ravi Babu @ 2016-09-26 12:56 UTC (permalink / raw)
  To: u-boot

By default saveenv option is not supported for SPL. This patch
enable the support for save environment variable for SPL build.

Enable save environment support in SPL after setenv. By default
the saveenv option is not provided in SPL, but some boards need
this support in 'Falcon' boot, where SPL need to boot from
different images based on environment variable set by OS. For
example OS may set "reboot_image" environment variable to
"recovery" inorder to boot recovery image by SPL. The SPL read
"reboot_image" and act accordingly and change the reboot_image
to default mode using setenv and save the environemnt.

Signed-off-by: Ravi Babu <ravibabu@ti.com>
---
 common/spl/Kconfig        | 13 +++++++++++++
 drivers/mmc/Makefile      |  1 +
 drivers/mmc/mmc_private.h |  3 +--
 lib/Makefile              |  1 +
 lib/hashtable.c           |  2 +-
 5 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 2a8ddbc..0daa835 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -163,6 +163,19 @@ config SPL_ENV_SUPPORT
 	  starting U-Boot first. Enabling this option will make getenv()
 	  and setenv() available in SPL.
 
+config SPL_SAVEENV_SUPPORT
+	bool "Support save environment"
+	depends on SPL && SPL_ENV_SUPPORT
+	help
+	  Enable save environment support in SPL after setenv. By default
+	  the saveenv option is not provided in SPL, but some boards need
+	  this support in 'Falcon' boot, where SPL need to boot from
+	  different images based on environment variable set by OS. For
+	  example OS may set "reboot_image" environment variable to
+	  "recovery" inorder to boot recovery image by SPL. The SPL read
+	  "reboot_image" and act accordingly and change the reboot_image
+	  to default mode using setenv and save the environemnt.
+
 config SPL_ETH_SUPPORT
 	bool "Support Ethernet"
 	depends on SPL_ENV_SUPPORT
diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
index 18351fb..cedce0a 100644
--- a/drivers/mmc/Makefile
+++ b/drivers/mmc/Makefile
@@ -60,6 +60,7 @@ obj-$(CONFIG_ROCKCHIP_SDHCI) += rockchip_sdhci.o
 
 ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_SPL_MMC_BOOT) += fsl_esdhc_spl.o
+obj-$(CONFIG_SPL_SAVEENV_SUPPORT) += mmc_write.o
 else
 obj-$(CONFIG_GENERIC_MMC) += mmc_write.o
 endif
diff --git a/drivers/mmc/mmc_private.h b/drivers/mmc/mmc_private.h
index 49ec022..1a881ad 100644
--- a/drivers/mmc/mmc_private.h
+++ b/drivers/mmc/mmc_private.h
@@ -28,8 +28,7 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
 		void *dst);
 #endif
 
-#ifndef CONFIG_SPL_BUILD
-
+#if !(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_SAVEENV_SUPPORT))
 unsigned long mmc_berase(struct blk_desc *block_dev, lbaint_t start,
 			 lbaint_t blkcnt);
 
diff --git a/lib/Makefile b/lib/Makefile
index c81bfeb..1590704 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -47,6 +47,7 @@ obj-$(CONFIG_$(SPL_)RSA) += rsa/
 obj-$(CONFIG_$(SPL_)SHA1) += sha1.o
 obj-$(CONFIG_$(SPL_)SHA256) += sha256.o
 
+obj-$(CONFIG_SPL_SAVEENV_SUPPORT) += qsort.o
 obj-$(CONFIG_$(SPL_)OF_LIBFDT) += libfdt/
 ifneq ($(CONFIG_SPL_BUILD)$(CONFIG_SPL_OF_PLATDATA),yy)
 obj-$(CONFIG_$(SPL_)OF_CONTROL) += fdtdec_common.o
diff --git a/lib/hashtable.c b/lib/hashtable.c
index 4e52b36..bdb54ca 100644
--- a/lib/hashtable.c
+++ b/lib/hashtable.c
@@ -477,11 +477,11 @@ int hdelete_r(const char *key, struct hsearch_data *htab, int flag)
 	return 1;
 }
 
+#if !(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_SAVEENV_SUPPORT))
 /*
  * hexport()
  */
 
-#ifndef CONFIG_SPL_BUILD
 /*
  * Export the data stored in the hash table in linearized form.
  *
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] spl: saveenv: adding saveenv support in SPL
  2016-09-26 12:56 [U-Boot] [PATCH] spl: saveenv: adding saveenv support in SPL Ravi Babu
@ 2016-09-27  0:32 ` Simon Glass
  2016-09-27  6:20   ` B, Ravi
  0 siblings, 1 reply; 7+ messages in thread
From: Simon Glass @ 2016-09-27  0:32 UTC (permalink / raw)
  To: u-boot

Hi Ravi,

On 26 September 2016 at 06:56, Ravi Babu <ravibabu@ti.com> wrote:
> By default saveenv option is not supported for SPL. This patch
> enable the support for save environment variable for SPL build.
>
> Enable save environment support in SPL after setenv. By default
> the saveenv option is not provided in SPL, but some boards need
> this support in 'Falcon' boot, where SPL need to boot from
> different images based on environment variable set by OS. For
> example OS may set "reboot_image" environment variable to
> "recovery" inorder to boot recovery image by SPL. The SPL read
> "reboot_image" and act accordingly and change the reboot_image
> to default mode using setenv and save the environemnt.
>
> Signed-off-by: Ravi Babu <ravibabu@ti.com>
> ---
>  common/spl/Kconfig        | 13 +++++++++++++
>  drivers/mmc/Makefile      |  1 +
>  drivers/mmc/mmc_private.h |  3 +--
>  lib/Makefile              |  1 +
>  lib/hashtable.c           |  2 +-
>  5 files changed, 17 insertions(+), 3 deletions(-)
>
> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> index 2a8ddbc..0daa835 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -163,6 +163,19 @@ config SPL_ENV_SUPPORT
>           starting U-Boot first. Enabling this option will make getenv()
>           and setenv() available in SPL.
>
> +config SPL_SAVEENV_SUPPORT
> +       bool "Support save environment"
> +       depends on SPL && SPL_ENV_SUPPORT
> +       help
> +         Enable save environment support in SPL after setenv. By default
> +         the saveenv option is not provided in SPL, but some boards need
> +         this support in 'Falcon' boot, where SPL need to boot from
> +         different images based on environment variable set by OS. For
> +         example OS may set "reboot_image" environment variable to
> +         "recovery" inorder to boot recovery image by SPL. The SPL read
> +         "reboot_image" and act accordingly and change the reboot_image
> +         to default mode using setenv and save the environemnt.
> +

Reviewed-by: Simon Glass <sjg@chromium.org>

But I wonder if we could use SPL_SAVEENV, and drop the SUPPORT? For
U-Boot proper we use CONFIG_CMD_SAVEENV which is inconsistent - I
think we should really have a CONFIG_SAVEENV separate from the
command.

Regards,
Simon

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] spl: saveenv: adding saveenv support in SPL
  2016-09-27  0:32 ` Simon Glass
@ 2016-09-27  6:20   ` B, Ravi
  0 siblings, 0 replies; 7+ messages in thread
From: B, Ravi @ 2016-09-27  6:20 UTC (permalink / raw)
  To: u-boot

Hi Simon

>On 26 September 2016 at 06:56, Ravi Babu <ravibabu@ti.com> wrote:
>> By default saveenv option is not supported for SPL. This patch enable 
>> the support for save environment variable for SPL build.
>>
>> Enable save environment support in SPL after setenv. By default the 
>> saveenv option is not provided in SPL, but some boards need this 
>> support in 'Falcon' boot, where SPL need to boot from different images 
>> based on environment variable set by OS. For example OS may set 
>> "reboot_image" environment variable to "recovery" inorder to boot 
>> recovery image by SPL. The SPL read "reboot_image" and act accordingly 
>> and change the reboot_image to default mode using setenv and save the 
>> environemnt.
>>
>> Signed-off-by: Ravi Babu <ravibabu@ti.com>
>> ---
>>  common/spl/Kconfig        | 13 +++++++++++++
>>  drivers/mmc/Makefile      |  1 +
>>  drivers/mmc/mmc_private.h |  3 +--
>>  lib/Makefile              |  1 +
>>  lib/hashtable.c           |  2 +-
>>  5 files changed, 17 insertions(+), 3 deletions(-)
>>
>> diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 
>> 2a8ddbc..0daa835 100644
>> --- a/common/spl/Kconfig
>> +++ b/common/spl/Kconfig
>> @@ -163,6 +163,19 @@ config SPL_ENV_SUPPORT
>>           starting U-Boot first. Enabling this option will make getenv()
>>           and setenv() available in SPL.
>>
>> +config SPL_SAVEENV_SUPPORT
>> +       bool "Support save environment"
>> +       depends on SPL && SPL_ENV_SUPPORT
>> +       help
>> +         Enable save environment support in SPL after setenv. By default
>> +         the saveenv option is not provided in SPL, but some boards need
>> +         this support in 'Falcon' boot, where SPL need to boot from
>> +         different images based on environment variable set by OS. For
>> +         example OS may set "reboot_image" environment variable to
>> +         "recovery" inorder to boot recovery image by SPL. The SPL read
>> +         "reboot_image" and act accordingly and change the reboot_image
>> +         to default mode using setenv and save the environemnt.
>> +

>Reviewed-by: Simon Glass <sjg@chromium.org>

>But I wonder if we could use SPL_SAVEENV, and drop the SUPPORT? 

Ok,  will drop SUPPORT and use SPL_SAVEENV.

> For U-Boot proper we use CONFIG_CMD_SAVEENV which is inconsistent - I think we should really have a CONFIG_SAVEENV separate from the command.
I agree. 

Thanks.

Regards
Ravi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] spl: saveenv: adding saveenv support in SPL
  2016-09-28  9:13 Ravi Babu
@ 2016-09-28  9:16 ` B, Ravi
  0 siblings, 0 replies; 7+ messages in thread
From: B, Ravi @ 2016-09-28  9:16 UTC (permalink / raw)
  To: u-boot

Drop this send wrong version....

Regards
Ravi

-----Original Message-----
From: B, Ravi 
Sent: Wednesday, September 28, 2016 2:43 PM
To: u-boot at lists.denx.de
Cc: trini at konsulko.com; sjg at chromium.org; jh80.chung at samsung.com; Vutla, Lokesh; B, Ravi
Subject: [PATCH] spl: saveenv: adding saveenv support in SPL

By default saveenv option is not supported for SPL. This patch enable the support for save environment variable for SPL build.

Enable save environment support in SPL after setenv. By default the saveenv option is not provided in SPL, but some boards need this support in 'Falcon' boot, where SPL need to boot from different images based on environment variable set by OS. For example OS may set "reboot_image" environment variable to "recovery" inorder to boot recovery image by SPL. The SPL read "reboot_image" and act accordingly and change the reboot_image to default mode using setenv and save the environemnt.

Signed-off-by: Ravi Babu <ravibabu@ti.com>
Reviewed-by: Simon Glass <sig@chromium.org>
---
 common/spl/Kconfig        | 13 +++++++++++++
 drivers/mmc/Makefile      |  1 +
 drivers/mmc/mmc_private.h |  3 +--
 lib/Makefile              |  1 +
 lib/hashtable.c           |  2 +-
 5 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 2a8ddbc..605cf66 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -163,6 +163,19 @@ config SPL_ENV_SUPPORT
 	  starting U-Boot first. Enabling this option will make getenv()
 	  and setenv() available in SPL.
 
+config SPL_SAVEENV
+	bool "Support save environment"
+	depends on SPL && SPL_ENV_SUPPORT
+	help
+	  Enable save environment support in SPL after setenv. By default
+	  the saveenv option is not provided in SPL, but some boards need
+	  this support in 'Falcon' boot, where SPL need to boot from
+	  different images based on environment variable set by OS. For
+	  example OS may set "reboot_image" environment variable to
+	  "recovery" inorder to boot recovery image by SPL. The SPL read
+	  "reboot_image" and act accordingly and change the reboot_image
+	  to default mode using setenv and save the environemnt.
+
 config SPL_ETH_SUPPORT
 	bool "Support Ethernet"
 	depends on SPL_ENV_SUPPORT
diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile index 18351fb..d850758 100644
--- a/drivers/mmc/Makefile
+++ b/drivers/mmc/Makefile
@@ -60,6 +60,7 @@ obj-$(CONFIG_ROCKCHIP_SDHCI) += rockchip_sdhci.o
 
 ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_SPL_MMC_BOOT) += fsl_esdhc_spl.o
+obj-$(CONFIG_SPL_SAVEENV) += mmc_write.o
 else
 obj-$(CONFIG_GENERIC_MMC) += mmc_write.o  endif diff --git a/drivers/mmc/mmc_private.h b/drivers/mmc/mmc_private.h index 49ec022..e0c9849 100644
--- a/drivers/mmc/mmc_private.h
+++ b/drivers/mmc/mmc_private.h
@@ -28,8 +28,7 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
 		void *dst);
 #endif
 
-#ifndef CONFIG_SPL_BUILD
-
+#if !(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_SAVEENV))
 unsigned long mmc_berase(struct blk_desc *block_dev, lbaint_t start,
 			 lbaint_t blkcnt);
 
diff --git a/lib/Makefile b/lib/Makefile index c81bfeb..e3383f4 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -47,6 +47,7 @@ obj-$(CONFIG_$(SPL_)RSA) += rsa/
 obj-$(CONFIG_$(SPL_)SHA1) += sha1.o
 obj-$(CONFIG_$(SPL_)SHA256) += sha256.o
 
+obj-$(CONFIG_SPL_SAVEENV) += qsort.o
 obj-$(CONFIG_$(SPL_)OF_LIBFDT) += libfdt/  ifneq ($(CONFIG_SPL_BUILD)$(CONFIG_SPL_OF_PLATDATA),yy)
 obj-$(CONFIG_$(SPL_)OF_CONTROL) += fdtdec_common.o diff --git a/lib/hashtable.c b/lib/hashtable.c index 4e52b36..07c437c 100644
--- a/lib/hashtable.c
+++ b/lib/hashtable.c
@@ -477,11 +477,11 @@ int hdelete_r(const char *key, struct hsearch_data *htab, int flag)
 	return 1;
 }
 
+#if !(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_SAVEENV))
 /*
  * hexport()
  */
 
-#ifndef CONFIG_SPL_BUILD
 /*
  * Export the data stored in the hash table in linearized form.
  *
--
1.9.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] spl: saveenv: adding saveenv support in SPL
@ 2016-09-28  9:13 Ravi Babu
  2016-09-28  9:16 ` B, Ravi
  0 siblings, 1 reply; 7+ messages in thread
From: Ravi Babu @ 2016-09-28  9:13 UTC (permalink / raw)
  To: u-boot

By default saveenv option is not supported for SPL. This patch
enable the support for save environment variable for SPL build.

Enable save environment support in SPL after setenv. By default
the saveenv option is not provided in SPL, but some boards need
this support in 'Falcon' boot, where SPL need to boot from
different images based on environment variable set by OS. For
example OS may set "reboot_image" environment variable to
"recovery" inorder to boot recovery image by SPL. The SPL read
"reboot_image" and act accordingly and change the reboot_image
to default mode using setenv and save the environemnt.

Signed-off-by: Ravi Babu <ravibabu@ti.com>
Reviewed-by: Simon Glass <sig@chromium.org>
---
 common/spl/Kconfig        | 13 +++++++++++++
 drivers/mmc/Makefile      |  1 +
 drivers/mmc/mmc_private.h |  3 +--
 lib/Makefile              |  1 +
 lib/hashtable.c           |  2 +-
 5 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 2a8ddbc..605cf66 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -163,6 +163,19 @@ config SPL_ENV_SUPPORT
 	  starting U-Boot first. Enabling this option will make getenv()
 	  and setenv() available in SPL.
 
+config SPL_SAVEENV
+	bool "Support save environment"
+	depends on SPL && SPL_ENV_SUPPORT
+	help
+	  Enable save environment support in SPL after setenv. By default
+	  the saveenv option is not provided in SPL, but some boards need
+	  this support in 'Falcon' boot, where SPL need to boot from
+	  different images based on environment variable set by OS. For
+	  example OS may set "reboot_image" environment variable to
+	  "recovery" inorder to boot recovery image by SPL. The SPL read
+	  "reboot_image" and act accordingly and change the reboot_image
+	  to default mode using setenv and save the environemnt.
+
 config SPL_ETH_SUPPORT
 	bool "Support Ethernet"
 	depends on SPL_ENV_SUPPORT
diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
index 18351fb..d850758 100644
--- a/drivers/mmc/Makefile
+++ b/drivers/mmc/Makefile
@@ -60,6 +60,7 @@ obj-$(CONFIG_ROCKCHIP_SDHCI) += rockchip_sdhci.o
 
 ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_SPL_MMC_BOOT) += fsl_esdhc_spl.o
+obj-$(CONFIG_SPL_SAVEENV) += mmc_write.o
 else
 obj-$(CONFIG_GENERIC_MMC) += mmc_write.o
 endif
diff --git a/drivers/mmc/mmc_private.h b/drivers/mmc/mmc_private.h
index 49ec022..e0c9849 100644
--- a/drivers/mmc/mmc_private.h
+++ b/drivers/mmc/mmc_private.h
@@ -28,8 +28,7 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
 		void *dst);
 #endif
 
-#ifndef CONFIG_SPL_BUILD
-
+#if !(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_SAVEENV))
 unsigned long mmc_berase(struct blk_desc *block_dev, lbaint_t start,
 			 lbaint_t blkcnt);
 
diff --git a/lib/Makefile b/lib/Makefile
index c81bfeb..e3383f4 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -47,6 +47,7 @@ obj-$(CONFIG_$(SPL_)RSA) += rsa/
 obj-$(CONFIG_$(SPL_)SHA1) += sha1.o
 obj-$(CONFIG_$(SPL_)SHA256) += sha256.o
 
+obj-$(CONFIG_SPL_SAVEENV) += qsort.o
 obj-$(CONFIG_$(SPL_)OF_LIBFDT) += libfdt/
 ifneq ($(CONFIG_SPL_BUILD)$(CONFIG_SPL_OF_PLATDATA),yy)
 obj-$(CONFIG_$(SPL_)OF_CONTROL) += fdtdec_common.o
diff --git a/lib/hashtable.c b/lib/hashtable.c
index 4e52b36..07c437c 100644
--- a/lib/hashtable.c
+++ b/lib/hashtable.c
@@ -477,11 +477,11 @@ int hdelete_r(const char *key, struct hsearch_data *htab, int flag)
 	return 1;
 }
 
+#if !(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_SAVEENV))
 /*
  * hexport()
  */
 
-#ifndef CONFIG_SPL_BUILD
 /*
  * Export the data stored in the hash table in linearized form.
  *
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] spl: saveenv: adding saveenv support in SPL
  2016-09-27  6:45 Ravi Babu
@ 2016-09-27 17:29 ` Tom Rini
  0 siblings, 0 replies; 7+ messages in thread
From: Tom Rini @ 2016-09-27 17:29 UTC (permalink / raw)
  To: u-boot

On Tue, Sep 27, 2016 at 12:15:08PM +0530, Ravi Babu wrote:

> By default saveenv option is not supported for SPL. This patch
> enable the support for save environment variable for SPL build.
> 
> Enable save environment support in SPL after setenv. By default
> the saveenv option is not provided in SPL, but some boards need
> this support in 'Falcon' boot, where SPL need to boot from
> different images based on environment variable set by OS. For
> example OS may set "reboot_image" environment variable to
> "recovery" inorder to boot recovery image by SPL. The SPL read
> "reboot_image" and act accordingly and change the reboot_image
> to default mode using setenv and save the environemnt.
[snip]
> diff --git a/drivers/mmc/mmc_private.h b/drivers/mmc/mmc_private.h
> index 49ec022..e0c9849 100644
> --- a/drivers/mmc/mmc_private.h
> +++ b/drivers/mmc/mmc_private.h
> @@ -28,8 +28,7 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
>  		void *dst);
>  #endif
>  
> -#ifndef CONFIG_SPL_BUILD
> -
> +#if !(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_SAVEENV))
>  unsigned long mmc_berase(struct blk_desc *block_dev, lbaint_t start,
>  			 lbaint_t blkcnt);

The comments in this area are now wrong after this patch so please
update them as part of the patch.  Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160927/e8bf5dc4/attachment.sig>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] spl: saveenv: adding saveenv support in SPL
@ 2016-09-27  6:45 Ravi Babu
  2016-09-27 17:29 ` Tom Rini
  0 siblings, 1 reply; 7+ messages in thread
From: Ravi Babu @ 2016-09-27  6:45 UTC (permalink / raw)
  To: u-boot

By default saveenv option is not supported for SPL. This patch
enable the support for save environment variable for SPL build.

Enable save environment support in SPL after setenv. By default
the saveenv option is not provided in SPL, but some boards need
this support in 'Falcon' boot, where SPL need to boot from
different images based on environment variable set by OS. For
example OS may set "reboot_image" environment variable to
"recovery" inorder to boot recovery image by SPL. The SPL read
"reboot_image" and act accordingly and change the reboot_image
to default mode using setenv and save the environemnt.

Signed-off-by: Ravi Babu <ravibabu@ti.com>
Reviewed-by: Simon Glass <sig@chromium.org>
---
 common/spl/Kconfig        | 13 +++++++++++++
 drivers/mmc/Makefile      |  1 +
 drivers/mmc/mmc_private.h |  3 +--
 lib/Makefile              |  1 +
 lib/hashtable.c           |  2 +-
 5 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 2a8ddbc..605cf66 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -163,6 +163,19 @@ config SPL_ENV_SUPPORT
 	  starting U-Boot first. Enabling this option will make getenv()
 	  and setenv() available in SPL.
 
+config SPL_SAVEENV
+	bool "Support save environment"
+	depends on SPL && SPL_ENV_SUPPORT
+	help
+	  Enable save environment support in SPL after setenv. By default
+	  the saveenv option is not provided in SPL, but some boards need
+	  this support in 'Falcon' boot, where SPL need to boot from
+	  different images based on environment variable set by OS. For
+	  example OS may set "reboot_image" environment variable to
+	  "recovery" inorder to boot recovery image by SPL. The SPL read
+	  "reboot_image" and act accordingly and change the reboot_image
+	  to default mode using setenv and save the environemnt.
+
 config SPL_ETH_SUPPORT
 	bool "Support Ethernet"
 	depends on SPL_ENV_SUPPORT
diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
index 18351fb..d850758 100644
--- a/drivers/mmc/Makefile
+++ b/drivers/mmc/Makefile
@@ -60,6 +60,7 @@ obj-$(CONFIG_ROCKCHIP_SDHCI) += rockchip_sdhci.o
 
 ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_SPL_MMC_BOOT) += fsl_esdhc_spl.o
+obj-$(CONFIG_SPL_SAVEENV) += mmc_write.o
 else
 obj-$(CONFIG_GENERIC_MMC) += mmc_write.o
 endif
diff --git a/drivers/mmc/mmc_private.h b/drivers/mmc/mmc_private.h
index 49ec022..e0c9849 100644
--- a/drivers/mmc/mmc_private.h
+++ b/drivers/mmc/mmc_private.h
@@ -28,8 +28,7 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
 		void *dst);
 #endif
 
-#ifndef CONFIG_SPL_BUILD
-
+#if !(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_SAVEENV))
 unsigned long mmc_berase(struct blk_desc *block_dev, lbaint_t start,
 			 lbaint_t blkcnt);
 
diff --git a/lib/Makefile b/lib/Makefile
index c81bfeb..e3383f4 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -47,6 +47,7 @@ obj-$(CONFIG_$(SPL_)RSA) += rsa/
 obj-$(CONFIG_$(SPL_)SHA1) += sha1.o
 obj-$(CONFIG_$(SPL_)SHA256) += sha256.o
 
+obj-$(CONFIG_SPL_SAVEENV) += qsort.o
 obj-$(CONFIG_$(SPL_)OF_LIBFDT) += libfdt/
 ifneq ($(CONFIG_SPL_BUILD)$(CONFIG_SPL_OF_PLATDATA),yy)
 obj-$(CONFIG_$(SPL_)OF_CONTROL) += fdtdec_common.o
diff --git a/lib/hashtable.c b/lib/hashtable.c
index 4e52b36..07c437c 100644
--- a/lib/hashtable.c
+++ b/lib/hashtable.c
@@ -477,11 +477,11 @@ int hdelete_r(const char *key, struct hsearch_data *htab, int flag)
 	return 1;
 }
 
+#if !(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_SAVEENV))
 /*
  * hexport()
  */
 
-#ifndef CONFIG_SPL_BUILD
 /*
  * Export the data stored in the hash table in linearized form.
  *
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-09-28  9:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-26 12:56 [U-Boot] [PATCH] spl: saveenv: adding saveenv support in SPL Ravi Babu
2016-09-27  0:32 ` Simon Glass
2016-09-27  6:20   ` B, Ravi
2016-09-27  6:45 Ravi Babu
2016-09-27 17:29 ` Tom Rini
2016-09-28  9:13 Ravi Babu
2016-09-28  9:16 ` B, Ravi

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.