uboot常见的命令

作者 by adtxl / 2022-03-16 / 暂无评论 / 381 个足迹

记录几个遇到的uboot命令

1. mmc

mmc - MMC sub system

Usage:
mmc info - display info of the current MMC device
mmc read addr blk# cnt
mmc write addr blk# cnt
mmc erase blk# cnt
mmc rescan
mmc part - lists available partition on current mmc device
mmc dev [dev] [part] - show or set current mmc device [partition]
mmc list - lists available devices
mmc wp - power on write protect boot partitions
mmc hwpartition [args...] - does hardware partitioning
  arguments (sizes in 512-byte blocks):
    [user [enh start cnt] [wrrel {on|off}]] - sets user data area attributes
    [gp1|gp2|gp3|gp4 cnt [enh] [wrrel {on|off}]] - general purpose partition
    [check|set|complete] - mode, complete set partitioning completed
  WARNING: Partitioning is a write-once setting once it is set to complete.
  Power cycling is required to initialize partitions after set to complete.
mmc bootbus dev boot_bus_width reset_boot_bus_width boot_mode
 - Set the BOOT_BUS_WIDTH field of the specified device
mmc bootpart-resize <dev> <boot part size MB> <RPMB part size MB>
 - Change sizes of boot and RPMB partitions of specified device
mmc partconf dev [boot_ack boot_partition partition_access]
 - Show or change the bits of the PARTITION_CONFIG field of the specified device
mmc rst-function dev value
 - Change the RST_n_FUNCTION field of the specified device
   WARNING: This is a write-once field and 0 / 1 / 2 are the only valid values.
mmc rpmb read addr blk# cnt [address of auth-key] - block size is 256 bytes
mmc rpmb write addr blk# cnt <address of auth-key> - block size is 256 bytes
mmc rpmb key <address of auth-key> - program the RPMB authentication key.
mmc rpmb counter - read the value of the write counter
mmc setdsr <value> - set DSR register value

2. fdt

fdt - flattened device tree utility commands

Usage:
fdt addr [-c]  <addr> [<length>]   - Set the [control] fdt location to <addr>
fdt apply <addr>                    - Apply overlay to the DT
fdt boardsetup                      - Do board-specific set up
fdt move   <fdt> <newaddr> <length> - Copy the fdt to <addr> and make it active
fdt resize [<extrasize>]            - Resize fdt to size + padding to 4k addr + some optional <extrasize> if needed
fdt print  <path> [<prop>]          - Recursive print starting at <path>
fdt list   <path> [<prop>]          - Print one level starting at <path>
fdt get value <var> <path> <prop>   - Get <property> and store in <var>
fdt get name <var> <path> <index>   - Get name of node <index> and store in <var>
fdt get addr <var> <path> <prop>    - Get start address of <property> and store in <var>
fdt get size <var> <path> [<prop>]  - Get size of [<property>] or num nodes and store in <var>
fdt set    <path> <prop> [<val>]    - Set <property> [to <val>]
fdt mknode <path> <node>            - Create a new node after <path>
fdt rm     <path> [<prop>]          - Delete the node or <property>
fdt header [get <var> <member>]     - Display header info
                                      get - get header member <member> and store it in <var>
fdt bootcpu <id>                    - Set boot cpuid
fdt memory <addr> <size>            - Add/Update memory node
fdt rsvmem print                    - Show current mem reserves
fdt rsvmem add <addr> <size>        - Add a mem reserve
fdt rsvmem delete <index>           - Delete a mem reserves
fdt chosen [<start> <end>]          - Add/update the /chosen branch in the tree
                                        <start>/<end> - initrd start/end addr
NOTE: Dereference aliases by omitting the leading '/', e.g. fdt print ethernet0.

3. adtimg

adtimg - manipulate dtb/dtbo Android image

Usage:
adtimg addr <addr> - Set image location to <addr>
adtimg dump        - Print out image contents
adtimg get dt --index=<index> [avar [svar]]         - Get DT address/size by index

Legend:
  - <addr>: DTB/DTBO image address (hex) in RAM
  - <index>: index (hex/dec) of desired DT in the image
  - <avar>: variable name to contain DT address (hex)
  - <svar>: variable name to contain DT size (hex)

4. abootimg

abootimg - manipulate Android Boot Image

Usage:
abootimg addr <addr>
    - set the address in RAM where boot image is located
      ($loadaddr is used by default)
abootimg dump dtb
    - print info for all DT blobs in DTB area
abootimg get ver [varname]
    - get header version
abootimg get recovery_dtbo [addr_var [size_var]]
    - get address and size (hex) of recovery DTBO area in the image
      [addr_var]: variable name to contain DTBO area address
      [size_var]: variable name to contain DTBO area size
abootimg get dtb_load_addr [varname]
    - get load address (hex) of DTB, from image header
abootimg get dtb --index=<num> [addr_var [size_var]]
    - get address and size (hex) of DT blob in the image by index
      <num>: index number of desired DT blob in DTB area
      [addr_var]: variable name to contain DT blob address
      [size_var]: variable name to contain DT blob size

独特见解