world leader in high performance signal processing
Trace: » dhcp

U-Boot with DHCP

Das U-Boot includes a basic DHCP client that is pretty trivial to utilize. This allows you to get the board connected to the network quickly and dynamically so you can transfer files at high speeds or other such fun things.

Setup

If you don't have a DHCP server set up already, see the guide for setting up a DHCP server.

Once you have that step out of the way, you should connect to the board like normal with a serial terminal. If you need help with that, see the terminal programs guide.

DHCP command

The U-Boot DHCP command is pretty simple. It takes no arguments. Just run the dhcp command!

bfin> dhcp
BOOTP broadcast 1
BOOTP broadcast 2
DHCP client bound to address 192.168.0.133

Here you can see the board asking twice for an IP address and finally the server gives it the IP 192.168.0.133. Now you are all set to communicate on the network like normal.

Since the dhcp command is non-interactive, it can of course be run automatically at boot followed by other commands.

Environment Variables

The DHCP command will setup some environment variables automatically for you according to the DHCP information given to the board. At a minimum, the following variables will be set automatically:

Variable Meaning
ipaddr The IP address of the Blackfin board
netmask The Network Mask for the Blackfin board
serverip The IP address used when running a command that needs a server (like tftp)
gatewayip The IP address for routing packets outside of the local network (as defined by the netmask)

To view all the variables, simply use the print command.

bfin> print
bootcmd=run dhcp_boot
bootdelay=30 
baudrate=57600
loads_echo=1 
ipaddr=192.168.0.133
serverip=192.168.0.32
gatewayip=192.168.0.1 
netmask=255.255.255.0 
hostname=BF533
netdev=eth0
tftp_boot=tftp 0x1000000 linux;bootelf 0x1000000;echo
dhcp_boot=dhcp;bootelf 0x1000000;echo
serial_boot=loadb;bootelf 0x1000000;echo
stdin=serial
stdout=serial
stderr=serial