Home uboot - 命令参考
Post
Cancel

uboot - 命令参考

commands help on xilinx-zynqMP(2022.1)

  • ? - alias for ‘help’
  • base - print or set address offset
  • bdinfo - print Board Info structure
  • bind - Bind a device to a driver
  • blkcache - block cache diagnostics and control
  • bmp - manipulate BMP image data
  • boot - boot default, i.e., run ‘bootcmd’
  • bootd - boot default, i.e., run ‘bootcmd’
  • bootefi - Boots an EFI payload from memory
  • bootelf - Boot from an ELF image in memory
  • booti - boot Linux kernel ‘Image’ format from memory
  • bootm - boot application image from memory
  • bootmenu - ANSI terminal bootmenu
  • bootp - boot image via network using BOOTP/TFTP protocol
  • bootvx - Boot vxWorks from an ELF image
  • button - manage buttons
  • chpart - change active partition of a MTD device
  • clk - CLK sub-system
  • cls - clear screen
  • cmp - memory compare
  • coninfo - print console devices and information
  • cp - memory copy
  • cpu - Multiprocessor CPU boot manipulation and release
  • crc32 - checksum calculation
  • date - get/set/reset date & time
  • dcache - enable or disable data cache
  • dfu - Device Firmware Upgrade
  • dhcp - boot image via network using DHCP/TFTP protocol
  • dm - Driver model low level access
  • echo - echo args to console
  • editenv - edit environment variable
  • efidebug - Configure UEFI environment
  • env - environment handling commands
  • erase - erase FLASH memory
  • exit - exit script
  • ext2load - load binary file from a Ext2 filesystem
  • ext2ls - list files in a directory (default /)
  • ext4load - load binary file from a Ext4 filesystem
  • ext4ls - list files in a directory (default /)
  • ext4size - determine a file’s size
  • ext4write - create a file in the root directory
  • false - do nothing, unsuccessfully
  • fastboot - run as a fastboot usb or udp device
  • fatinfo - print information about filesystem
  • fatload - load binary file from a dos filesystem
  • fatls - list files in a directory (default /)
  • fatmkdir - create a directory
  • fatrm - delete a file
  • fatsize - determine a file’s size
  • fatwrite - write file into a dos filesystem
  • fdt - flattened device tree utility commands
  • flinfo - print FLASH memory information
  • fpga - loadable FPGA image support
  • fru - FRU table info
  • fstype - Look up a filesystem type
  • fstypes - List supported filesystem types
  • gettime - get timer val elapsed
  • go - start application at address ‘addr’
  • gpio - query and control gpio pins
  • gpt - GUID Partition Table
  • gzwrite - unzip and write memory to block device
  • help - print command description/usage
  • i2c - I2C sub-system
  • icache - enable or disable instruction cache
  • iminfo - print header information for application image
  • imxtract - extract a part of a multi-image
  • itest - return true/false on integer compare
  • lcdputs - print string on video framebuffer
  • led - manage LEDs
  • ln - Create a symbolic link
  • load - load binary file from a filesystem
  • loadb - load binary file over serial line (kermit mode)
  • loads - load S-Record file over serial line
  • loadx - load binary file over serial line (xmodem mode)
  • loady - load binary file over serial line (ymodem mode)
  • loop - infinite loop on address range
  • ls - list files in a directory (default /)
  • lzmadec - lzma uncompress a memory region
  • md - memory display
  • mdio - MDIO utility commands
  • mii - MII utility commands
  • mm - memory modify (auto-incrementing address)
  • mmc - MMC sub system
  • mmcinfo - display MMC info
  • mtd - MTD utils
  • mtdparts - define flash/nand partitions
  • mtest - simple RAM read/write test
  • mw - memory write (fill)
  • nand - NAND sub-system
  • nboot - boot from NAND device
  • net - NET sub-system
  • nfs - boot image via network using NFS protocol
  • nm - memory modify (constant address)
  • panic - Panic with optional message
  • part - disk partition related commands
  • ping - send ICMP ECHO_REQUEST to network host
  • poweroff - Perform POWEROFF of the device
  • printenv - print environment variables
  • protect - enable or disable FLASH write protection
  • pwm - control pwm channels
  • pxe - commands to get and boot from pxe files
  • random - fill memory with random pattern
  • regulator - uclass operations
  • reset - Perform RESET of the CPU
  • rtc - RTC subsystem
  • run - run commands in an environment variable
  • save - save file to a filesystem
  • saveenv - save environment variables to persistent storage
  • scsi - SCSI sub-system
  • scsiboot - boot from SCSI device
  • setcurs - set cursor position within screen
  • setenv - set environment variables
  • setexpr - set environment variable as the result of eval expression
  • sf - SPI flash sub-system
  • sha1sum - compute SHA1 message digest
  • showvar - print local hushshell variables
  • size - determine a file’s size
  • sleep - delay execution for some time
  • source - run script from memory
  • sspi - SPI utility command
  • sysboot - command to get and boot from syslinux files
  • test - minimal test like /bin/sh
  • tftpboot- boot image via network using TFTP protocol
  • tftpput - TFTP put command, for uploading files to a server
  • thordown - TIZEN “THOR” downloader
  • time - run commands and summarize execution time
  • timer - access the system timer
  • tpm - Issue a TPMv1.x command
  • tpm2 - Issue a TPMv2.x command
  • true - do nothing, successfully
  • ubi - ubi commands
  • ubifsload - load file from an UBIFS filesystem
  • ubifsls - list files in a directory
  • ubifsmount - mount UBIFS volume
  • ubifsumount - unmount UBIFS volume
  • ums - Use the UMS [USB Mass Storage]
  • unbind - Unbind a device from a driver
  • unlz4 - lz4 uncompress a memory region
  • unzip - unzip a memory region
  • usb - USB sub-system
  • usbboot - boot from USB device
  • version - print monitor, compiler and linker version
  • zynqmp - ZynqMP sub-system

cmds help

cmd_help_part

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
ZynqMP> help part
part - disk partition related commands

Usage:
part uuid <interface> <dev>:<part>
    - print partition UUID
part uuid <interface> <dev>:<part> <varname>
    - set environment variable to partition UUID
part list <interface> <dev>
    - print a device's partition table
part list <interface> <dev> [flags] <varname>
    - set environment variable to the list of partitions
      flags can be -bootable (list only bootable partitions)
part start <interface> <dev> <part> <varname>
    - set environment variable to the start of the partition (in blocks)
      part can be either partition number or partition name
part size <interface> <dev> <part> <varname>
    - set environment variable to the size of the partition (in blocks)
      part can be either partition number or partition name
part number <interface> <dev> <part> <varname>
    - set environment variable to the partition number using the partition name
      part must be specified as partition name
part types
    - list supported partition table types

cmd_help_env

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
ZynqMP> help env
env - environment handling commands

Usage:
env default [-f] -a - [forcibly] reset default environment
env default [-f] var [...] - [forcibly] reset variable(s) to their default values
env delete [-f] var [...] - [forcibly] delete variable(s)
env edit name - edit environment variable
env exists name - tests for existence of variable
env export [-t | -b | -c] [-s size] addr [var ...] - export environment
env import [-d] [-t [-r] | -b | -c] addr [size] [var ...] - import environment
env print [-a | name ...] - print environment
env print -e [-guid guid] [-n] [name ...] - print UEFI environment
env run var [...] - run commands in an environment variable
env save - save environment
env set -e [-nv][-bs][-rt][-at][-a][-i addr:size][-v] name [arg ...]
    - set UEFI variable; unset if '-i' or 'arg' not specified
env set [-f] name [arg ...]

cmd_help_setenv

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
ZynqMP> help setenv
setenv - set environment variables

Usage:
setenv -e [-guid guid][-nv][-bs][-rt][-at][-a][-v]
        [-i addr:size name], or [name [value ...]]
    - set UEFI variable 'name' to 'value' ...'
      "-guid": GUID xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
      "-nv": set non-volatile attribute
      "-bs": set boot-service attribute
      "-rt": set runtime attribute
      "-at": set time-based authentication attribute
      "-a": append-write
      "-i addr,size": use <addr,size> as variable's value
      "-v": verbose message
    - delete UEFI variable 'name' if 'value' not specified
setenv [-f] name value ...
    - [forcibly] set environment variable 'name' to 'value ...'
setenv [-f] name
    - [forcibly] delete environment variable 'name'

cmd_help_fstype

1
2
3
4
5
6
7
8
ZynqMP> help fstype
fstype - Look up a filesystem type

Usage:
fstype <interface> <dev>:<part>
- print filesystem type
fstype <interface> <dev>:<part> <varname>
- set environment variable to filesystem type

cmd_help_sysboot

1
2
3
4
5
6
7
ZynqMP> help sysboot
sysboot - command to get and boot from syslinux files

Usage:
sysboot [-p] <interface> <dev[:part]> <ext2|fat|any> [addr] [filename]
    - load and parse syslinux menu file 'filename' from ext2, fat
      or any filesystem on 'dev' on 'interface' to address 'addr'

cmd_help_load

1
2
3
4
5
6
7
8
9
10
11
ZynqMP> help load
load - load binary file from a filesystem

Usage:
load <interface> [<dev[:part]> [<addr> [<filename> [bytes [pos]]]]]
    - Load binary file 'filename' from partition 'part' on device
       type 'interface' instance 'dev' to address 'addr' in memory.
      'bytes' gives the size to load in bytes.
      If 'bytes' is 0 or omitted, the file is read until the end.
      'pos' gives the file byte position to start reading from.
      If 'pos' is 0 or omitted, the file is read from the start.

cmd_help_source

1
2
3
4
5
6
7
8
9
ZynqMP> help source
source - run script from memory

Usage:
source [addr]
	- run script starting at addr
	- A valid image header must be present
For FIT format uImage addr must include subimage
unit name in the form of addr:<subimg_uname>

cmd_help_booti

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
ZynqMP> help booti
booti - boot Linux kernel 'Image' format from memory

Usage:
booti [addr [initrd[:size]] [fdt]]
    - boot Linux flat or compressed 'Image' stored at 'addr'
	The argument 'initrd' is optional and specifies the address
	of an initrd in memory. The optional parameter ':size' allows
	specifying the size of a RAW initrd.
	Currently only booting from gz, bz2, lzma and lz4 compression
	types are supported. In order to boot from any of these compressed
	images, user have to set kernel_comp_addr_r and kernel_comp_size environment
	variables beforehand.
	Since booting a Linux kernel requires a flat device-tree, a
	third argument providing the address of the device-tree blob
	is required. To boot a kernel with a device-tree blob but
	without an initrd image, use a '-' for the initrd argument.

cmd_help_bootm

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
ZynqMP> help bootm
bootm - boot application image from memory

Usage:
bootm [addr [arg ...]]
    - boot application image stored in memory
	passing arguments 'arg ...'; when booting a Linux kernel,
	'arg' can be the address of an initrd image
	When booting a Linux kernel which requires a flat device-tree
	a third argument is required which is the address of the
	device-tree blob. To boot that kernel without an initrd image,
	use a '-' for the second argument. If you do not pass a third
	a bd_info struct will be passed instead
	
For the new multi component uImage format (FIT) addresses
	must be extended to include component or configuration unit name:
	addr:<subimg_uname> - direct component image specification
	addr#<conf_uname>   - configuration specification
	Use iminfo command to get the list of existing component
	images and configurations.

Sub-commands to do part of the bootm sequence.  The sub-commands must be
issued in the order below (it's ok to not issue all sub-commands):
	start [addr [arg ...]]
	loados  - load OS image
	ramdisk - relocate initrd, set env initrd_start/initrd_end
	fdt     - relocate flat device tree
	cmdline - OS specific command line processing/setup
	bdt     - OS specific bd_info processing
	prep    - OS specific prep before relocation or go
	go      - start OS

about uboot-Fit image:
https://www.gibbard.me/linux_fit_images/
https://doc.coreboot.org/lib/payloads/fit.html
https://www.thegoodpenguin.co.uk/blog/u-boot-fit-image-overview/
https://www.marcusfolkesson.se/blog/fit-vs-legacy-image-format/

cmd_help_fatxxxx

fat文件系统的相关命令集,目前一共包括

  • fatinfo - print information about filesystem
  • fatload - load binary file from a dos filesystem
  • fatls - list files in a directory (default /)
  • fatmkdir - create a directory
  • fatrm - delete a file
  • fatsize - determine a file’s size
  • fatwrite - write file into a dos filesystem

一般interface就是mmc ,dev是从0开始的,0,1,2,3… ,part是从1开始的,这点要记得,其实和分区号一样,没有第0分区。
常用的应该是 fatinfo , fatls , fatload

fatinfo:click here
fatls:click here
fatmkdir:click here
fatrm:click here
fatsize:click here
fatload:click here
fatwrite:click here

fatcmds_fatinfo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
ZynqMP> help fatinfo
fatinfo - print information about filesystem

Usage:
fatinfo <interface> [<dev[:part]>]
    - print information about filesystem from 'dev' on 'interface'

ex:
ZynqMP> fatinfo mmc 0:1
Interface:  mmc
  Device 0: Vendor: Man 0000ad Snr c243ea01 Rev: 0.7 Prod: USD00 
            Type: Removable Hard Disk
            Capacity: 15096.0 MB = 14.7 GB (30916608 x 512)
Filesystem: FAT32 "NO NAME    "

fatcmds_fatload

1
2
3
4
5
6
7
8
9
10
11
12
13
14
ZynqMP> help fatload
fatload - load binary file from a dos filesystem

Usage:
fatload <interface> [<dev[:part]> [<addr> [<filename> [bytes [pos]]]]]
    - Load binary file 'filename' from 'dev' on 'interface'
      to address 'addr' from dos filesystem.
      'pos' gives the file position to start loading from.
      If 'pos' is omitted, 0 is used. 'pos' requires 'bytes'.
      'bytes' gives the size to load. If 'bytes' is 0 or omitted,
      the load stops on end of file.
      If either 'pos' or 'bytes' are not aligned to
      ARCH_DMA_MINALIGN then a misaligned buffer warning will
      be printed and performance will suffer for the load.

fatcmds_fatls

1
2
3
4
5
6
7
8
9
10
11
12
13
14
ZynqMP> help fatls
fatls - list files in a directory (default /)

Usage:
fatls <interface> [<dev[:part]>] [directory]
    - list files from 'dev' on 'interface' in a 'directory'

ex:
ZynqMP> fatls mmc 0:1 /
  1737616   BOOT.BIN
  9310352   image.ub
     2777   boot.scr

3 file(s), 0 dir(s)

fatcmds_fatmkdir

1
2
3
4
5
6
ZynqMP> help fatmkdir
fatmkdir - create a directory

Usage:
fatmkdir <interface> [<dev[:part]>] <directory>
    - create a directory in 'dev' on 'interface'

fatcmds_fatrm

1
2
3
4
5
6
ZynqMP> help fatrm   
fatrm - delete a file

Usage:
fatrm <interface> [<dev[:part]>] <filename>
    - delete a file from 'dev' on 'interface'

fatcmds_fatsize

1
2
3
4
5
6
7
ZynqMP> help fatsize
fatsize - determine a file's size

Usage:
fatsize <interface> <dev[:part]> <filename>
    - Find file 'filename' from 'dev' on 'interface'
      and determine its size.

fatcmds_fatwrite

1
2
3
4
5
6
7
ZynqMP> help fatwrite
fatwrite - write file into a dos filesystem

Usage:
fatwrite <interface> <dev[:part]> <addr> <filename> [<bytes> [<offset>]]
    - write file 'filename' from the address 'addr' in RAM
      to 'dev' on 'interface'

cmd_help_sf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
ZynqMP> help sf
sf - SPI flash sub-system

Usage:
sf probe [[bus:]cs] [hz] [mode]	- init flash device on given SPI bus
				  and chip select
sf read addr offset|partition len	- read `len' bytes starting at
				          `offset' or from start of mtd
					  `partition'to memory at `addr'
sf write addr offset|partition len	- write `len' bytes from memory
				          at `addr' to flash at `offset'
					  or to start of mtd `partition'
sf erase offset|partition [+]len	- erase `len' bytes from `offset'
					  or from start of mtd `partition'
					 `+len' round up `len' to block size
sf update addr offset|partition len	- erase and write `len' bytes from memory
					  at `addr' to flash at `offset'
					  or to start of mtd `partition'
sf protect lock/unlock sector len	- protect/unprotect 'len' bytes starting
					  at address 'sector'

sf test offset len		- run a very basic destructive test
ex:
ZynqMP> sf probe 0
SF: Detected mt25qu512a with page size 256 Bytes, erase size 64 KiB, total 64 MiB
ZynqMP> sf probe 0:0
SF: Detected mt25qu512a with page size 256 Bytes, erase size 64 KiB, total 64 MiB

cmd_help_net

1
2
3
4
5
6
7
8
ZynqMP> help net
net - NET sub-system

Usage:
net list - list available devices

ZynqMP> net list
eth0 : ethernet@ff0e0000 e2:f7:0c:85:ee:d7 active

cmd_help_tftpboot

1
2
3
4
5
6
7
8
ZynqMP> help tftpboot
tftpboot - boot image via network using TFTP protocol

Usage:
tftpboot [loadAddress] [[hostIPaddr:]bootfilename]

//该命令仅是从host上下载文件到addr,并不会有后序动作,启动需要后续自己执行bootm/booti 相关命令
//需要设置好uboot的板子的ip,dhcp or static ,能访问到host的tftp服务。
This post is licensed under CC BY 4.0 by the author.