You should possibly be able to call the DHCP init the same way it is done in 
cmd/net.c function netboot_common

             size = net_loop(proto);
        if (size < 0) {
                bootstage_error(BOOTSTAGE_ID_NET_NETLOOP_OK);
                return CMD_RET_FAILURE;
        }
        bootstage_mark(BOOTSTAGE_ID_NET_NETLOOP_OK);

        /* net_loop ok, update environment */
        netboot_update_env();

net_loop I think will do DHCP init and then netboot_update_env will set the env 
vars such as the ip address

-----Original Message-----
From: Jim Schaettle <jim.schaet...@etcconnect.com> 
Sent: Wednesday, August 17, 2022 9:18 AM
To: u-boot@lists.denx.de
Subject: DHCP and TFTP

Hello! I have U-Boot installed on the SD card of my Orange Pi. It works great, 
using SRVLOC to get the address of the server, DHCP to get an IP address, and 
TFTP to get the application files.

I also have a rack of 48 Orange Pi devices with the same U-Boot code in their 
SD cards. They all have a common power supply. When they boot, sometimes 
do_pxe() runs before net_ip is set. (There are many devices trying to get IP 
addresses.)

I have my own copy of the U-Boot code. Is there an environment variable that I 
can set, or a code change that I can make? For example:

static int do_pxe(struct cmd_tbl *cmdtp, int flag, int argc, char *const 
argv[]) {
      struct cmd_tbl *cp;

      if (net_ip.s_addr == 0) {
              // now what?
      }
      ...

Do you have any ideas? Thank you!

Jim Schaettle

Reply via email to