Patchwork [U-Boot,1/1] omap4: use plain text env file instead boot scripts

login
register
mail settings
Submitter Javier Martinez Canillas
Date Dec. 25, 2012, 2:15 p.m.
Message ID <1356444923-16737-1-git-send-email-javier.martinez@collabora.co.uk>
Download mbox | patch
Permalink /patch/208106/
State Superseded
Delegated to: Tom Rini
Headers show

Comments

Javier Martinez Canillas - Dec. 25, 2012, 2:15 p.m.
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@60
run loaduimage
run mmcboot
-----------------------------------
you could create a file named uEnv.txt and use that instead of boot.scr:
-----------------------------------
dvimode=1024x768-16@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@60
-----------------------------------
as uEnv.txt because loaduimage and mmcboot is part of the default boot sequence

Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
---
 include/configs/omap4_common.h |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)
Wolfgang Denk - Dec. 25, 2012, 8 p.m.
Dear Javier Martinez Canillas,

In message <1356444923-16737-1-git-send-email-javier.martinez@collabora.co.uk> you wrote:
> 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
Javier Martinez Canillas - Dec. 26, 2012, 3:49 a.m.
On Tue, Dec 25, 2012 at 9:00 PM, Wolfgang Denk <wd@denx.de> wrote:
> Dear Javier Martinez Canillas,
>

Dear Wolfgang,

> In message <1356444923-16737-1-git-send-email-javier.martinez@collabora.co.uk> you wrote:
>> 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?).
>

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 :-)

> 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
Wolfgang Denk - Dec. 26, 2012, 11:40 a.m.
Dear Javier,

In message <CABxcv=kbGDGyq3u+H4j6smndVaPgcVVLXBHkY3OWQmfQEbEtGQ@mail.gmail.com> you wrote:
> 
> 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).

> 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
Javier Martinez Canillas - Dec. 26, 2012, 11:54 a.m.
On Wed, Dec 26, 2012 at 12:40 PM, Wolfgang Denk <wd@denx.de> wrote:
> Dear Javier,
>

Hello Wolfgang,

> In message <CABxcv=kbGDGyq3u+H4j6smndVaPgcVVLXBHkY3OWQmfQEbEtGQ@mail.gmail.com> you wrote:
>>
>> 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"

>> 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 :-)

> 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.

> Best regards,
>
> Wolfgang Denk
>

Best regards,
Javier
Tom Rini - Jan. 2, 2013, 2:39 p.m.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/25/12 09:15, Javier Martinez Canillas wrote:
> 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-----
Javier Martinez Canillas - Jan. 2, 2013, 10:05 p.m.
On Wed, Jan 2, 2013 at 3:39 PM, Tom Rini <trini@ti.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 12/25/12 09:15, Javier Martinez Canillas wrote:
>> 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

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

Patch

diff --git a/include/configs/omap4_common.h b/include/configs/omap4_common.h
index a32369a..a821c01 100644
--- a/include/configs/omap4_common.h
+++ b/include/configs/omap4_common.h
@@ -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"