Skip to contentSkip to conversation

uboot: add support for a uEnv.txt file

PATCH New Ryan Barnett 4 participants 6 messages Sep 12, 2013 – Sep 13, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uboot: add support for a uEnv.txt file

Some boards in u-boot support the ability to modify the environment by placing a plain text file as uEnv.txt in the root of the partition of an SD card. For the extact placement of where the uEnv.txt should be, consult your u-boot environment. Your board supports this overwriting of environment variables if "loadbootenv" and "importbootenv" are defined in the board's environment.

Add support for specifying a plain text file under Bootloaders > U-Boot > uEnv.txt that will be copied to the the BINARIES_DIR as uEnv.txt.

---
 boot/uboot/Config.in |   11 +++++++++++
 boot/uboot/uboot.mk  |    8 ++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
boot/uboot/Config.in +11 -0
index 1b98339..d9d788c 100644
@@ -241,4 +241,15 @@ config BR2_TARGET_UBOOT_ENVIMAGE_SIZE
 
 endif # BR2_TARGET_UBOOT_ENVIMAGE
 
+config BR2_TARGET_UBOOT_ENV_TXT_FILE
+	string "uEnv.txt file"
+	help
+	  If your board supports the ability to modify the environment
+	  with a plain text file named uEnv.txt, specify a plain text
+	  file that will be copied to the BINARIES_DIR as uEnv.txt.
+	  Information about the format for this text file can be found
+	  on TI's wiki under
+	  "Setting U-Boot environment using uEnv.txt":
+	  http://processors.wiki.ti.com/index.php/AM335x_U-Boot_User's_Guide
+
 endif # BR2_TARGET_UBOOT
boot/uboot/uboot.mk +8 -0
index 631da6b..68c055b 100644
@@ -150,6 +150,14 @@ endif
 UBOOT_DEPENDENCIES += host-uboot-tools
 endif
 
+UBOOT_ENV_TXT_FILE=$(call qstrip,$(BR2_TARGET_UBOOT_ENV_TXT_FILE))
+ifneq ($(UBOOT_ENV_TXT_FILE),)
+define UBOOT_INSTALL_UENV_TXT_FILE
+	cp -dpf $(UBOOT_ENV_TXT_FILE) $(BINARIES_DIR)/uEnv.txt
+endef
+UBOOT_POST_INSTALL_IMAGES_HOOKS += UBOOT_INSTALL_UENV_TXT_FILE
+endif
+
 $(eval $(generic-package))
 
 ifeq ($(BR2_TARGET_UBOOT),y)
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 uboot: add support for a uEnv.txt file

Quoted 4 lines · Ryan Barnett

Some boards in u-boot support the ability to modify the environment by placing a plain text file as uEnv.txt in the root of the partition of an SD card. For the extact placement of where the uEnv.txt should

Spelling ... /extact/exact/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130912/a2e90c04/attachment.html>

#2 lore raw

PATCH 1/1 uboot: add support for a uEnv.txt file

In reply to Ryan Barnett

Dear Ryan Barnett,

Quoted 6 lines · Ryan Barnett

Some boards in u-boot support the ability to modify the environment by placing a plain text file as uEnv.txt in the root of the partition of an SD card. For the extact placement of where the uEnv.txt should be, consult your u-boot environment. Your board supports this overwriting of environment variables if "loadbootenv" and "importbootenv" are defined in the board's environment.

loadbootenv and importbootenv are just U-Boot scripts that are specific to certain board configurations.

All what loadbootenv does it load a file into memory, and all what importbootenv does is call 'env import -t <addr> <size>' to load the environment into U-Boot.

So I don't think we should be mentioning loadbootenv and importbootenv here.

However, what I'm really wondering if is we really need this. After all, this is all about copying a text file to $(BINARIES_DIR), something a post-build or a post-image script can do perfectly fine. I mean, there's nothing U-Boot specific involved here, it's just a plain 'cp'. Therefore, I'm not sure we need this at all, but I am open to discussion on this.

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#3 lore raw

PATCH 1/1 uboot: add support for a uEnv.txt file

Thomas,

Thomas Petazzoni <[email protected]> wrote on 09/13/2013 02:01:34 AM:

Quoted 14 lines

Dear Ryan Barnett,

Quoted 6 lines · Ryan Barnett

Some boards in u-boot support the ability to modify the environment by placing a plain text file as uEnv.txt in the root of the partition of an SD card. For the extact placement of where the uEnv.txt should be, consult your u-boot environment. Your board supports this overwriting of environment variables if "loadbootenv" and "importbootenv" are defined in the board's environment.

loadbootenv and importbootenv are just U-Boot scripts that are specific to certain board configurations.

Quoted 6 lines

All what loadbootenv does it load a file into memory, and all what importbootenv does is call 'env import -t <addr> <size>' to load the environment into U-Boot.

So I don't think we should be mentioning loadbootenv and importbootenv here.

That is fine, and I'll remove if we decide to push forward with the patch.

Quoted 7 lines

However, what I'm really wondering if is we really need this. After all, this is all about copying a text file to $(BINARIES_DIR), something a post-build or a post-image script can do perfectly fine. I mean, there's nothing U-Boot specific involved here, it's just a plain 'cp'. Therefore, I'm not sure we need this at all, but I am open to discussion on this.

Well I do agree that it isn't difficult to place in post-build/image script
which is how I currently do things. My thought with adding it here is that

it is a potential alternative to an Environment image. I didn't know about

this feature until just within the last couple months and I always keep forgetting it is an option. So placing it under the "Environment image" may open some eye's that this option exists for them. It seems like more and more boards are adapting this feature.

Thanks,
-Ryan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130913/4fb05793/attachment.html>

#4 lore raw

PATCH 1/1 uboot: add support for a uEnv.txt file

Quoted 14 lines · Ryan Barnett

Thomas,

Thomas Petazzoni <[email protected]> wrote on 09/13/2013 02:01:34 AM:

Quoted 10 lines

Dear Ryan Barnett,

Quoted 6 lines · Ryan Barnett

Some boards in u-boot support the ability to modify the environment by placing a plain text file as uEnv.txt in the root of the partition of an SD card. For the extact placement of where the uEnv.txt should be, consult your u-boot environment. Your board supports this overwriting of environment variables if "loadbootenv" and "importbootenv" are defined in the board's environment.

[snip]

Quoted 8 lines
Quoted 7 lines

However, what I'm really wondering if is we really need this. After all, this is all about copying a text file to $(BINARIES_DIR), something a post-build or a post-image script can do perfectly fine. I mean, there's nothing U-Boot specific involved here, it's just a plain 'cp'. Therefore, I'm not sure we need this at all, but I am open to discussion on this.

Quoted 7 lines

Well I do agree that it isn't difficult to place in post-build/image script which is how I currently do things. My thought with adding it here is that it is a potential alternative to an Environment image. I didn't know about this feature until just within the last couple months and I always keep forgetting it is an option. So placing it under the "Environment image" may open some eye's that this option exists for them. It seems like more and more boards are adapting this feature.

I'm with Thomas on this one. It's not buildroot's mission to replace
the documentation of the underlying tools/packages. If there is something simple that we can do that saves the user a lot of time, let's go for it, but otherwise buildroot should be about building upstream code.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#5 lore raw

PATCH 1/1 uboot: add support for a uEnv.txt file

Arnout/Thomas Petazzoni,

Arnout Vandecappelle <[email protected]> wrote on 09/13/2013 03:42:12 PM:

Quoted 2 lines
Quoted 2 lines

Well I do agree that it isn't difficult to place in post-build/image

script

Quoted 1 line
Quoted 1 line

which is how I currently do things. My thought with adding it here is

that

Quoted 1 line
Quoted 1 line

it is a potential alternative to an Environment image. I didn't know

about

Quoted 1 line
Quoted 1 line

this feature until just within the last couple months and I always

keep

Quoted 1 line
Quoted 1 line

forgetting it is an option. So placing it under the "Environment

image"

Quoted 1 line
Quoted 1 line

may open some eye's that this option exists for them. It seems like

more

Quoted 4 lines
Quoted 1 line

and more boards are adapting this feature.

I'm with Thomas on this one. It's not buildroot's mission to replace
the documentation of the underlying tools/packages. If there is

something

Quoted 1 line

simple that we can do that saves the user a lot of time, let's go for

it,

Quoted 1 line

but otherwise buildroot should be about building upstream code.

Alright, I understand that it is not buildroot's mission to replace the documentation of the underlying tools/packages. I can take all of that information out if that would help if wanted. I guess I was just offering this up as an alternative to Environment image when browsing through the menuconfig.

At the end of the day if you don't feel this is best to be in buildroot, I'm fine with leaving this out as I spent all of 10 minutes on implementing this so I don't have much invested in this.

Thanks,
-Ryan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130913/1ca4a2d7/attachment.html>