]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - net/net.c
Update MAINTAINERS file for x86
[karo-tx-uboot.git] / net / net.c
index da68a61d63887f32b11e52274b4ab96aecc9a0ae..df94789de95f603000d91b2e14d0fec16b544e31 100644 (file)
--- 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,6 +209,22 @@ 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.
@@ -511,15 +528,11 @@ restart:
                case NETLOOP_SUCCESS:
                        net_cleanup_loop();
                        if (NetBootFileXferSize > 0) {
-                               char buf[20];
                                printf("Bytes transferred = %ld (%lx hex)\n",
                                        NetBootFileXferSize,
                                        NetBootFileXferSize);
-                               sprintf(buf, "%lX", NetBootFileXferSize);
-                               setenv("filesize", buf);
-
-                               sprintf(buf, "%lX", (unsigned long)load_addr);
-                               setenv("fileaddr", buf);
+                               setenv_hex("filesize", NetBootFileXferSize);
+                               setenv_hex("fileaddr", load_addr);
                        }
                        if (protocol != NETCONS)
                                eth_halt();