[U-Boot] Recent changes break our update scripts, because of getenv_yesno()

Reinhard Meyer u-boot at emk-elektronik.de
Fri Dec 31 11:41:30 CET 2010


On 31.12.2010 11:33, Reinhard Meyer wrote:
> Hello,
>
> in common/image.c:
>
>
> int getenv_yesno (char *var)
> {
> 	char *s = getenv (var);
> 	return (s&&  (*s == 'n')) ? 0 : 1;
> }
>
> Is that supposed to return TRUE when the env variable does NOT exist?
>
> Because each TFTP/USB/whatever load of an image will automatically start it!
>
> (and why is such a generic function in image.c?)
>
OK, digging deeper, the culprit actually is:

2010-11-28
	Mike Frysinger
	boot cmds: convert to getenv_yesno() with autostart

Example:
index c657b03..973fa21 100644 (file)
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -211,7 +211,7 @@ netboot_common (proto_t proto, cmd_tbl_t *cmdtp, int argc, char * const argv[])
         flush_cache(load_addr, size);

         /* Loading ok, check if we should attempt an auto-start */
-       if (((s = getenv("autostart")) != NULL) && (strcmp(s,"yes") == 0)) {
+       if (getenv_yesno("autostart")) {
                 char *local_args[2];
                 local_args[0] = argv[0];
                 local_args[1] = NULL;

Originally, a missing env var resulted in FALSE, with the helper function it
results in TRUE!!

Reinhard




More information about the U-Boot mailing list