[U-Boot] [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@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(-)
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"

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

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

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

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

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

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
participants (3)
-
Javier Martinez Canillas
-
Tom Rini
-
Wolfgang Denk