Patchwork [U-Boot,V4,3/5] omap5: Allow use of a plain text env file

login
register
mail settings
Submitter SRICHARAN R
Date April 1, 2013, 3:52 p.m.
Message ID <1364831562-28868-4-git-send-email-r.sricharan@ti.com>
Download mbox | patch
Permalink /patch/232773/
State Accepted
Delegated to: Tom Rini
Headers show

Comments

SRICHARAN R - April 1, 2013, 3:52 p.m.
From: Nishanth Menon <nm@ti.com>

For production systems it is better to use script images since
they are protected by checksums and carry valuable information
like name and timestamp. Also, you can't validate the content
passed to env import.

But for development, it is easier to use the env import command and
plain text files instead of script-images.

Since both OMAP5evm/uevm boards are used primarily for development,
we allow U-Boot to load env var from a text file in case that an
boot.scr script-image is not present.

The variable uenvcmd (if existent) will be executed (using run) after
uEnv.txt was loaded. If uenvcmd doesn't exist the default boot sequence
will be started.

Inspired by commit: d70f54808dfa83b574e1239c3eccbcf3317343e1
(omap4: allow the use of a plain text env file instead boot scripts)

Signed-off-by: Sricharan R <r.sricharan@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Tested-by: Sricharan R <r.sricharan@ti.com>
---
 include/configs/omap5_common.h |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

Patch

diff --git a/include/configs/omap5_common.h b/include/configs/omap5_common.h
index f0416df..6d7aa7b 100644
--- a/include/configs/omap5_common.h
+++ b/include/configs/omap5_common.h
@@ -156,6 +156,9 @@ 
 	"loadbootscript=fatload mmc ${mmcdev} ${loadaddr} boot.scr\0" \
 	"bootscript=echo Running bootscript from mmc${mmcdev} ...; " \
 		"source ${loadaddr}\0" \
+	"loadbootenv=fatload mmc ${mmcdev} ${loadaddr} uEnv.txt\0" \
+	"importbootenv=echo Importing environment from mmc${mmcdev} ...; " \
+		"env import -t ${loadaddr} ${filesize}\0" \
 	"loaduimage=fatload mmc ${mmcdev} ${loadaddr} uImage\0" \
 	"mmcboot=echo Booting from mmc${mmcdev} ...; " \
 		"run mmcargs; " \
@@ -166,9 +169,16 @@ 
 		"if run loadbootscript; then " \
 			"run bootscript; " \
 		"else " \
-			"if run loaduimage; then " \
-				"run mmcboot; " \
-			"fi; " \
+			"if run loadbootenv; then " \
+				"run importbootenv; " \
+			"fi;" \
+			"if test -n ${uenvcmd}; then " \
+				"echo Running uenvcmd ...;" \
+				"run uenvcmd;" \
+			"fi;" \
+		"fi;" \
+		"if run loaduimage; then " \
+			"run mmcboot; " \
 		"fi; " \
 	"fi"