From: Bo Shen Date: Thu, 3 May 2012 17:21:55 +0800 Subject: [U-Boot] [PATCH] DHCP: fix dhcp command parameters overwrite issue Message-ID: <1336036915-6422-1-git-send-email-voice.shen@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de when using dhcp command with parameters as usage message, if DHCP server response contains bootfilename, it will overwrite the dhcp command parameters. So the dhcp command parameters can not be used. Using this patch to fix it. Signed-off-by: Bo Shen --- common/cmd_net.c | 1 + net/bootp.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/common/cmd_net.c b/common/cmd_net.c index 65f32bc..9b1e650 100644 --- a/common/cmd_net.c +++ b/common/cmd_net.c @@ -221,6 +221,7 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc, case 3: load_addr = simple_strtoul(argv[1], NULL, 16); copy_filename (BootFile, argv[2], sizeof(BootFile)); + setenv ("bootfile", BootFile); break; diff --git a/net/bootp.c b/net/bootp.c index 9e32476..df9f5eb 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -116,7 +116,8 @@ static void BootpCopyNetParams(Bootp_t *bp) memcpy (NetServerEther, ((Ethernet_t *)NetRxPacket)->et_src, 6); #endif if (strlen(bp->bp_file) > 0) - copy_filename (BootFile, bp->bp_file, sizeof(BootFile)); + if (!getenv("bootfile")) + copy_filename (BootFile, bp->bp_file, sizeof(BootFile)); debug("Bootfile: %s\n", BootFile); -- 1.7.9.5