[U-Boot-Users] [Fwd: [PPCBoot-users] DHCP updating environment???]

Steven Scholz steven.scholz at imc-berlin.de
Tue Nov 5 16:30:01 CET 2002


Steven Scholz wrote:
> 
> Wolfgang Denk wrote:
> >
> > In message <3DC7C8C5.6983A78 at imc-berlin.de> you wrote:
> > >
> > > > Seems you think right. Ummmm... why are you asking? Any problems with
> > > > it?
> > > Well, I am a bit anoyed because everytime I do a dhcp to get the settings for a
> > > tftp I have to wait until pImage gets loaded...
> > >
> > > (Well not realy anoyed! Just curious why it is the way it is.)
> > >
> > > I want to do something like "dhcp; tftp 100000 fpga.rbf".
> >
> > I don't get you. Do you mean that setting "autoload" to "no" does NOT
> > work with DHCP? From the code I think it should work.
> 
> Ok. Example (from real life):
> 
> After power on I have
> 
> loadaddr=0x100000
> serial#=69383
> ethaddr=00:A0:33:01:07:0F
> 
> A bootp results in:
> => bootp
> FEC ETHERNET configured
> BOOTP broadcast 1
> DHCP client bound to address 10.0.9.161
> ARP broadcast 1
> TFTP from server 10.0.2.9; our IP address is 10.0.9.161
> Filename 'pImage.DAB4K2'.
> Load address: 0x100000
> Loading: #################################################################
>          #################################################################
>          ########
> done
> Bytes transferred = 702439 (ab7e7 hex)
> => printenv
> loadaddr=0x100000
> serial#=69383
> ethaddr=00:A0:33:01:07:0F
> bootfile=pImage.DAB4K2
> filesize=ab7e7
> netmask=255.255.0.0
> hostname=dab4k2_69383
> rootpath=/opt/ELDK/ppc_8xx
> ipaddr=10.0.9.161
> serverip=10.0.2.9
> 
> Fair enough! But let's do it again...
> 
> => setenv autoload n
> => bootp
> FEC ETHERNET configured
> BOOTP broadcast 1
> DHCP client bound to address 10.0.9.161
> => printenv
> loadaddr=0x100000
> serial#=69383
> ethaddr=00:A0:33:01:07:0F
> autoload=n
> bootfile=pImage.DAB4K2
> 
> You see!?
> 
> Only "bootfile" gets set. So a following tftp brings
> 
> => tftp 100000 pImage.DAB4K2
> FEC ETHERNET configured
> *** ERROR: `serverip' not set
> 
> So I think BootpCopyNetParams() should get called regardless of autoload!

Sorry!!!
BootpCopyNetParams() gets called regardless of autoload!

But

void BootpCopyNetParams(Bootp_t *bp)
{
        NetCopyIP(&NetOurIP, &bp->bp_yiaddr);
        NetCopyIP(&NetServerIP, &bp->bp_siaddr);
        memcpy (NetServerEther, ((Ethernet_t *)NetRxPkt)->et_src, 6);
        copy_filename (BootFile, bp->bp_file, sizeof(BootFile));

        debug ("Bootfile: %s\n", BootFile);

        /* Propagate to environment:
         * don't delete exising entry when BOOTP / DHCP reply does
         * not contain a new value
         */
        if (*BootFile) {
                setenv ("bootfile", BootFile);
        }
}

So setenv is called only for bootfile. So should we call setenv for OurIP,
ServerIp etc or should tftp check NetOurIP or bp->bp_yiaddr!?

Steven




More information about the U-Boot mailing list