X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=net%2Fnet.c;h=a40cde1e94e46367d727e30d40187b2630f60f15;hb=a098cf41fdb2a6607c675f7fe4f3164617c9367e;hp=82c4cc91179a547f14887c8d1f5e1cf13f84a5af;hpb=1cc619be8b73abbee2fd6faf2cd4ade27b516531;p=karo-tx-uboot.git diff --git a/net/net.c b/net/net.c index 82c4cc9117..a40cde1e94 100644 --- a/net/net.c +++ b/net/net.c @@ -82,6 +82,7 @@ #include #include +#include #include #if defined(CONFIG_STATUS_LED) #include @@ -208,32 +209,46 @@ static int NetTryCount; /**********************************************************************/ +static int on_bootfile(const char *name, const char *value, enum env_op op, + int flags) +{ + switch (op) { + case env_op_create: + case env_op_overwrite: + copy_filename(BootFile, value, sizeof(BootFile)); + break; + default: + break; + } + + return 0; +} +U_BOOT_ENV_CALLBACK(bootfile, on_bootfile); + /* * Check if autoload is enabled. If so, use either NFS or TFTP to download * the boot file. */ void net_auto_load(void) { +#if defined(CONFIG_CMD_NFS) const char *s = getenv("autoload"); - if (s != NULL) { - if (*s == 'n') { - /* - * Just use BOOTP/RARP to configure system; - * Do not use TFTP to load the bootfile. - */ - net_set_state(NETLOOP_SUCCESS); - return; - } -#if defined(CONFIG_CMD_NFS) - if (strcmp(s, "NFS") == 0) { - /* - * Use NFS to load the bootfile. - */ - NfsStart(); - return; - } + if (s != NULL && strcmp(s, "NFS") == 0) { + /* + * Use NFS to load the bootfile. + */ + NfsStart(); + return; + } #endif + if (getenv_yesno("autoload") == 0) { + /* + * Just use BOOTP/RARP to configure system; + * Do not use TFTP to load the bootfile. + */ + net_set_state(NETLOOP_SUCCESS); + return; } TftpStart(TFTPGET); }