| 90 | |
| 91 | === 2.2.4. Using NFS with DHCP. === |
| 92 | Reference article: http://www.openflow.org/wk/index.php/IndigoQuickStartLB4G#NFS |
| 93 | [[BR]][[BR]] |
| 94 | Here, we assume that the switch will be assigned an IP address via DHCP. It will use the assigned IP address for fetching necessary images from an NFS server, and once booted into Linux, the variable DEV_ADDR. |
| 95 | |
| 96 | 1. DHCP setup in u-boot: |
| 97 | {{{ |
| 98 | => setenv ipaddr |
| 99 | => setenv bootargs |
| 100 | => setenv dhcp_boot dhcp |
| 101 | => setenv autoload no |
| 102 | }}} |
| 103 | The fiirst two commands blank out any previously assigned IP addresses and boot arguments. The next two enable DHCP. You can test if DHCP works via the command `dhcp`: |
| 104 | {{{ |
| 105 | => dhcp |
| 106 | Speed: 1000, full duplex |
| 107 | BOOTP broadcast 1 |
| 108 | Got error 4 |
| 109 | DHCP client bound to address 10.50.250.6 |
| 110 | }}} |
| 111 | |
| 112 | 2. Set the startup script variable: |
| 113 | {{{ |
| 114 | => setenv dn_boot 'dhcp; setenv bootargs root=/dev/nfs ip=$ipaddr:$nfsip::$netmask:$hostname:$netdev \ |
| 115 | console=$consoledev,$baudrate nfsroot=$nfsip:$rootpath rw DEV_ADDR=$ipaddr ETH0_IP=$ipaddr $extra_boot_args; \ |
| 116 | bootm ffd00000' |
| 117 | }}} |
| 118 | `dhcp` invokes the DHCP client we configured earlier, which sets $ipaddr. Next, bootargs are set so that u-boot pulls the desired filesystem from a NFS . The next few parameters, `ip`,`console`,`$baudrate`, and `nfsroot` set the networking, standard I/O, and NFS parameters. 'rw' set mount parameters for the root FS. Both DEV_ADDR and ETH0_IP are variables used by Linux once the system boots into it; They are both set to the DHCP assigned IP address. $extra_boot_args can be set to additional variables using "`setenv extra_boot_args '<VARS>'`" (It's essentially a dummy variable). Finally, `bootm` is used to load the linux kernel stored on flash. |
| 119 | |
| 120 | 3. Set additional variables. Make sure all the variables required by the startup script are defined. You may also want the set the bootcmd to boot using the new script. |
| 121 | |
| 122 | 4. Save your settings with `saveenv`. |