uboot命令

以下uboot命令是u-boot-2010.12版本

  • 查看命令的使用方式:help 或者 ?
    格式:
    help <想要查看的命令>
    ? <想要查看的命令>
    注: 有些命令甚至不可以不用写全,用命令的缩写也可以

不带参数显示所有命令:

# help
? - alias for ‘help’
base - print or set address offset
bdinfo - print Board Info structure
boot - boot default, i.e., run ‘bootcmd’
bootd - boot default, i.e., run ‘bootcmd’
bootelf - Boot from an ELF image in memory
bootm - boot application image from memory
bootp - boot image via network using BOOTP/TFTP protocol
bootvx - Boot vxWorks from an ELF image
chpart - change active partition
cmp - memory compare
coninfo - print console devices and information
cp - memory copy
crc32 - checksum calculation
dcache - enable or disable data cache
dnw - dnw - initialize USB device and ready to receive for Windows server (specific)
echo - echo args to console
editenv - edit environment variable
emmc - Open/Close eMMC boot Partition
env - environment handling commands
exit - exit script
ext2format- ext2format - disk format by ext2
ext2load- load binary file from a Ext2 filesystem
ext2ls - list files in a directory (default /)
ext3format- ext3format - disk format by ext3
false - do nothing, unsuccessfully
fastboot- fastboot- use USB Fastboot protocol
fatformat- fatformat - disk format by FAT32
fatinfo - fatinfo - print information about filesystem
fatload - fatload - load binary file from a dos filesystem
fatls - list files in a directory (default /)
fdisk - fdisk for sd/mmc.
go - start application at address ‘addr’
help - print command description/usage
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
loadb - load binary file over serial line (kermit mode)
loads - load S-Record file over serial line
loady - load binary file over serial line (ymodem mode)
loop - infinite loop on address range
md - memory display
mm - memory modify (auto-incrementing address)
mmc - MMC sub system
mmcinfo - mmcinfo – display MMC info
movi - movi - sd/mmc r/w sub system for SMDK board
mtdparts- define flash/nand partitions
mtest - simple RAM read/write test
mw - memory write (fill)
nfs - boot image via network using NFS protocol
nm - memory modify (constant address)
ping - send ICMP ECHO_REQUEST to network host
printenv- print environment variables
reginfo - print register information
reset - Perform RESET of the CPU
run - run commands in an environment variable
saveenv - save environment variables to persistent storage
setenv - set environment variables
showvar - print local hushshell variables
sleep - delay execution for some time
source - run script from memory
test - minimal test like /bin/sh
tftpboot- boot image via network using TFTP protocol
true - do nothing, successfully
usb - USB sub-system
version - print monitor version

  • 打印环境变量 printenv
    格式:printenv <要打印的环境变量>
    注:不带参数打印所有环境变量

# printenv
baudrate=115200
bootargs=root=/dev/nfs nfsroot=192.168.10.8:/tiny4412/rootfs ip=192.168.10.18:192.168.10.8:192.168.10.50:255.255.255.0::eth0:off init=/linuxrc console=ttySAC0,115200 lcd=s70 coherent_pool=2M
bootcmd=movi read kernel 0 40008000;movi read rootfs 0 41000000 100000;bootm 40008000 41000000
bootdelay=3
ethaddr=00:40:5c:26:0a:5b
netmask=255.255.255.0

# printenv bootargs
bootargs=root=/dev/nfs nfsroot=192.168.10.8:/tiny4412/rootfs ip=192.168.10.18:192.168.10.8:192.168.10.50:255.255.255.0::eth0:off init=/linuxrc console=ttySAC0,115200 lcd=s70 coherent_pool=2M

  • 设置环境变量

# ? setenv
    setenv - set environment variables

Usage:
setenv name value …
    - set environment variable ‘name’ to ‘value …’
setenv name
    - delete environment variable ‘name’

# setenv testsetenv root=/dev/nfs home=/home/youhome
# printenv testsetenv
  testsetenv=root=/dev/nfs home=/home/youhome

  • 保存环境变量命令 saveenv

    (设置环境变量后要保存,不然下次开机就没了)

  • 设置bootargs参数

    root参数:指定根文件系统的位置. 有多种情况
    root=/dev/ram rw
    root=/dev/ram0 rw
    root=/dev/mtdX rw
    root=/dev/mtdblockX rw
    root=主设备号:次设备号
    root=/dev/nfs(网络文件系统)

    rootfstype参数:指定根文件系统类型(ext2、ext3、jffs2、squanshfs等)

    nfsroot参数:指定网络文件系统所在的主机和目录
    nfsroot=主机IP:目录

    console参数:使用的终端,波特率等
    console=tty
    console=ttyS
    console=ttySAC0(设置终端为串口0)

    init参数:指定内核起来后,系统运行的第一个脚本,通常是
    init=/linuxrc

    ip参数:指定系统起来后网卡的IP地址,如果是网络文件系统(nfs)则一定要有这个参数,通常有两种形式
    ip=本地ip
    ip=本地ip:nfs-ip:网关ip:netmask::哪张本地网卡:off

    coherent_pool参数:设置DMA的大小
    coherent_pool=4M

    例本地挂载:set bootargs root=/dev/mmcblk0p2 rootfstype=ext3 init=/linuxrc console=ttySAC0,115200

    nfs网络挂载:set bootargs root=/dev/nfs nfsroot=192.168.10.8:/tiny4412/rootfs ip=192.168.10.18:192.168.10.8:192.168.10.50:255.255.255.0::eth0:off init=/linuxrc console=ttySAC0,115200 lcd=s70 coherent_pool=2M

  • 复位命令 reset(重启)

  • 打印板子信息 bdinfo

  • 内存显示 md

    # help md
        md - memory display
      Usage:
        md [.b, .w, .l] address [# of objects](b字节,w字,d双字)
    格式:md.b <要显示的地址> [显示的个数]

  • 内存复制 cp

    # help cp
      cp - memory copy
    Usage:
        cp [.b, .w, .l] source target count
    格式:cp <原地址> <目的地址> <拷贝个数>

  • 显示mmc信息 mmcinfo
    mmcinfo <dev num>   – display MMC info

# mmcinfo 0
Device: S3C_HSMMC2
Manufacturer ID: 2
OEM: 544d
Name: SA08G
Tran Speed: 0
Rd Block Len: 512
SD version 2.0
High Capacity: Yes
Size: 7420MB (block: 15196160)
Bus Width: 4-bit
Boot Partition Size: 0 KB

  • mmc子系统

    # help mmc
    mmc - MMC sub system
    Usage:
    mmc read <device num> addr blk# cnt (从mmc指定扇区读取数据到ddr中addr开始的地址中)

    mmc write <device num> addr blk# cnt(把ddr中addr开始的地址写到mmc指定的扇区中)

    mc rescan <device num>

    mmc erase <boot | user> <device num> <start block> <block count>
    mmc list - lists available devices

    参数说明:
    boot:启动分区,一般操作 bl1,bl2,uboot的mmc扇区范围。
    user:用户分区,一般操作内核,文件系统的mmc扇区范围。
    注:命令中的参数都是16进制的

  • 查看mmc分区信息 fatinfo

    # ? fatinfo
    fatinfo - fatinfo - print information about filesystem
    Usage:
    fatinfo <interface> <dev[:part]>
      - print information about filesystem from ‘dev’ on ‘interface’

    参数说明:
    interface:mmc 或 sub
    dev:设备编号
    part:分区号

  • 列出指定目录下的文件 fatls

    # help fatls
    fatls - list files in a directory (default /)
    Usage:
    fatls <interface> <dev[:part]> [directory]
      - list files from ‘dev’ on ‘interface’ in a ‘directory’

  • 从文件系统加载文件到DDR

    # help fatload
    fatload - fatload - load binary file from a dos filesystem
    Usage:
    fatload <interface> <dev[:part]> <addr> <filename>[bytes]
      - load binary file ‘filename’ from ‘dev’ on ‘interface’ to address ‘addr’ from dos filesystem

    参数说明:
    interface:mmc 或 usb
    dev:设备编号
    part:分区编号
    addr:DDR内存地址
    filename:文件路径
    bytes:要加载的数据大小

  • 内存比较 cmp

    # ? cmp
    cmp - memory compare
    Usage:
    cmp [.b, .w, .l] addr1 addr2 count

  • 内存内容修改 mm

    # ? mm
    mm - memory modify (auto-incrementing address)
    Usage:
    mm [.b, .w, .l] address

  • 使用串口下载二进制文件到内存
    uboot支持的模式:
    loadb - load binary file over serial line (kermit mode)
    loads - load S-Record file over serial line
    loady - load binary file over serial line (ymodem mode)

    # ? loady
    loady - load binary file over serial line (ymodem mode)
    Usage:
    loady [ off ] [ baud ]
      - load binary file over serial line with offset ‘off’ and baudrate ‘baud’

    参数说明:
    off:DDR内存地址
    baud:使用的波特率

  • 打开关闭emmc启动分区

    # help emmc
    emmc - Open/Close eMMC boot Partition
    Usage:
    emmc open <device num>
    emmc close <device num>
    对设备读写操作,需要先打开,读写完毕,再关闭。

  • movi 子系统

    # help movi
    movi - movi - sd/mmc r/w sub system for SMDK board
    Usage:
    movi init - Initialize moviNAND and show card info
    movi read zero {fwbl1 | u-boot} {device_number} {addr} - Read data from sd/mmc
    movi write zero {fwbl1 | u-boot} {device_number} {addr} - Write data to sd/mmc
    movi read {u-boot | kernel} {device_number} {addr} - Read data from sd/mmc
    movi write {fwbl1 | u-boot | kernel} {device_number} {addr} - Write data to sd/mmc
    movi read rootfs {device_number} {addr} [bytes(hex)] - Read rootfs data from sd/mmc by size
    movi write rootfs {device_number} {addr} [bytes(hex)] - Write rootfs data to sd/mmc by size
    movi read {sector#} {device_number} {bytes(hex)} {addr} - instead of this, you can use “mmc read”
    movi write {sector#} {device_number} {bytes(hex)} {addr} - instead of this, you can use “mmc write”
    注:读写安全加密数据 movi {read | write} tzsw {device_num} {addr}

  • bootcmd环境变量
    bootcmd参数指定uboot启动成功后执行的命令

  • 执行二进制文件命令 bootm

    # 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
    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
      cmdline - OS specific command line processing/setup
      bdt - OS specific bd_t processing
      prep - OS specific prep before relocation or go
      go - start OS

  • tftpboot命令

    # help tftp
    tftpboot - boot image via network using TFTP protocol
    Usage:
    tftpboot [loadAddress] [[hostIPaddr:]bootfilename]

    # setenv ipaddr 192.168.100.100
    # setenv serverip 192.168.100.101
    # tftpboot 42000000 zImage

  • 分区命令 fdisk

    # help fdisk
    fdisk - fdisk for sd/mmc.
    Usage:
    fdisk -p <device_num> - print partition information
    fdisk -c <device_num> [<sys. part size(MB)> <user data part size> <cache part size>]
      - create partition

  • 指定emmc分区的文件系统格式

    ext2format- ext2format - disk format by ext2
    ext3format- ext3format - disk format by ext3
    fatformat- fatformat - disk format by FAT32

    # help fatformat
    fatformat - fatformat - disk format by FAT32
    Usage:
    fatformat <interface(only support mmc)> <dev:partition num>
      - format by FAT32 on ‘interface’
     
    # help ext2format
    ext2format - ext2format - disk format by ext2
    Usage:
    ext2format <interface(only support mmc)> <dev:partition num>
      - format by ext2 on ‘interface’
     
    # help ext3format
    ext3format - ext3format - disk format by ext3
    Usage:
    ext3format <interface(only support mmc)> <dev:partition num>
      - format by ext3 on ‘interface’

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值