154 | | Each entry is a line of the form [variable name]=[parameters]. the parameters can be a combination of u-boot commands and other variables in a way similar to a simple shell script. |
155 | | |
156 | | The general case for these variables can be summarized as follows: |
157 | | |
158 | | * syntax is `[name]=[parameters]`, where [parameter] is some string |
159 | | * `$[name]` returns the value of the separately defined variable, [name] |
| 154 | The output above is from a fresh Quanta out of the box. Each entry is a line of the form [variable name]=[parameters]. the parameters can be a combination of u-boot commands and other variables in a way similar to a simple shell script. |
| 155 | |
| 156 | The general syntax for these variables can be summarized as follows: |
| 157 | |
| 158 | * `[name]=[parameters]`, where [parameter] is some string relevant to the variable, [name] |
| 159 | * `$[name]` returns the value of a variable, [name], which is defined in a separate line (same as in bash shell scripting) |
171 | | * `$baudrate` - use the parameters specified in the variable "baudrate," which we can see above is set to 115200 (baud) |
172 | | |
173 | | The parameters that follow the semicolon after `$baudrate` differ a bit for the two variables. For the cfcard_bootcmd entry the `ext2load` commands specifies where to fetch the kernel, ramdisk, and device tree files from, respectively. The specific syntax for each `ext2load` command is: |
174 | | |
175 | | `ext2load [interface] [memory address]` |
176 | | |
177 | | What is really important here are the memory location values. For the cf card, the values should be: |
178 | | * 0x1000000 for kernel image |
179 | | * 0x2000000 for filesystem |
180 | | * 0x400000 for the device tree |
| 171 | * `$baudrate` - use the parameters specified in the variable "baudrate," which we can see is set to 115200 (baud) in the above `printenv` output |
| 172 | |
| 173 | The strings that follow the semicolon after `$baudrate` differ a bit for the two variables. For the cfcard_bootcmd entry the `ext2load` commands specifies where to fetch the kernel, ramdisk, and device tree files from, respectively. The specific syntax for each `ext2load` command is: |
| 174 | |
| 175 | `ext2load [interface] [memory address] [path to file]` |
| 176 | |
| 177 | What is really important here (and for troubleshooting things) are the memory location values. For the cf card, the values should be: |
| 178 | * 0x1000000 for kernel image (uImage) |
| 179 | * 0x2000000 for filesystem (uInitrd2m) |
| 180 | * 0x400000 for the device tree (LB9A.dtb) |
187 | | `setenv` allows you to modify and create environment variables. In general: |
188 | | |
189 | | * `setenv [name]`, where [name] is new, creates a new variable with that name. |
190 | | * `setenv [name]`, where [name] already exists, wipes out its previous parameters. |
191 | | * `setenv [name] [parameters]` sets/overwrites parameters for the variable [name] with [parameters]. |
192 | | |
193 | | ''Long parameters.'' For variables with whitespaces in its parameters (e.g. "script variables" like flash_bootcmd), the parameters have to be surrounded by single quotes to let u-boot know that everything is part of a single script. For example, to create and configure the variable dn_boot, we'd type this at the command line: |
| 189 | `setenv` allows you to modify, create, and delete environment variables. In general: |
| 190 | |
| 191 | * `setenv [name] [parameters]`, where [name] is new, creates a new variable called [name] defined by parameters specified in [parameters]. |
| 192 | * `setenv [name]`, where [name] already exists, deletes the variable. |
| 193 | * `setenv [name] [parameters]` where [name] already exists, overwrites old parameters for the variable [name] with [parameters]. |
| 194 | |
| 195 | ''Long parameters.'' For variables with whitespaces in its parameters (e.g. "script variables" like flash_bootcmd), the parameters have to be surrounded by single quotes to let u-boot know that everything is part of a single script. For example, to create and configure the variable dn_boot (this script tells u-boot to fetch the filesystem via network using NFS and to boot from flash), we'd type this at the u-boot prompt: |
199 | | Note the single quotes before `dhcp` and after `ffee0000`. Another important thing about long parameters is that they cannot contain newlines; The whole command must be typed in a single line. |
200 | | |
201 | | === 3.3 Some important variables === |
202 | | |
203 | | * http://www.openflow.org/wk/index.php/IndigoConfiguration - !OpenFlow specific variables |
| 201 | Note the single quotes before `dhcp` and after `ffee0000`. Another important thing about long parameters is that they cannot contain newlines or backslashes; The whole command must be typed as a single line. |
| 202 | |
| 203 | === 3.3 boot parameters === |
| 204 | Most long variables are bootup scripts. By default, there are two bootup scripts on a Quanta: `cfcard_bootcmd` and `flash_bootcmd`. As you can see throughout these docs, a user can easily create new bootup scripts of any arbitrary name. |
| 205 | |
| 206 | A script called [name] can be run by invoking it with the `run` command. For example, to run `dn_boot`, you'd type |
| 207 | |
| 208 | `run dn_boot` |
| 209 | |
| 210 | at the u-boot prompt. This runs the command only once. In order to make a bootup script persist (e.g. be the default one that the switch boots to), you must set the variable `bootcmd` to the run command. The default script used in these switches is `cfcard_bootcmd`. You can see that in the `printenv` output. |
| 211 | |
| 212 | {{{ |
| 213 | => printenv |
| 214 | |
| 215 | ... |
| 216 | |
| 217 | bootcmd=run cfcard_bootcmd |
| 218 | }}} |
| 219 | |
| 220 | === 3.4 Flashing the switch/testing out images === |
| 221 | The `copy` command is the primary way to flash the switch with new firmware, as well as for updating u-boot itsself: |
| 222 | |
| 223 | {{{ |
| 224 | copy <-b/-k/-r/-d> <tftp://serverip/filename | xmodem> |
| 225 | <-b/-boot> boot image file |
| 226 | <-k/-kernel> kernel image file |
| 227 | <-r/-ramdidk> ramdisk image file |
| 228 | <-d/-dtb> Device Tree Binary file |
| 229 | }}} |
| 230 | |
| 231 | `copy` leverages TFTP in order to fetch files into the proper locations in flash memory. Memory locations and file type are implied through flags; as such, `copy` does not check for consistency between flag and file type of the file you specify. This makes it critical that you double-check the flags and filenames you give `copy`^3^. |
| 232 | |
| 233 | Firmware updates may also be done via NFS. Usages of both `copy` and bootup via NFS are covered in [#IV section IV]. |
| 234 | |
| 235 | Another tool to consider is the system shell, available from the CF card Linux image. For example, if you don't want to flash the new firmware, one can just add the images to /cf_card and point a u-boot script to the names of the new files: |
| 236 | |
| 237 | {{{ |
| 238 | cfboot=setenv bootargs root=/dev/ram console=ttyS0,$baudrate; ext2load ide 0:1 0x1000000 /uImage2;ext2load ide 0:1 0x2000000 /uInitrd2m2;ext2load ide 0:1 0x400000 /LB9A2.dtb;bootm 1000000 2000000 400000 |
| 239 | }}} |
| 240 | |
| 241 | `cfboot` can then be manually started with the command `run cfboot`, or be set as the default boot parameter by setting it as `bootcmd`'s parameter. |
206 | | |
| 244 | Mis-configurations in u-boot can cause various interesting^4^ issues including non-persistent configurations, hanging on bootup, and bricked switches. The first two are mildly annoying; the latter requires a JTAG cable and is serious enough an issue that everyone is discouraged from touching u-boot unless absolutely necessary. A Grid service is provided for manipulating the Quantas. |
| 245 | |
| 246 | === 3.4.1 Flash memory === |
| 247 | U-boot comes with tools such as `imls` and `flinfo` that allow you to inspect flash memory. Under normal circumstances, the memory map of the switch should look like below. Note the memory location and size of the ramdisk and kernel images. Any deviation can be a potential issue e.g the use of wrong firmware and wrongly copied files. |
| 248 | |
| 249 | {{{ |
| 250 | => imls |
| 251 | Image at FF000000: |
| 252 | Image Name: |
| 253 | Image Type: PowerPC Linux RAMDisk Image (gzip compressed) |
| 254 | Data Size: 12275941 Bytes = 11.7 MB |
| 255 | Load Address: 00000000 |
| 256 | Entry Point: 00000000 |
| 257 | Verifying Checksum ... OK |
| 258 | Image at FFD00000: |
| 259 | Image Name: Linux-2.6.27 |
| 260 | Image Type: PowerPC Linux Kernel Image (gzip compressed) |
| 261 | Data Size: 1742743 Bytes = 1.7 MB |
| 262 | Load Address: 00000000 |
| 263 | Entry Point: 00000000 |
| 264 | Verifying Checksum ... OK |
| 265 | }}} |
| 266 | |
| 267 | A more detailed memory map can be found with flinfo. The 'E' next to the octets indicate empty spots in memory, RO write protected spots. |
| 268 | |
| 269 | {{{ |
| 270 | => flinfo |
| 271 | |
| 272 | Bank # 1: CFI conformant FLASH (16 x 16) Size: 32 MB in 256 Sectors |
| 273 | AMD Standard command set, Manufacturer ID: 0x01, Device ID: 0x7E2201 |
| 274 | Erase timeout: 4096 ms, write timeout: 1 ms |
| 275 | Buffer write timeout: 3 ms, buffer size: 64 bytes |
| 276 | |
| 277 | Sector Start Addresses: |
| 278 | FE000000 FE020000 FE040000 FE060000 E FE080000 E |
| 279 | FE0A0000 E FE0C0000 E FE0E0000 E FE100000 E FE120000 E |
| 280 | FE140000 E FE160000 E FE180000 E FE1A0000 E FE1C0000 E |
| 281 | FE1E0000 E FE200000 E FE220000 E FE240000 E FE260000 E |
| 282 | FE280000 E FE2A0000 E FE2C0000 E FE2E0000 E FE300000 E |
| 283 | |
| 284 | ... |
| 285 | |
| 286 | FFE00000 FFE20000 FFE40000 FFE60000 FFE80000 |
| 287 | FFEA0000 FFEC0000 E FFEE0000 FFF00000 RO FFF20000 RO |
| 288 | FFF40000 E FFF60000 E FFF80000 E FFFA0000 E FFFC0000 RO |
| 289 | FFFE0000 |
| 290 | |
| 291 | }}} |
| 292 | |
| 293 | The output can be pretty big. It is also far less intuitive than `imls` (and often less useful). |
| 294 | |
| 295 | === 3.4.2 CF Card === |
| 296 | There are no means of inspecting the CF card from U-boot directly, maybe except from getting a glance of the memory map during (attempted) bootup. It should look like the following: |
| 297 | |
| 298 | {{{ |
| 299 | ## Booting image at 01000000 ... |
| 300 | Image Name: Linux-2.6.27-svn3877 |
| 301 | Image Type: PowerPC Linux Kernel Image (gzip compressed) |
| 302 | Data Size: 1711826 Bytes = 1.6 MB |
| 303 | Load Address: 00000000 |
| 304 | Entry Point: 00000000 |
| 305 | Verifying Checksum ... OK |
| 306 | Uncompressing Kernel Image ... OK |
| 307 | ## Loading RAMDisk Image at 02000000 ... |
| 308 | Image Name: svn3877 |
| 309 | Image Type: PowerPC Linux RAMDisk Image (gzip compressed) |
| 310 | Data Size: 20822821 Bytes = 19.9 MB |
| 311 | Load Address: 00000000 |
| 312 | Entry Point: 00000000 |
| 313 | Verifying Checksum ... OK |
| 314 | Booting using the fdt at 0x400000 |
| 315 | Loading Ramdisk to 1eae1000, end 1febcb25 ... OK |
| 316 | }}} |
| 317 | |
| 318 | If the switch can boot from the CF Card, choosing the system shell will give you access to a shell that will let you poke around the CF card. It should be mounted as the /cf_card directory. |
| 319 | |