All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCHv3] env: enable accessing the environment in an EXT4 partition
@ 2017-11-27 17:45 Jorge Ramirez-Ortiz
  2017-11-27 17:49 ` Tom Rini
  0 siblings, 1 reply; 5+ messages in thread
From: Jorge Ramirez-Ortiz @ 2017-11-27 17:45 UTC (permalink / raw)
  To: u-boot

the following commit enables accessing the environment in an ext4
partition. In order to do that, some definitions need to be added to
include/configs/board_x.h file.

For example to store the environment in a file named "/uboot.env" in MMC
"0", where partition "1" contains the EXT4 filesystem, you should define:

  EXT4_ENV_DEVICE_AND_PART        "0:1"
  EXT4_ENV_INTERFACE              "mmc"
  EXT4_ENV_FILE                   "/uboot.env"
---
 env/Kconfig | 7 +++++++
 env/env.c   | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/env/Kconfig b/env/Kconfig
index 2477bf8..09309ab 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -81,6 +81,13 @@ config ENV_IS_IN_FAT
 	  - CONFIG_FAT_WRITE:
 	  This must be enabled. Otherwise it cannot save the environment file.
 
+config ENV_IS_IN_EXT4
+	bool "Environment is in a EXT4 filesystem"
+	depends on !CHAIN_OF_TRUST
+	select EXT4_WRITE
+	help
+	  Define this if you want to use the EXT4 file system for the environment.
+
 config ENV_IS_IN_FLASH
 	bool "Environment in flash memory"
 	depends on !CHAIN_OF_TRUST
diff --git a/env/env.c b/env/env.c
index 76a5608..7455632 100644
--- a/env/env.c
+++ b/env/env.c
@@ -32,6 +32,8 @@ static enum env_location env_get_default_location(void)
 		return ENVL_EEPROM;
 	else if IS_ENABLED(CONFIG_ENV_IS_IN_FAT)
 		return ENVL_FAT;
+	else if IS_ENABLED(CONFIG_ENV_IS_IN_EXT4)
+		return ENVL_EXT4;
 	else if IS_ENABLED(CONFIG_ENV_IS_IN_FLASH)
 		return ENVL_FLASH;
 	else if IS_ENABLED(CONFIG_ENV_IS_IN_MMC)
-- 
2.7.4

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

* [U-Boot] [PATCHv3] env: enable accessing the environment in an EXT4 partition
  2017-11-27 17:45 [U-Boot] [PATCHv3] env: enable accessing the environment in an EXT4 partition Jorge Ramirez-Ortiz
@ 2017-11-27 17:49 ` Tom Rini
  2017-11-27 17:51   ` Jorge Ramirez
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Rini @ 2017-11-27 17:49 UTC (permalink / raw)
  To: u-boot

On Mon, Nov 27, 2017 at 06:45:35PM +0100, Jorge Ramirez-Ortiz wrote:
> the following commit enables accessing the environment in an ext4
> partition. In order to do that, some definitions need to be added to
> include/configs/board_x.h file.
> 
> For example to store the environment in a file named "/uboot.env" in MMC
> "0", where partition "1" contains the EXT4 filesystem, you should define:
> 
>   EXT4_ENV_DEVICE_AND_PART        "0:1"
>   EXT4_ENV_INTERFACE              "mmc"
>   EXT4_ENV_FILE                   "/uboot.env"

We have examples of these kind of configurations in Kconfig today,
please add them as well so the feature can be fully used, thanks!

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

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

* [U-Boot] [PATCHv3] env: enable accessing the environment in an EXT4 partition
  2017-11-27 17:49 ` Tom Rini
@ 2017-11-27 17:51   ` Jorge Ramirez
  2017-11-27 18:06     ` Jorge Ramirez
  0 siblings, 1 reply; 5+ messages in thread
From: Jorge Ramirez @ 2017-11-27 17:51 UTC (permalink / raw)
  To: u-boot

On 11/27/2017 06:49 PM, Tom Rini wrote:
> On Mon, Nov 27, 2017 at 06:45:35PM +0100, Jorge Ramirez-Ortiz wrote:
>> the following commit enables accessing the environment in an ext4
>> partition. In order to do that, some definitions need to be added to
>> include/configs/board_x.h file.
>>
>> For example to store the environment in a file named "/uboot.env" in MMC
>> "0", where partition "1" contains the EXT4 filesystem, you should define:
>>
>>    EXT4_ENV_DEVICE_AND_PART        "0:1"
>>    EXT4_ENV_INTERFACE              "mmc"
>>    EXT4_ENV_FILE                   "/uboot.env"
> We have examples of these kind of configurations in Kconfig today,
> please add them as well so the feature can be fully used, thanks!
>
oops, yeah, sorry about that. ok doing it now

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

* [U-Boot] [PATCHv3] env: enable accessing the environment in an EXT4 partition
  2017-11-27 17:51   ` Jorge Ramirez
@ 2017-11-27 18:06     ` Jorge Ramirez
  2017-11-27 18:11       ` Tom Rini
  0 siblings, 1 reply; 5+ messages in thread
From: Jorge Ramirez @ 2017-11-27 18:06 UTC (permalink / raw)
  To: u-boot

On 11/27/2017 06:51 PM, Jorge Ramirez wrote:
> On 11/27/2017 06:49 PM, Tom Rini wrote:
>> On Mon, Nov 27, 2017 at 06:45:35PM +0100, Jorge Ramirez-Ortiz wrote:
>>> the following commit enables accessing the environment in an ext4
>>> partition. In order to do that, some definitions need to be added to
>>> include/configs/board_x.h file.
>>>
>>> For example to store the environment in a file named "/uboot.env" in 
>>> MMC
>>> "0", where partition "1" contains the EXT4 filesystem, you should 
>>> define:
>>>
>>>    EXT4_ENV_DEVICE_AND_PART        "0:1"
>>>    EXT4_ENV_INTERFACE              "mmc"
>>>    EXT4_ENV_FILE                   "/uboot.env"
>> We have examples of these kind of configurations in Kconfig today,
>> please add them as well so the feature can be fully used, thanks!
>>
> oops, yeah, sorry about that. ok doing it now

just checking but you realize that I will have to modify env/ext4.c to 
use these new CONFIG_ just like we do for FAT?
for EXT4 we were using include/configs/.h instead as described in the 
commit (so the feature was fully functional, just slightly different to 
FAT when defining the variables).

ok?

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

* [U-Boot] [PATCHv3] env: enable accessing the environment in an EXT4 partition
  2017-11-27 18:06     ` Jorge Ramirez
@ 2017-11-27 18:11       ` Tom Rini
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2017-11-27 18:11 UTC (permalink / raw)
  To: u-boot

On Mon, Nov 27, 2017 at 07:06:02PM +0100, Jorge Ramirez wrote:
> On 11/27/2017 06:51 PM, Jorge Ramirez wrote:
> >On 11/27/2017 06:49 PM, Tom Rini wrote:
> >>On Mon, Nov 27, 2017 at 06:45:35PM +0100, Jorge Ramirez-Ortiz wrote:
> >>>the following commit enables accessing the environment in an ext4
> >>>partition. In order to do that, some definitions need to be added to
> >>>include/configs/board_x.h file.
> >>>
> >>>For example to store the environment in a file named "/uboot.env" in
> >>>MMC
> >>>"0", where partition "1" contains the EXT4 filesystem, you should
> >>>define:
> >>>
> >>>   EXT4_ENV_DEVICE_AND_PART        "0:1"
> >>>   EXT4_ENV_INTERFACE              "mmc"
> >>>   EXT4_ENV_FILE                   "/uboot.env"
> >>We have examples of these kind of configurations in Kconfig today,
> >>please add them as well so the feature can be fully used, thanks!
> >>
> >oops, yeah, sorry about that. ok doing it now
> 
> just checking but you realize that I will have to modify env/ext4.c to use
> these new CONFIG_ just like we do for FAT?
> for EXT4 we were using include/configs/.h instead as described in the commit
> (so the feature was fully functional, just slightly different to FAT when
> defining the variables).
> 
> ok?

Yes, we need to move them to CONFIG_xxx and have them in Kconfig.  And
we should rename them to CONFIG_ENV_EXT4_xxx while at it.  I think I had
to do this when migrating FAT env support and left EXT4 out as there
were no in-tree users at the time so it fell off my TODO list.  Thanks!

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

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

end of thread, other threads:[~2017-11-27 18:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-27 17:45 [U-Boot] [PATCHv3] env: enable accessing the environment in an EXT4 partition Jorge Ramirez-Ortiz
2017-11-27 17:49 ` Tom Rini
2017-11-27 17:51   ` Jorge Ramirez
2017-11-27 18:06     ` Jorge Ramirez
2017-11-27 18:11       ` Tom Rini

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.