[U-Boot] [PATCH v2 1/1] omap4: allow the use of a plain text env file instead boot scripts

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 OMAP4 supported boards (Panda and TI SDP4430) are used primarily for development, this patch allows 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.
Signed-off-by: Javier Martinez Canillas javier.martinez@collabora.co.uk ---
Changes since v2: - Comment the advantages and drawbacks of using env import instead of boot scripts as explained by Wolfgang Denk. - Don't break existing users/distributions that rely on boot.scr by looking for uEnv.txt only if boot.scr does not exist as suggested by Tom Rini.
include/configs/omap4_common.h | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/include/configs/omap4_common.h b/include/configs/omap4_common.h index a32369a..dfdfea9 100644 --- a/include/configs/omap4_common.h +++ b/include/configs/omap4_common.h @@ -159,6 +159,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,12 +169,20 @@
#define CONFIG_BOOTCOMMAND \ "mmc dev ${mmcdev}; if mmc rescan; then " \ + "echo SD/MMC found on device ${mmcdev};" \ "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"

On Mon, Jan 7, 2013 at 7:51 AM, Javier Martinez Canillas javier@dowhile0.org wrote:
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 OMAP4 supported boards (Panda and TI SDP4430) are used primarily for development, this patch allows 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.
Signed-off-by: Javier Martinez Canillas javier.martinez@collabora.co.uk
Acked-by: Nishanth Menon nm@ti.com
Tested on PandaBoard ES. Regards, Nishanth Menon

On Fri, Jan 11, 2013 at 9:55 PM, Nishanth Menon nm@ti.com wrote:
On Mon, Jan 7, 2013 at 7:51 AM, Javier Martinez Canillas javier@dowhile0.org wrote:
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 OMAP4 supported boards (Panda and TI SDP4430) are used primarily for development, this patch allows 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.
Signed-off-by: Javier Martinez Canillas javier.martinez@collabora.co.uk
Acked-by: Nishanth Menon nm@ti.com
Tested on PandaBoard ES. Regards, Nishanth Menon
Hello Tom,
Any comments on this patch?
Thanks a lot and best regards, Javier

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 01/19/2013 09:20 AM, Javier Martinez Canillas wrote:
On Fri, Jan 11, 2013 at 9:55 PM, Nishanth Menon nm@ti.com wrote:
On Mon, Jan 7, 2013 at 7:51 AM, Javier Martinez Canillas javier@dowhile0.org wrote:
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 OMAP4 supported boards (Panda and TI SDP4430) are used primarily for development, this patch allows 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.
Signed-off-by: Javier Martinez Canillas javier.martinez@collabora.co.uk
Acked-by: Nishanth Menon nm@ti.com
Tested on PandaBoard ES. Regards, Nishanth Menon
Hello Tom,
Any comments on this patch?
My Friday got overly busy, I hope to prepare a pull request for u-boot-ti early next week, with this patch. Thanks!
- -- Tom

On Mon, Jan 07, 2013 at 03:51:20AM -0000, Javier Martinez Canillas wrote:
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 OMAP4 supported boards (Panda and TI SDP4430) are used primarily for development, this patch allows 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.
Signed-off-by: Javier Martinez Canillas javier.martinez@collabora.co.uk Acked-by: Nishanth Menon nm@ti.com
Applied to u-boot-ti/master, thanks!
participants (3)
-
Javier Martinez Canillas
-
Nishanth Menon
-
Tom Rini