Appendix A

U-boot Commands

Das u-boot supports an extensive command set. This section describes the most useful of those commands. Because u-boot is highly configurable, not all commands are necessarily in any given implementation. The behavior of some commands is also configuration-dependent, and may depend on environment variable values.

All u-boot commands expect numbers to be entered in hexadecimal, with or without the leading 0x. In the following descriptions, arguments are bracketed by <>. Optional arguments are further bracketed by []. Command names can generally be abbreviated to the shortest unique string, shown in parentheses.

Information Commands

bdinfo (bdi)—Displays information about the target board such as memory sizes and locations, clock frequencies, MAC address, etc. This information is available to the Linux kernel.

coninfo (conin)—Displays information about the available console I/O devices. It shows the device name, flags, and the current usage.

iminfo <start addr> (imi)—Displays header information for images such as Linux kernels or ramdisks. It lists the image name, type, and size, and verifies the CRC32 checksum. iminfo takes an argument that is the starting address of the image. The behavior of ininfo is influenced by the verify environment variable.

help [<command name>]—Self-explanatory. Without an argument it prints a short description of all commands. With a command name argument it provides more detailed help.

Memory Commands

By default, the memory commands operate on 32-bit integers. They can be made to operate on 16-bit words or 8-bit bytes by appending “.w” (for 16 bits) or “.b” (for 8 bits) to the command name. There is also a “.l” suffix to explicitly specify 32 bits. Example: cmp.w 1000 2000 20 compares 32 (20 hex) words at addresses 0x1000 and 0x2000.

base [<offset>] (ba)—Get or set a base address to be used as an offset for all other memory commands. With no argument it displays the current base, default is 0. A numeric argument becomes the new base. This is useful for repeated accesses to a specific section of memory.

crc32 <start addr> <length> [<store addr>] (crc)—Computes and displays a 32-bit checksum over <length> bytes, starting at <start addr>. The optional third argument specifies a location to store the checksum.

cmp <addr1> <addr2> <count>—Compares two regions of memory. <count> is the number of data items independent of the specified size, byte, word, or long.

cp <source> <dest> <count>—Copies a range of memory to another location. <count> is the number of items copied.

md <addr> [<count>]—Memory display. Displays a range of memory in both hex and ASCII. The optional <count> argument defaults to 64 items. md remembers the most recent <addr> and <count>, so that if it is entered without an address argument, it continues from where it left off.

mm <start addr>—Modify memory with autoincrement. Displays the address and current contents of an item, and prompts for user input. A valid hexadecimal value replaces the current value and the command displays the next item. This continues as long as you enter valid hex values. To terminate the command, enter a non-hex value.

mtest <start addr> <end addr> [<pattern>]—Simple read/write RAM test. This test modifies RAM and may crash the system if it touches areas used by u-boot, such as the stack or heap.

mw <addr> <value> [<count>]—Writes <value> to a range of memory starting at <addr>. The optional <count> defaults to 1.

nm <addr>—Modify memory at a constant address (no autoincrement). Interactively writes valid hex data to the same address. This is useful for accessing I/O device registers. Terminate the command with a non-hex input.

loop <addr> <count>—Reads memory in a tight loop. This can be useful for scoping. This command never terminates! The only way out is to reset the board.

NAND Flash Memory Commands

NAND flash is organized into arbitrary sized named partitions. All NAND commands are prefixed by the keyword nand. The BeagleBone Black u-boot implements the NAND commands, even though there is no NAND device installed.

nand info—Show available NAND devices.

mtdparts—List NAND partitions.

nand erase [clean] [<offset> <size>]—Erase <size> bytes starting at <offset>. If <offset> not specified, erase entire chip.

nand scrubReally erase the entire chip, including bad blocks. Considered “unsafe.”

nand createbbt—Create bad block table.

nand bad—List bad blocks.

nand read[.raw] <address> <offset> | <partition> <size> − Read <size> bytes from flash, either from numerical <offset> or <partition> name into RAM at <address>. The .raw modifier bypasses ECC to access the flash as is.

nand write[.raw] <address> <offset> | <partition> <size> − Write <size> bytes from <address> in RAM to flash either at numerical <offset> or <partition> name. The .raw modifier bypasses ECC to access the flash as is.

Execution Control Commands

boot—Boot default, that is run bootcmd.

bootd − Boot default, that is run bootcmd.

bootm <addr> [<param> …]—Boots an image such as an operating system from memory. The image header, starting at <addr>, contains the necessary information about the operating system type, compression, if any, load, and entry point addresses. <param> is one or more optional parameters passed to the OS. The OS image is copied into RAM and uncompressed if necessary. Then control is transferred to the entry point address. For Linux, two optional parameters are recognized: the address of an initrd RAM disk image, and the image of a flattened device tree (FDT) blob. To boot a kernel with a FDT but no initrd, pass the second argument as “-”.

Note, incidentally, that images can be booted from RAM, having been downloaded, for example, with TFTP. In this case, be careful that the compressed image does not overlap the memory area used by the uncompressed image.

bootz <addr> [initrd[:size]] [fdt]—Boots a Linux zImage stored in memory at <addr>. <initrd> is the address of an initrd image of <size> bytes. <fdt> is the address of a flattened device tree blob. To boot a kernel with a FDT but no initrd, pass the second argument as “-”.

go <addr> [<param> …]—Transfers control to a “stand-alone” application starting at <addr> and passing the optional parameters. These are programs that do not require the complex environment of an operating system.

Download Commands

Three commands are available to boot images over the network using TFTP. Two of them also obtain an IP address before executing the file download.

bootp <load_addr> [<filename>]—Obtain an IP address using the bootp protocol, then download <filename> to <load_addr>. If <filename> is not given, the value of bootfile will be used.

nfs <load_addr> [<filename>] [[<hostIPaddr>:]<filename>]—Boot an image over the network using the NFS protocol. If <hostIPaddr> is not given, the value of serverip is used. If <filename> is not given, the value of bootfile will be used.

tftpboot <load_addr> <filename> (tftp)—Just download the file. Assumes client already has an IP address, either statically assigned or obtained through DHCP.

dhcp—Get an IP address using DHCP.

It is also possible to download files using a serial line. The recommended terminal emulator for serial image download is kermit, as some users have reported problems using minicom for image download.

loadb <offset>—Accept a binary image download to address <offset> over the serial port. Start this command in u-boot, then initiate the transmission on the host side.

loads <offset>—Accept an S-record file download to address <offset> over the serial port.

Environment Variable Commands

printenv [<name> …]—Prints the value of one or more environment variables. With no argument, printenv lists all environment variables. Otherwise, it lists the value(s) of the specified variable(s).

setenv <name> [<value>]—With one argument, setenv removes the specified variable from u-boot’s environment and reclaims the storage. With two arguments it sets variable <name> to <value>. These changes take place in RAM only. Warning: use a space between <name> and <value>, not “=”. The latter will be interpreted literally with rather strange results.

Standard shell quoting rules apply when a value contains characters with special meaning to the command line parser, such as “$” for variable substitution and “;” for command separation. These characters are “escaped” with a back slash, “”. Example:

setenv netboot tftp 21000000 uImage; bootm

saveenv—Writes the environment to persistent storage.

run <name> […]—Treats the value of environment variable <name> as one or more u-boot commands and executes them. If more than one variable is specified, they are executed in order.

bootd (boot)—A synonym for run bootcmd to execute the default boot command.

Environment Variables

The u-boot environment is kept in persistent storage and copied to RAM when u-boot starts. It stores environment variables used to configure the system. The environment is protected by a CRC32 checksum. This section lists some of the environment variables that u-boot recognizes.

The variables shown here serve specific purposes in the context of u-boot and, for the most part, will not be used explicitly. When needed, u-boot environment variables are used explicitly in commands, much the same way that they are in shell scripts and makefiles, by enclosing them in $().

autoload—If set to “no”, or any string beginning with “n”, the rarp and bootp commands will only get configuration information and not try to download an image using TFTP.

autostart—If set to “yes”, an image loaded using the rarpb, bootp, or tftp commands will be automatically started by internally calling the bootm command.

baudrate—A decimal number that specifies the bit rate for the console serial port. Only a predefined list of baudrate settings is available. Following the setenv baudrate <n> command, u-boot expects to receive a newline character at the new rate before actually committing the new rate. If this fails, the board must be reset and reverts to the old baud rate.

bootargs—The value of this variable is passed to the Linux kernel as boot arguments, i.e., the “command line.”

bootcmd—Defines a command string that is automatically executed when the initial countdown is not interrupted, but only if the variable bootdelay is also defined with a non-negative value.

bootdelay—Wait this many seconds before executing the contents of the bootcmd variable. The delay can be interrupted by pressing any key before the bootcmd sequence starts. Warning: setting bootdelay to 0 executes bootcmd immediately, and effectively disables any interaction with u-boot. On the other hand, setting this variable to −1 disables auto boot.

bootfile—Name of the default image to be loaded by any of the download commands.

ethaddr—MAC address for the first or only Ethernet interface on the board, known to Linux as eth0. A MAC address is 48 bits, represented as six pairs of hex digits separated by dots.

eth1addr, eth2addr—MAC addresses for the second and third Ethernet interfaces when present.

ipaddr—Set an IP address on the target board for TFTP downloading.

loadaddr—Default buffer address in RAM for commands like tftpboot, loads, and bootm. Note: it appears, but does not seem to be documented, that there is a default load address, 0x82000000, built into the code.

serverip—IP address of the TFTP or NFS server used by the tftpboot and nfs commands.

serial#—A string containing hardware identification such as type, serial number, etc. This variable can only be set once, often during manufacturing of the board. U-boot refuses to delete or overwrite this variable once it has been set.

verify—If set to “n” or “no”, disables the checksum calculation over the complete image in the bootm command to trade speed for safety in the boot process. The header checksum is still verified.

The following environment variables can be automatically updated by the network boot commands (bootp, dhcp, or tftp) depending on the information provided by your boot server:

bootfile—See above

dnsip—IP address of your Domain Name Server

gatewayip—IP address of the Gateway (Router)

hostname—Target host name

ipaddr—See above

netmask—Subnet mask

rootpath—Path to the root filesystem on the NFS server

serverip—See above

filesize—Size in bytes, as a hex string, of the file downloaded using the last bootp, nfs, or tftp command.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.233.41