U-BOOT 命令大全

 

經常使用u-boot命令詳解(全)


(1)獲取幫助

命令:help 或 ?shell


功能:查看當前U-boot版本中支持的全部命令。ubuntu



[u-boot@MINI2440]# help
? - alias for 'help'
askenv - get environment variables from stdin
base - print or set address offset
bdinfo - print Board Info structure
bmp - manipulate BMP p_w_picpath data
boot - boot default, i.e., run 'bootcmd'
bootd - boot default, i.e., run 'bootcmd'
bootelf - Boot from an ELF p_w_picpath in memory
bootm - boot application p_w_picpath from memory
bootp - boot p_w_picpath via network using BOOTP/TFTP protocol
bootvx - Boot vxWorks from an ELF p_w_picpath
cmp - memory compare
coninfo - print console devices and information
cp - memory copy
crc32 - checksum calculation
date - get/set/reset date & time
dcache - enable or disable data cache
dhcp - boot p_w_picpath via network using DHCP/TFTP protocol
echo - echo args to console
editenv - edit environment variable
eeprom - EEPROM sub-system
erase - erase FLASH memory
exit - exit script
fatinfo - print information about filesystem
fatload - load binary file from a dos filesystem
fatls - list files in a directory (default /)
flinfo - print FLASH memory information
fsinfo - print information about filesystems
fsload - load binary file from a filesystem p_w_picpath
go - start application at address 'addr'
help - print online help
i2c - I2C sub-system
icache - enable or disable instruction cache
iminfo - print header information for application p_w_picpath
imls - list all p_w_picpaths found in flash
imxtract- extract a part of a multi-p_w_picpath
itest - return true/false on integer compare
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 /)
md - memory display
mm - memory modify (auto-incrementing address)
mmc - MMC sub-system
mtest - simple RAM read/write test
mw - memory write (fill)
nand - NAND sub-system
nboot - boot from NAND device
nfs - boot p_w_picpath via network using NFS protocol
nm - memory modify (constant address)
ping - send ICMP ECHO_REQUEST to network host
printenv- print environment variables
protect - enable or disable FLASH write protection
rarpboot- boot p_w_picpath via network using RARP/TFTP protocol
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 p_w_picpath via network using TFTP protocol
unzip - unzip a memory region
usb - USB sub-system
usbboot - boot from USB device
version - print monitor version

若是你想獲取某條命令的更詳細的幫助,能夠使用:windows


help <你想要查的指令>
或者 ? <你想要查的指令> ,
甚至 h <你想要查的指令縮寫>

以bmp指令爲例:服務器



[u-boot@MINI2440]# help bmp
bmp - manipulate BMP p_w_picpath data

Usage:
bmp info <p_w_picpathAddr> - display p_w_picpath info
bmp display <p_w_picpathAddr> [x y] - display p_w_picpath at x,y
[u-boot@MINI2440]# ? bmp
bmp - manipulate BMP p_w_picpath data

Usage:
bmp info <p_w_picpathAddr> - display p_w_picpath info
bmp display <p_w_picpathAddr> [x y] - display p_w_picpath at x,y
[u-boot@MINI2440]# h bm
bmp - manipulate BMP p_w_picpath data

Usage:
bmp info <p_w_picpathAddr> - display p_w_picpath info
bmp display <p_w_picpathAddr> [x y] - display p_w_picpath at x,y


(2)環境變量(environment variables,簡稱ENV)與相關指令
和shell相似,U-Boot也有環境變量。一些U-boot默認的環境變量以下:


 

   網絡

 

 

   app

 

bootdelay 執行自動啓動(bootcmd中的命令)的等候秒數
baudrate 串口控制檯的波特率
netmask 以太網的網絡掩碼
ethaddr 以太網的MAC地址
bootfile 默認的下載文件名
bootargs 傳遞給Linux內核的啓動參數
bootcmd 自動啓動時執行命令
serverip TFTP服務器端的IP地址
ipaddr 本地的IP地址
stdin 標準輸入設備,通常是串口
stdout 標準輸出,通常是串口,也但是LCDVGA
stderr 標準出錯,通常是串口,也但是LCDVGA

       ENV能夠放在許多固體存儲器中,對於mini2440來講Nor Flash、Nand Flash或EEPROM均可以,就看你如何配置了(include/configs下的配置文件)。例如:ide


  

    Nor Flash

oop


#define CONFIG_ENV_IS_IN_FLASH 1
#define CONFIG_ENV_OFFSET 0X40000
#define CONFIG_ENV_SIZE            0x20000    /* Total Size of Environment Sector */

Nand Flash: ui


#define CONFIG_ENV_IS_IN_NAND 1
#define CONFIG_ENV_OFFSET 0X40000
#define CONFIG_ENV_SIZE            0x20000    /* Total Size of Environment Sector */

EEPROM:spa


#define CONFIG_ENV_IS_IN_EEPROM 1 /* use EEPROM for environment vars */
#define CONFIG_ENV_OFFSET 0x000 /* environment starts at offset 0 */
#define CONFIG_ENV_SIZE     0x400 /* 1KB */


CONFIG_ENV_OFFSET是在整個存儲器中的偏移地址;
CONFIG_ENV_SIZE是指其使用的大小。

注意 CONFIG_ENV_OFFSET和 CONFIG_ENV_SIZE 的設置,不要覆蓋了其餘分區。


4、U-boot的使用(二)

命令:
loadb   - load binary file over serial line (kermit mode)
loadx   - load binary file over serial line (xmodem mode)
loady   - load binary file over serial line (ymodem mode)


功能:以不一樣的協議從串口獲取文件.。
格式基本都爲:
load? [ off ] [ baud ]
第1個參數是下載到SDRAM的地址,若是不填,就是用默認配置:CONFIG_SYS_LOAD_ADDR
第2個參數是波特率,通常不填,用默認的115200.


    在windows下的超級終端能夠用這些協議發送文件,可是在ubuntu下基本只能用kermit協議。一下使用C-kermit來發送一個文件到mini2440。

 

[u-boot@MINI2440]# loadb
## Ready for binary (kermit) download to 0x30008000 at 115200 bps...

 


    上面已經啓動了U-boot的kermit傳輸協議,這時按下 Ctrl + \ , 再按 c, 切換到C-kermit的命令行模式,輸入命令:send  <文件路徑>,回車。

 

[u-boot@MINI2440]# loadb
## Ready for binary (kermit) download to 0x30008000 at 115200 bps...

(Back at MAGI-Linux)
----------------------------------------------------
C-Kermit 8.0.211, 10 Apr 2004, for Linux
Copyright (C) 1985, 2004,
  Trustees of Columbia University in the City of New York.
Type ? or HELP for help.
(/home/tekkaman/桌面/) C-Kermit>send/home/tekkaman/development/share/zImage.img

 

C-kermit就開始傳送,而且顯示一個傳送界面,並動態顯示傳送進度。


C-Kermit 8.0.211, 10 Apr 2004, MAGI-Linux

   Current Directory: /home/tekkaman/&#65533;&#65533;~L&#65533;~]&#65533;
Communication Device: /dev/ttyUSB0
Communication Speed: 115200
              Parity: none
         RTT/Timeout: 01 / 02
             SENDING: /home/tekkaman/development/share/zImage.img => zImage.img
           File Type: BINARY
           File Size: 2277540
        Percent Done: 19 
/////////-

                          ...10...20...30...40...50...60...70...80...90..100
Estimated Time Left: 00:03:35
  Transfer Rate, CPS: 8536
        Window Slots: 1 of 1
         Packet Type: D
        Packet Count: 557
       Packet Length: 1000
         Error Count: 0
          Last Error:
        Last Message:

X to cancel file, Z to cancel group, <CR> to resend last packet,
E to send Error packet, ^C to quit immediately, ^L to refresh screen.

傳送完畢後,輸入c ,回到U-boot的串口界面。


[u-boot@MINI2440]# loadb
## Ready for binary (kermit) download to 0x30008000 at 115200 bps...

(Back at MAGI-Linux)
----------------------------------------------------
C-Kermit 8.0.211, 10 Apr 2004, for Linux
Copyright (C) 1985, 2004,
  Trustees of Columbia University in the City of New York.
Type ? or HELP for help.
(/home/tekkaman/桌面/) C-Kermit>send/home/tekkaman/development/share/zImage.img
(/home/tekkaman/桌面/) C-Kermit>c
Connecting to /dev/ttyUSB0, speed 115200
Escape character: Ctrl-\ (ASCII 28, FS): enabled
Type the escape character followed by C to get back,
or followed by ? to see other options.
----------------------------------------------------
## Total Size = 0x0022c0a4 = 2277540 Bytes
## Start Addr = 0x30008000
相關文章
相關標籤/搜索