= Setting up the Quanta LB4G = Unlike the IP8800, This is a purely !OpenFlow switch, unable to do ''anything'' without a controller. The steps can be found documented elsewhere (ref. below), but we repeat the steps just in case things change. == 1. Preparation == === 1.1 References === copies of these pages can be found at the bottom of this page - You can never be sure how permanent any link is. Flashing the firmware * http://openflowswitch.org/wk/index.php/LB4GImageSetup * http://www.openflow.org/wk/index.php/IndigoQuickStartLB4G (possibly more up-to-date) Configuring the switch * http://www.openflow.org/wk/index.php/IndigoConfiguration - synopsis of system files, variables * http://www.openflowswitch.org/wk/index.php/IndigoReleaseNotes - the actual HOWTO for turning the box into an !OpenFlow switch [[BR]] === 1.2 Prerequisites === * OS on PC: Ubuntu * packages on PC: ckermit, xinetd, tftpd-hpa == 2. Installation == === 2.1 Connecting to the switch === A serial connection can be set up between the switch and a machine using a RJ-45 to RS-232 cable. Surprisingly, a Cisco cable will work for this. Connect the RJ-45 end to the port labeled "Con" on the switch, and the other end to the PC. Next, start a session from a shell with kermit as root: {{{ kermit -l /dev/ttyS0 set carrier-watch off set baud 115200 connect }}} Fire up the switch. If you see the U-Boot banner, you can stop the boot process (hit ctrl-c) so you can copy/burn the images onto flash. === 2.2 updating u-boot === This step is comprised of the following steps: 1. change network settings of switch 2. update u-boot 3. upload kernel, root filesystem, and device tree to flash 4. modify boot parameters The switch for SB9 will be images via nfs with console.sb9 as the server. This is to prevent users from bricking the switch by playing with u-boot. === 2.2.1. change network settings === The network settings are hard-wired into the switch via environment variables. The default settings statically set the switch's IP to a 192.168.X.X address block, which you might want to change depending on your network setup. This can be done using command `setenv`. While all environment variables can be viewed with `printenv`, the four variables of our interest are: * ipaddr (switch's static ip, default 192.168.1.2) * gatewayip (what the switch sees as default gw on its route table) * serverip (who to talk to for services e.g. tftp) * netmask (self-explanatory) These variables should correspond to those for the network you're attaching the switch to. In our case, we set the switch's IP to 10.50.0.40, and cut out the hassle of setting the gateway IP by just directly pointing the switch to think the tftp server is the gateway: {{{ => setenv gatewayip 10.50.0.42 => setenv ipaddr 10.50.0.40 => setenv netmask 255.255.0.0 => setenv serverip 10.50.0.42 => saveenv }}} === 2.2.2. updating u-boot/copying files to flash === Once the networking variables are set, you can start copying the necessary files to the switch using `copy`. `copy` uses tftp to fetch the images: {{{ => copy -b tftp://10.50.0.42/u-boot.bin => copy -k tftp://10.50.0.42/uImage => copy -r tftp://10.50.0.42/uInitrd2m => copy -d tftp://10.50.0.42/LB9A.dtb }}} The first line updates u-boot. The next three fetch the kernel image, root filesystem, and device tree, respectively. === 2.2.3. modifying boot parameters === ''This section covers booting the switch using a manually loaded root filesystem from on-board flash. To use NFS, refer to the next section, 2.2.4.'' [[BR]][[BR]] In addition, you want to modify `flash_bootcmd` so that it tells the linux kernel to mount the root filesystem read-write: {{{ => setenv flash_bootcmd 'setenv bootargs root=/dev/ram console=ttyS0,$baudrate rw DEV_ADDR=x.x.x.x; bootm ffd00000 ff000000 ffee0000' => saveenv }}} Several boot parameters such as the DEV_ADDR variable used by the OF startup scripts can also be set here. The details of can be found in [http://www.openflow.org/wk/index.php/IndigoConfiguration IndigoConfiguration]. Also, make sure that the variable `bootcmd` is set to `run flash_bootcmd`. If not, reset with setenv and save this change as well: {{{ => setenv bootcmd 'run flash_bootcmd' => setenv bootfile eldk-quanta => saveenv }}} and load the image by issuing the command `boot`. if all goes well, you should be at the Linux shell prompt once the switch starts up. [[BR]][[BR]] '''Note:''' The bootcmd parameter will be the proper value if the switch is restarted after u-boot is updated (a.k.a. after the 1st `copy` command). This, however, resets all of your networking variables, so you'd have to re-do the steps in 2.2.1. Basically, it is up to the tastes of whoever is re-imaging the switches to either manually set the bootcmd variable or reset all of the network parameters after reboot. === 2.2.4. Using NFS with DHCP. === Reference article: http://www.openflow.org/wk/index.php/IndigoQuickStartLB4G#NFS [[BR]][[BR]] 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. 1. DHCP setup in u-boot: {{{ => setenv ipaddr => setenv bootargs => setenv dhcp_boot dhcp => setenv autoload no }}} 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`: {{{ => dhcp Speed: 1000, full duplex BOOTP broadcast 1 Got error 4 DHCP client bound to address 10.50.250.6 }}} 2. Set the startup script variable: {{{ => setenv dn_boot 'dhcp; setenv bootargs root=/dev/nfs ip=$ipaddr:$nfsip::$netmask:$hostname:$netdev \ console=$consoledev,$baudrate nfsroot=$nfsip:$rootpath rw DEV_ADDR=$ipaddr ETH0_IP=$ipaddr $extra_boot_args; \ bootm ffd00000' }}} `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 ''`" (It's essentially a dummy variable). Finally, `bootm` is used to load the linux kernel stored on flash. 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. 4. Save your settings with `saveenv`. == 3. Configuration == The Quanta is pretty much just a modified, minimal Linux box with a bunch of ports. Upon startup, you will be at the Linux shell as root. * eth0 and eth1 as given by `ifconfig -a` are eth1 and eth2 on the faceplate, respectively. The interfaces can be manipulated as with any Linux box using `ifconfig`. * The ssh server (dropbear) is enabled by default. Telnet can be started by invoking telnetd. In either case the default username is `root`, and password is `OpenFlow`. === 3.1. Using the !OpenFlow CLI (OF-BCM) === OF-BCM is the !OpenFlow command line supplied with the image. It can be started manually: {{{ # /sbin/of-bcm-cli Broadcom Command Monitor: Copyright (c) 1998-2008 Broadcom Corporation Release: sdk-xgs-robo-5.6.6 built 20100905 (Sun Sep 5 23:01:38 2010) Stanford OpenFlow Monitor Platform: LB9A_MPC8541 OS: Unix (Posix) PCI unit 0: Dev 0xb538, Rev 0x11, Chip BCM56538_B0, Driver BCM56634_B0 rc: unit 0 ... OF-BCM.0> }}} === 3.2. Key files === The !OpenFlow components of the switch rely on the following: * `/etc/rc.sh` - system startup script: bring up `lo`, mounts filesystems, loads kernel modules, ect * `/etc/system_config` - system initialization scrit * `/etc/system_config` - system configs unique to each switch * `/rc.soc`, `/etc/config.bcm` - starts !OpenFlow components * `/etc/find-env` - defines many of the system variables