Skip to contentSkip to conversation

omap4: use plain text env file instead boot scripts

PATCH Superseded Javier Martinez Canillas 3 participants 7 messages Dec 25, 2012 – Jan 2, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 omap4: use plain text env file instead boot scripts

Based on commit cf073e49bc3502be1b48a0e3faf0cde9edbb89db for beagleboard

Using the new env import command it is possible to use plain text files instead of script-images. Plain text files are much easier to handle.

E.g. If your boot.scr contains the following:
-----------------------------------
setenv dvimode 1024x768-16 at 60
run loaduimage
run mmcboot
-----------------------------------
you could create a file named uEnv.txt and use that instead of boot.scr:
-----------------------------------
dvimode=1024x768-16 at 60
uenvcmd=run loaduimage; run mmcboot
-----------------------------------
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, therefore you could just use
-----------------------------------
dvimode=1024x768-16 at 60
-----------------------------------
as uEnv.txt because loaduimage and mmcboot is part of the default boot sequence

---
 include/configs/omap4_common.h |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)
include/configs/omap4_common.h +13 -9
index a32369a..a821c01 100644
@@ -156,9 +156,9 @@
 		"vram=${vram} " \
 		"root=${mmcroot} " \
 		"rootfstype=${mmcrootfstype}\0" \
-	"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,12 +166,16 @@
 
 #define CONFIG_BOOTCOMMAND \
 	"mmc dev ${mmcdev}; if mmc rescan; then " \
-		"if run loadbootscript; then " \
-			"run bootscript; " \
-		"else " \
-			"if run loaduimage; then " \
-				"run mmcboot; " \
-			"fi; " \
+		"echo SD/MMC found on device ${mmcdev};" \
+		"if run loadbootenv; then " \
+			"run importbootenv; " \
+		"fi;" \
+		"if test -n ${uenvcmd}; then " \
+			"echo Running uenvcmd ...;" \
+			"run uenvcmd;" \
+		"fi;" \
+		"if run loaduimage; then " \
+			"run mmcboot; " \
 		"fi; " \
 	"fi"
 
Signature · 1 line
1.7.7.6
#1 lore raw

PATCH 1/1 omap4: use plain text env file instead boot scripts

Dear Javier Martinez Canillas,

Quoted 4 lines · In message <1356444923-16737-1-git-send-email-javier.martinez@collabora.co.uk>…

Based on commit cf073e49bc3502be1b48a0e3faf0cde9edbb89db for beagleboard

Using the new env import command it is possible to use plain text files instead of script-images. Plain text files are much easier to handle.

Are you sure you want to do this in a production environment? The ease of use may be helpful during development, but please note that there is no validation of the content passed to env import in any way
- and feeding it crap you can even crash the system - not to mention from the problems that can result from corrupted environment settings.

Script images are checksum protected, which appears to be a significant advantage to me - also, they carry information like name and timestamp, which in production environments are often very helpful to diagnose problems (like asking your customers: which exact version of the environment script are you loading?).

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Every living thing wants to survive.
	-- Spock, "The Ultimate Computer", stardate 4731.3
#2 lore raw

PATCH 1/1 omap4: use plain text env file instead boot scripts

Quoted 2 lines · Wolfgang Denk

Dear Javier Martinez Canillas,

Dear Wolfgang,

Quoted 12 lines
Quoted 4 lines · In message <1356444923-16737-1-git-send-email-javier.martinez@collabora.co.uk>…

Based on commit cf073e49bc3502be1b48a0e3faf0cde9edbb89db for beagleboard

Using the new env import command it is possible to use plain text files instead of script-images. Plain text files are much easier to handle.

Are you sure you want to do this in a production environment? The ease of use may be helpful during development, but please note that there is no validation of the content passed to env import in any way
- and feeding it crap you can even crash the system - not to mention from the problems that can result from corrupted environment settings.

Quoted 6 lines

Script images are checksum protected, which appears to be a significant advantage to me - also, they carry information like name and timestamp, which in production environments are often very helpful to diagnose problems (like asking your customers: which exact version of the environment script are you loading?).

I understand your concern and I do agree that for production environments boot scripts are both better and more secure than just importing a plain text with environment variables.

But the Panda board and the Beagle board are not meant to be used to build products but to be evaluation boards for OMAP technology.

The official Panda board web site [1] advertise the board as an development platform:

"PandaBoard is intended to be used as a platform for software development."

And even the Panda board FAQ [2] has an answer for this question:

"PandaBoard is designed to be a vehicle for mobile software development. PandaBoard is neither an end product nor is designed to be directly included in an end product."

So, If someone wants to use a test/development platform to build a product I think he/she should already have bigger things to worry about.

I think this change makes sense not only to be consistent with the OMAP3 Beagle board boot sequence but also to make it easier for developers to modify U-Boot environment variables.

But yes, it's not hard to execute mkimage -T script too, so is your call :-)

Quoted 4 lines

Best regards,

Wolfgang Denk

Thanks a lot and best regards,
Javier

[1]:http://pandaboard.org/content/platform [2]:http://omappedia.org/wiki/PandaBoard_FAQ#Is_PandaBoard_an_end_product.3F_Or.2C_can_I_use_PandaBoard_in_my_end_product.3F

#3 lore raw

PATCH 1/1 omap4: use plain text env file instead boot scripts

Dear Javier,

Quoted 4 lines · In message <CABxcv=kbGDGyq3u+H4j6smndVaPgcVVLXBHkY3OWQmfQEbEtGQ@mail.gmail.com>…

I think this change makes sense not only to be consistent with the OMAP3 Beagle board boot sequence but also to make it easier for developers to modify U-Boot environment variables.

I wasn't aware that Beagle implemented such a change (otherwise I woul dhave raised my concernes then).

Quoted 1 line

But yes, it's not hard to execute mkimage -T script too, so is your call :-)

I don't intend to block any such changes. I just wanted to make sure everybody involved is aware of the consequences. [I would not have added the text file import mode if I did not consider it useful :-) ]

So if you consider this a useful change, please feel free and go ahead. It is fine with me.

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"You ain't experienced..." "Well, nor are you." "That's true. But the
point is ... the point is ... the point is we've been not experienced
for a lot longer than you. We've got  a  lot  of  experience  of  not
having any experience."           - Terry Pratchett, _Witches Abroad_
#4 lore raw

PATCH 1/1 omap4: use plain text env file instead boot scripts

Quoted 2 lines · Wolfgang Denk

Dear Javier,

Hello Wolfgang,

Quoted 9 lines
Quoted 4 lines · In message <CABxcv=kbGDGyq3u+H4j6smndVaPgcVVLXBHkY3OWQmfQEbEtGQ@mail.gmail.com>…

I think this change makes sense not only to be consistent with the OMAP3 Beagle board boot sequence but also to make it easier for developers to modify U-Boot environment variables.

I wasn't aware that Beagle implemented such a change (otherwise I woul dhave raised my concernes then).

The change was introduced on commit "cf073e4 omap3_beagle: enable the use of a plain text file"

Quoted 6 lines
Quoted 1 line

But yes, it's not hard to execute mkimage -T script too, so is your call :-)

I don't intend to block any such changes. I just wanted to make sure everybody involved is aware of the consequences. [I would not have added the text file import mode if I did not consider it useful :-) ]

Indeed :-)

Quoted 3 lines

So if you consider this a useful change, please feel free and go ahead. It is fine with me.

Yes, since this is a development board used primary by developers I think the change is useful. But thanks a lot for raising your concerns and explaining the consequences.

Quoted 4 lines

Best regards,

Wolfgang Denk

Best regards,
Javier

#5 lore raw

PATCH 1/1 omap4: use plain text env file instead boot scripts

In reply to Javier Martinez Canillas

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 6 lines · Javier Martinez Canillas

Based on commit cf073e49bc3502be1b48a0e3faf0cde9edbb89db for beagleboard

Using the new env import command it is possible to use plain text files instead of script-images. Plain text files are much easier to handle.

The only problem I see with this is that in beagle-land there was some regret we didn't make this an either/or. In other words, look for uEnv.txt, if found, use it, otherwise see if we have a boot.scr, if so use it, and if we still haven't been then keep trying a "normal" boot from MMC. This means we don't break existing users (or distributions) that had been relying on boot.scr being used automatically.

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQ5EaKAAoJENk4IS6UOR1WjdgP/1e3R3PGKguwd4gezzdA4tAX 1K1HWtzhJ/3z/aW2LyIUp3LDGXBoUizf+ss1aqVYLDuq36V5uWfxFMBOas+Zt6b0 D36wuH6rNWqY6muhIqJlPub082riVGCS1Zsbdkho3hkNy9DY8eNjfWN+SqLY17WS AGyC1Xgoba828EjMiV0woICcDasarl+r3qTY/xEkCPEyvu8MvixAMY3F6mZKqfdA lk32Hghl/WnaQTHYDkZTQGhIQz+wLfXAH19OMSQmOfIfcRyoShcbylLLFaSfP2BV TqK7xAAibjLkNj++uXecob69054x8C4wnUMK1PN5XNhwDdA5ttsiAF6K4EKhURO7 jQ3epsqGUgso9WgAODJv3SjqHXu0WY9ASNds0kXAT0SDRYl4/I6uzWlexrQPN0Oo d5KwjINPpQpWR86z9rUl+FXIbTj2naslFBO1QryAeDWVPGYOlBrDaKA37iJFWYKI YFF/FKHz6JFMgaF3RWCDsZN/nx93bOq+LDNo9+ejDhp90+iu9wezsACZx8KBiyxy Xyw9Wjm+lUJv5ZQxGOFSVH8eUpaKLbk3dE5z8IHi6YoQSY/IHqHHXqrqU3dz8KbP FJNVUISUYAgYP7f4QaI1P/Tm/u4JV+bovmx65BClprl9FESnvQ8FfPl2lmzboXWX 6vcln6tUmX4+itkUJ7BB
=z+WM
-----END PGP SIGNATURE-----

#6 lore raw

PATCH 1/1 omap4: use plain text env file instead boot scripts

Quoted 18 lines · Tom Rini

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 6 lines · Javier Martinez Canillas

Based on commit cf073e49bc3502be1b48a0e3faf0cde9edbb89db for beagleboard

Using the new env import command it is possible to use plain text files instead of script-images. Plain text files are much easier to handle.

The only problem I see with this is that in beagle-land there was some regret we didn't make this an either/or. In other words, look for uEnv.txt, if found, use it, otherwise see if we have a boot.scr, if so use it, and if we still haven't been then keep trying a "normal" boot from MMC. This means we don't break existing users (or distributions) that had been relying on boot.scr being used automatically.

Quoted 2 lines

- --
Tom

Hi Tom,

I see, I'll post a v2 then that fallbacks to boot.scr in case uEnv.txt is not found. I'll post a patch to fix the beagle and IGEP boards as well.

Thanks a lot and best regards,
Javier