| 
					Using DHCP Client in U-Boot for Loading Linux Images via Network			 | 
				
				
		 		 | 
		
					
  
U-Boot has a nice feature - the ability to automatically assign the networking parameters and load a boot image to the board's RAM. 
Step through the following procedure in order to add DHCP client to U-Boot: 
- Define the CONFIG_CMD_DHCP configuration parameter in the U-Boot configuration file for your board (u-boot/include/configs/<board>.h):
 
...  #define CONFIG_CMD_DHCP  ... 
Refer to the u-boot/README.u-boot file and the u-boot/doc/ directory for more DHCP-related options. 
- Build the U-Boot image as described in the "U-Boot Build" section of the Starter Kit Guide or the Board Support Package Guide.
 
- Upgrade U-Boot on your board as described in Section 5.3.5 of the Linux Cortex-M User's Manual.
 
- Specify the boot image filename:
 
U-Boot> setenv bootfile psl/m2s/networking.uImage  U-Boot> saveenv 
- Connect to the serial console, reset the board and stop auto-boot by hitting any key. At the U-Boot prompt, run the  dhcp command to invoke DHCP client to obtain an IP address and boot the board:
 
U-Boot>dhcp  BOOTP broadcast 1  DHCP client bound to address 172.17.11.49  ...  TFTP from server 172.17.0.1; our IP address is 172.17.11.49  Filename 'psl/m2s/networking.uImage'.  Load address: 0xa0007fc0  Loading: #################################################################  #################################################################  ###########################  done  Bytes transferred = 2290944 (22f500 hex)  U-boot> 
-  Now, putting it all together to make the board boot automatically:
 
U-Boot> print netboot  netboot=tftp ${loadaddr} ${image};run addip;bootm   U-Boot> setenv netboot dhcp\;run addip\;bootm  U-Boot> print netboot  netboot=dhcp;run addip;bootm  U-Boot> print bootcmd  bootcmd=run flashboot  U-Boot> setenv bootcmd run netboot  U-Boot> saveenv  Saving Environment to SPI Flash...  Erasing SPI flash...Writing to SPI flash...done  U-Boot>re    U-Boot 2010.03-00030-ga697c91-dirty (Nov 19 2014 - 13:34:28)  ...  BOOTP broadcast 1  DHCP client bound to address 172.17.11.49  ...  TFTP from server 172.17.0.1; our IP address is 172.17.11.49  Filename 'psl/m2s/networking.uImage'.  Load address: 0xa0007fc0  Loading: #################################################################  #################################################################  ###########################  done  Bytes transferred = 2290944 (22f500 hex)  ## Booting kernel from Legacy Image at a0007fc0 ...  Image Name:   Linux-2.6.33-arm1  Image Type:   ARM Linux Kernel Image (uncompressed)  Data Size:    2290880 Bytes =  2.2 MB  Load Address: a0008000  Entry Point:  a0008001  Verifying Checksum ... OK  Loading Kernel Image ... OK  OK    Starting kernel ...    Linux version 2.6.33-arm1 (psl @ocean.emcraft.com) (gcc version 4.4.1 (Sourcery G++ Lite 2010q1-189) ) #5 Mon Dec 9 20:29:17 +0400 2013  ...  IP-Config: Complete:  device=eth0, addr=172.17.11.49, mask=255.255.0.0, gw=172.17.0.137,  host=m2s-fg484-som, domain=, nis-domain=(none),  bootserver=172.17.0.1, rootserver=172.17.0.1, rootpath=  Freeing init memory: 912K  eth0: link up (100/full)  init started: BusyBox v1.17.0 (2013-12-09 20:27:30 +0400)  ~ #  
  
 |