[U-Boot] [PATCH] bootp: Fix bug in auto_load function
Simon Glass
sjg at chromium.org
Wed Aug 31 18:31:39 CEST 2011
Hi Michal,
On Wed, Aug 31, 2011 at 3:36 AM, Michal Simek <monstr at monstr.eu> wrote:
> Patch: "Put common autoload code into auto_load() function"
> (sha1: 093498669e77597635a24f326f11efeab213d394) is not simple code
> cleanup but code change which introduce new bug.
>
> If autoload variable is not setup it worked as autoload=yes.
>
> Currently if autoload is not setup dhcp sends request in
> forever loop.
Thanks for bring this up - there was some discussion at the time I
remember. Also please excuse the verbatim code in this email but I
want it to be clear.
The old code in v2011.03 is:
/* Obey the 'autoload' setting */
if ((s = getenv("autoload")) != NULL) {
if (*s == 'n') {
/*
* Just use BOOTP to configure system;
* Do not use TFTP to load the bootfile.
*/
NetState = NETLOOP_SUCCESS;
return;
#if defined(CONFIG_CMD_NFS)
} else if (strcmp(s, "NFS") == 0) {
/*
* Use NFS to load the bootfile.
*/
NfsStart();
return;
#endif
}
}
TftpStart();
return;
and
if ((s = getenv("autoload")) != NULL) {
if (*s == 'n') {
/*
* Just use BOOTP to configure system;
* Do not use TFTP to load the bootfile.
*/
NetState = NETLOOP_SUCCESS;
return;
#if defined(CONFIG_CMD_NFS)
} else if (strcmp(s, "NFS") == 0) {
/*
* Use NFS to load the bootfile.
*/
NfsStart();
return;
#endif
}
}
TftpStart();
These two sites were changed to a call to auto_load:
static void auto_load(void)
{
const char *s = getenv("autoload");
if (s != NULL) {
if (*s == 'n') {
/*
* Just use BOOTP to configure system;
* Do not use TFTP to load the bootfile.
*/
NetState = NETLOOP_SUCCESS;
return;
}
#if defined(CONFIG_CMD_NFS)
if (strcmp(s, "NFS") == 0) {
/*
* Use NFS to load the bootfile.
*/
NfsStart();
return;
}
#endif
TftpStart();
}
}
I don't see a change in the functionality here - I may be missing
something so please can you explain?
More information about the U-Boot
mailing list