summaryrefslogtreecommitdiff
path: root/net/net.c
diff options
context:
space:
mode:
authorAllen Martin <amartin@nvidia.com>2012-12-19 13:02:36 -0800
committerAllen Martin <amartin@nvidia.com>2012-12-19 13:02:36 -0800
commita098cf41fdb2a6607c675f7fe4f3164617c9367e (patch)
treeb37acb36f65909e6f74cc537d73efd883a1485a6 /net/net.c
parentb8a7c467960ffb4d5a5e1eef5f7783fb6f594542 (diff)
parent095728803eedfce850a2f85828f79500cb09979e (diff)
downloadu-boot-imx-a098cf41fdb2a6607c675f7fe4f3164617c9367e.zip
u-boot-imx-a098cf41fdb2a6607c675f7fe4f3164617c9367e.tar.gz
u-boot-imx-a098cf41fdb2a6607c675f7fe4f3164617c9367e.tar.bz2
Merge remote-tracking branch 'u-boot/master' into u-boot-arm-merged
Conflicts: README arch/arm/cpu/armv7/exynos/clock.c board/samsung/universal_c210/universal.c drivers/misc/Makefile drivers/power/power_fsl.c include/configs/mx35pdk.h include/configs/mx53loco.h include/configs/seaboard.h
Diffstat (limited to 'net/net.c')
-rw-r--r--net/net.c49
1 files changed, 32 insertions, 17 deletions
diff --git a/net/net.c b/net/net.c
index 82c4cc9..a40cde1 100644
--- a/net/net.c
+++ b/net/net.c
@@ -82,6 +82,7 @@
#include <common.h>
#include <command.h>
+#include <environment.h>
#include <net.h>
#if defined(CONFIG_STATUS_LED)
#include <miiphy.h>
@@ -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);
}