Message ID | 1302642840-6958-5-git-send-email-sjg@chromium.org |
---|---|
State | Changes Requested, archived |
Headers | show |
Dear Simon Glass, In message <1302642840-6958-5-git-send-email-sjg@chromium.org> you wrote: > In many environments the DHCP server (which provides IP addresses) is not > under control of the individual engineer. While it is required in order to > connect to the corporate network, it doesn't provide useful information for > booting. For example, it may be set up for PC imaging and provide a bootfile > and tftp server for pxelinux. > > To deal with this, this commit provides for a separate tftpserverip environment > variable. If this is defined, then this IP address is used in preference > to serverip. A new CONFIG_BOOTP_IGNORE_BOOTFILE option is provided to indicate > that any bootfile name returned by the DHCP server is bogus and should be > ignored. Why don't you simply re-assing another value to "serverip" before doing any TFTP transfers? This can be done with trivial scripting, without any code changes. > To use this feature, just setenv tftpserverip to the address of your TFTP > server and define CONFIG_BOOTP_IGNORE_BOOTFILE in your board file. Why don't you simply set the "autoload" environment variable to "no"? This is the documented way to do exactly this. Sorry, but I see no use for this patch. NAK. Best regards, Wolfgang Denk
On Tue, Apr 12, 2011 at 2:56 PM, Wolfgang Denk <wd@denx.de> wrote: > Dear Simon Glass, > > In message <1302642840-6958-5-git-send-email-sjg@chromium.org> you wrote: >> In many environments the DHCP server (which provides IP addresses) is not >> under control of the individual engineer. While it is required in order to >> connect to the corporate network, it doesn't provide useful information for >> booting. For example, it may be set up for PC imaging and provide a bootfile >> and tftp server for pxelinux. >> >> To deal with this, this commit provides for a separate tftpserverip environment >> variable. If this is defined, then this IP address is used in preference >> to serverip. A new CONFIG_BOOTP_IGNORE_BOOTFILE option is provided to indicate >> that any bootfile name returned by the DHCP server is bogus and should be >> ignored. > > Why don't you simply re-assing another value to "serverip" before > doing any TFTP transfers? The point here is to initialize the ethernet only once. setenv autoload n; bootp; tftp... does two initializations which costs a few seconds (to get a link, etc.). We want to just do this: setenv bootfile "uImage"; setenv autoload y; bootp The reason we can't use bootp to load the kernel in this situation is that the DHCP server is not under our control. This is a common situation at larger companies. > > This can be done with trivial scripting, without any code changes. > >> To use this feature, just setenv tftpserverip to the address of your TFTP >> server and define CONFIG_BOOTP_IGNORE_BOOTFILE in your board file. > > Why don't you simply set the "autoload" environment variable to "no"? > This is the documented way to do exactly this. > > Sorry, but I see no use for this patch. Please take another look. Regards, Simon > > NAK. > > > Best regards, > > Wolfgang Denk > > -- > DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de > You could end up being oddly sad and full of a strange, diffuse com- > passion which would lead you to believe that it might be a good idea > to wipe out the whole human race and start again with amoebas. > - Terry Pratchett, _Guards! Guards!_ >
Dear Simon Glass, In message <BANLkTinsrGR1T_YAmQ-21d73OKEo__nGaA@mail.gmail.com> you wrote: > > > Why don't you simply re-assing another value to "serverip" before > > doing any TFTP transfers? > > The point here is to initialize the ethernet only once. Technically it makes no difference if you change the "serverip" address in a script or in C code. > setenv autoload n; bootp; tftp... > > does two initializations which costs a few seconds (to get a link, etc.). This should not be the case. Which board / network hardware are you talking about? > > Sorry, but I see no use for this patch. > > Please take another look. I did. My opiniton did not change. Best regards, Wolfgang Denk
On Tue, Apr 12, 2011 at 10:26 PM, Wolfgang Denk <wd@denx.de> wrote: > Dear Simon Glass, > > In message <BANLkTinsrGR1T_YAmQ-21d73OKEo__nGaA@mail.gmail.com> you wrote: >> >> > Why don't you simply re-assing another value to "serverip" before >> > doing any TFTP transfers? >> >> The point here is to initialize the ethernet only once. > > Technically it makes no difference if you change the "serverip" > address in a script or in C code. > >> setenv autoload n; bootp; tftp... >> >> does two initializations which costs a few seconds (to get a link, etc.). > > This should not be the case. Which board / network hardware are you > talking about? +list It is a USB Ethernet dongle (asix). The initialization starts from scratch and obtains a link each time. Maybe I should look at that. I have send this with other platforms also, but perhaps the fault is with the driver in each case. I will drop this patch from the set. Regards, Simon
Dear Simon Glass, In message <BANLkTi=F6s2TcewB5DDbwen26qT+JEydTw@mail.gmail.com> you wrote: > > >> setenv autoload n; bootp; tftp... > >> > >> does two initializations which costs a few seconds (to get a link, etc.). > > > > This should not be the case. Which board / network hardware are you > > talking about? > > +list ? > It is a USB Ethernet dongle (asix). The initialization starts from > scratch and obtains a link each time. Maybe I should look at that. I OK. USB is indeed a different issue. We should not take this as criterion for decisions which affect all. > I will drop this patch from the set. Thanks. Best regards, Wolfgang Denk
diff --git a/include/net.h b/include/net.h index 8bd7662..8abc719 100644 --- a/include/net.h +++ b/include/net.h @@ -354,6 +354,7 @@ extern uchar NetOurEther[6]; /* Our ethernet address */ extern uchar NetServerEther[6]; /* Boot server enet address */ extern IPaddr_t NetOurIP; /* Our IP addr (0 = unknown) */ extern IPaddr_t NetServerIP; /* Server IP addr (0 = unknown) */ +extern IPaddr_t NetTftpServerIP; /* Tftp Server IP addr (0 = unknown)*/ extern volatile uchar * NetTxPacket; /* THE transmit packet */ extern volatile uchar * NetRxPackets[PKTBUFSRX];/* Receive packets */ extern volatile uchar * NetRxPacket; /* Current receive packet */ diff --git a/net/bootp.c b/net/bootp.c index 0ac1429..a3840eb 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -113,9 +113,10 @@ static void BootpCopyNetParams(Bootp_t *bp) NetCopyIP(&NetServerIP, &bp->bp_siaddr); memcpy (NetServerEther, ((Ethernet_t *)NetRxPacket)->et_src, 6); #endif +#if !defined(CONFIG_BOOTP_IGNORE_BOOTFILE) if (strlen(bp->bp_file) > 0) copy_filename (BootFile, bp->bp_file, sizeof(BootFile)); - +#endif debug("Bootfile: %s\n", BootFile); /* Propagate to environment: diff --git a/net/net.c b/net/net.c index a609632..8e5644e 100644 --- a/net/net.c +++ b/net/net.c @@ -138,6 +138,7 @@ uchar NetServerEther[6] = /* Boot server enet address */ { 0, 0, 0, 0, 0, 0 }; IPaddr_t NetOurIP; /* Our IP addr (0 = unknown) */ IPaddr_t NetServerIP; /* Server IP addr (0 = unknown) */ +IPaddr_t NetTftpServerIP; /* Tftp Server IP addr (0 = unknown) */ volatile uchar *NetRxPacket; /* Current receive packet */ int NetRxPacketLen; /* Current rx packet length */ unsigned NetIPID; /* IP packet ID */ @@ -289,6 +290,7 @@ NetInitLoop(proto_t protocol) NetOurGatewayIP = getenv_IPaddr ("gatewayip"); NetOurSubnetMask= getenv_IPaddr ("netmask"); NetServerIP = getenv_IPaddr ("serverip"); + NetTftpServerIP = getenv_IPaddr ("tftpserverip"); NetOurNativeVLAN = getenv_VLAN("nvlan"); NetOurVLAN = getenv_VLAN("vlan"); #if defined(CONFIG_CMD_DNS) @@ -1720,8 +1722,14 @@ static int net_check_prereq (proto_t protocol) #endif case NETCONS: case TFTP: - if (NetServerIP == 0) { - puts ("*** ERROR: `serverip' not set\n"); + /* + * If there is no specific Tftp server defined, just use the + * generic one */ + if (NetTftpServerIP == 0) + NetTftpServerIP = NetServerIP; + if (NetTftpServerIP == 0) { + puts ("*** ERROR: `serverip' and 'tcpserverip'" + "not set\n"); return (1); } #if defined(CONFIG_CMD_PING) || defined(CONFIG_CMD_SNTP) diff --git a/net/tftp.c b/net/tftp.c index ed559b7..4f6b1a2 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -547,7 +547,7 @@ TftpStart (void) debug("TFTP blocksize = %i, timeout = %ld ms\n", TftpBlkSizeOption, TftpTimeoutMSecs); - TftpServerIP = NetServerIP; + TftpServerIP = NetTftpServerIP; if (BootFile[0] == '\0') { sprintf(default_filename, "%02lX%02lX%02lX%02lX.img", NetOurIP & 0xFF,
In many environments the DHCP server (which provides IP addresses) is not under control of the individual engineer. While it is required in order to connect to the corporate network, it doesn't provide useful information for booting. For example, it may be set up for PC imaging and provide a bootfile and tftp server for pxelinux. To deal with this, this commit provides for a separate tftpserverip environment variable. If this is defined, then this IP address is used in preference to serverip. A new CONFIG_BOOTP_IGNORE_BOOTFILE option is provided to indicate that any bootfile name returned by the DHCP server is bogus and should be ignored. To use this feature, just setenv tftpserverip to the address of your TFTP server and define CONFIG_BOOTP_IGNORE_BOOTFILE in your board file. To use a unified DHCP and TFTP server, don't do either of these steps. TEST=build U-Boot, try bootp with and without tftpserverip set and with and without CONFIG_BOOTP_IGNORE_BOOTFILE. Signed-off-by: Simon Glass <sjg@chromium.org> --- include/net.h | 1 + net/bootp.c | 3 ++- net/net.c | 12 ++++++++++-- net/tftp.c | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-)