U-Boot 還提供了更加詳細的命令幫助,可以通過”?” 顯示支持的命令列表, 通過help [CommandName] 命令還可以查看每個命令的參數說明。
1 、 bootm
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
bootm 命令可以引導啓動存儲在內存中的程序映像。這些內存包括RAM 和可以永久保存的Flash 。
第1 個參數addr 是程序映像的地址,這個程序映像必須轉換成U-Boot 的格式。
第2 個參數對於引導Linux 內核有用,通常作爲U-Boot 格式的RAMDISK 映像存儲地址;也可以是傳遞給Linux 內核的參數(缺省情況下傳遞bootargs 環境變量給內核)。
附加說明: 要求二進制代碼爲制定格式的。通常爲mkimage 處理過的二進制文件。起動UBOOT TOOLS 製作的壓縮LINUX 內核, bootm 3200000
2 、 bootp
bootp [loadAddress] [bootfilename]
bootp 命令通過bootp 請求,要求DHCP 服務器分配IP 地址,然後通過TFTP 協議下載指定的文件到內存。
第1 個參數是下載文件存放的內存地址。
第2 個參數是要下載的文件名稱,這個文件應該在開發主機上準備好。
附加說明 : 通過網絡啓動,需要提前設置好硬件地址 bdinfo 打印ARM相關信息
3 、 cmp
cmp [.b, .w, .l] addr1 addr2 count
- compare memory
cmp 命令可以比較2 塊內存中的內容。.b 以字節爲單位;.w 以字爲單位;.l 以長字爲單位。注意:cmp.b 中間不能保留空格,需要連續敲入命令。
第1 個參數addr1 是第一塊內存的起始地址。
第2 個參數addr2 是第二塊內存的起始地址。
第3 個參數count 是要比較的數目,單位按照字節、字或者長字。
4 、 cp
cp [.b, .w, .l] source target count
- copy memory
cp 命令可以在內存中複製數據塊,包括對Flash 的讀寫操作。
第1 個參數source 是要複製的數據塊起始地址。
第2 個參數target 是數據塊要複製到的地址。這個地址如果在Flash 中,那麼會直接調用寫Flash 的函數操作。所以U-Boot寫Flash 就使用這個命令,當然需要先把對應Flash 區域擦淨。
第3 個參數count 是要複製的數目,根據cp.b cp.w cp.l 分別以字節、字、長字爲單位。
5 、 crc32
crc32 address count [addr]
- compute CRC32 checksum [save at addr]
crc32 命令可以計算存儲數據的校驗和。
第1 個參數address 是需要校驗的數據起始地址。
第2 個參數count 是要校驗的數據字節數。
第3 個參數addr 用來指定保存結果的地址。
coninfo
打印ARM相關信息
6 、 echo
echo [args..]
- echo args to console; c suppresses newline
echo 命令回顯參數。
用法:echo $( bootcmd)
7 、 erase
erase start end
- erase FLASH from addr 'start' to addr 'end'
erase N:SF[-SL]
- erase sectors SF-SL in FLASH bank # N
erase bank N
- erase FLASH bank # N
erase all
- erase all FLASH banks
erase 命令可以擦Flash 。
參數必須指定Flash 擦除的範圍。
按照起始地址和結束地址,start 必須是擦除塊的起始地址;end 必須是擦除末尾塊的結束地址。這種方式最常用。舉例說明:擦除0x20000 – 0x3ffff 區域命令爲erase 20000 3ffff 。
按照組和扇區,N 表示Flash 的組號,SF 表示擦除起始扇區號,SL 表示擦除結束扇區號。另外,還可以擦除整個組,擦除組號爲N 的整個Flash 組。擦除全部Flash 只要給出一個all 的參數即可。
用法:
寫入數據之前必須先執行該命令
用法: erase 0xc******* +0xYYYYYYYY
說明: 擦除從0xc******* 開始的0xYYYYYYYY 字節( 字節必須塊對齊)
例:
Z228 # erase 0xc4040000 +0x180000
........................ done
Erased 24 sectors
附加: erase 1:0-2( 就是對每一塊FLASH 的0-2 扇區進行刪除)
h. cp.b
拷貝數據,從指定源地址到目標地址,地址可以是ram ,也可以是nor flash
用法: cp.b 0x******** 0x######## 0xYYYYYYYY
說明: 拷貝源0x******** 到目標0x########, 共拷貝0xYYYYYYY 字節
例:
Z228 # cp.b 0x200000 0xc4040000 0x180000
Copy to Flash... done
8 、 flinfo
flinfo
- print information for all FLASH memory banks
flinfo N
- print information for FLASH memory bank # N
flinfo 命令打印全部Flash 組的信息,也可以只打印其中某個組。一般嵌入式系統的Flash 只有一個組。
9 、 go
go addr [arg ...]
- start application at address 'addr'
passing 'arg' as arguments
go 命令可以執行應用程序。
第1 個參數是要執行程序的入口地址。
第2 個可選參數是傳遞給程序的參數,可以不用。
10 、iminfo
iminfo addr [addr ...]
- print header information for application image starting at
address 'addr' in memory; this includes verification of the
image contents (magic number, header and payload checksums)
iminfo 可以打印程序映像的開頭信息,包含了映像內容的校驗(序列號、頭和校驗和)。
第1 個參數指定映像的起始地址。
可選的參數是指定更多的映像地址。
11 、 loadb
loadb [ off ] [ baud ]
- load binary file over serial line with offset 'off' and baudrate 'baud'
loadb 命令可以 通過串口 Kermit 協議下載二進制數據。
12 、 loads
loads [ off ]
- load S-Record file over serial line with offset 'off'
loads 命令可以通過串口線下載S-Record 格式文件。
13 、 mw
mw [.b, .w, .l] address value [count]
- write memory
mw 命令可以按照字節、字、長字寫內存,.b .w .l 的用法與cp 命令相同。
第1 個參數address 是要寫的內存地址。
第2 個參數value 是要寫的值。
第3 個可選參數count 是要寫單位值的數目。
用法 : mw 32000000 ff 10000( 把內存0x32000000 開始的0x10000 字節設爲0xFF)
14 、 nm
nm [.b, .w, .l] address
- memory modify, read and keep address
nm 命令可以修改內存,可以按照字節、字、長字操作。
參數address 是要讀出並且修改的內存地址。
15 、 Md
顯示內存區的內容。
16 、 Mm
讀或修改內存,地址自動遞增。
mm 內存地址 回車
此時進入內存查看 直接按回車 保持原內容不變,若要改變,在問號後面輸入數值然後回車 按 . 此符號退出
17 、 nfs
nfs [loadAddress] [host ip addr:bootfilename]
nfs 命令可以使用NFS 網絡協議通過網絡啓動映像。
用法 :
nfs 32000000 192.168.0.2:aa.txt
把192.168.0.2(LINUX 的NFS 文件系統) 中的NFS 文件系統中的aa.txt 讀入內存0x32000000 處。
16 、 printenv
printenv
- print values of all environment variables
printenv name ...
- print value of environment variable 'name'
printenv 命令打印環境變量。
可以打印全部環境變量,也可以只打印參數中列出的環境變量。
18 、 protect
protect on start end
- protect Flash from addr 'start' to addr 'end'
protect on N:SF[-SL]
- protect sectors SF-SL in Flash bank # N
protect on bank N
- protect Flash bank # N
protect on all
- protect all Flash banks
protect off start end
- make Flash from addr 'start' to addr 'end' writable
protect off N:SF[-SL]
- make sectors SF-SL writable in Flash bank # N
protect off bank N
- make Flash bank # N writable
protect off all
- make all Flash banks writable
protect 命令是對Flash 寫保護的操作,可以使能和解除寫保護。
第1 個參數on 代表使能寫保護;off 代表解除寫保護。
第2 、3 參數是指定Flash 寫保護操作範圍,跟擦除的方式相同。
用法 :
protect on 1:0-3( 就是對第一塊 FLASH 的 0-3 扇區進行保護 )
protect off 1:0-3 取消寫保護
protect off bank 1 解除 / 使能 第 N 塊 FLASH 的寫保護
19 、 rarpboot
rarpboot [loadAddress] [bootfilename]
rarboot 命令可以使用TFTP 協議通過網絡啓動映像。也就是把指定的文件下載到指定地址,然後執行。
第1 個參數是映像文件下載到的內存地址。
第2 個參數是要下載執行的映像文件。
20 、 run
run var [...]
- run the commands in the environment variable(s) 'var'
run 命令可以執行環境變量中的命令,後面參數可以跟幾個環境變量名。
用法 :
Uboot> setenv flashit tftp 20000000 mycode.bin\; erase 10020000 1002FFFF\;
cp.b 20000000 10020000 8000
Uboot> saveenv
Uboot> run flashit
21 、 setenv
setenv name value ...
- set environment variable 'name' to 'value ...'
setenv name
- delete environment variable 'name'
setenv 命令可以設置環境變量。
第1 個參數是環境變量的名稱。
第2 個參數是要設置的值,如果沒有第2 個參數,表示刪除這個環境變量。
用法 :
Uboot> setenv myboard AT91RM9200DK
Uboot> printenv
baudrate=115200
ipaddr=192.168.1.1
ethaddr=12:34:56:78:9A:BC
serverip=192.168.1.5
myboard=AT91RM9200DK
Environment size: 102/8188 bytes
22 、 Saveenv
保存環境變量
命令將當前定義的所有的變量及其值存入flash 中。用來存儲變量及其值的空間只有8k 字節,應不要超過。
23 、 sleep
sleep N
- delay execution for N seconds (N is _decimal_ !!!)
sleep 命令可以延遲N 秒鐘執行,N 爲十進制數。
24 、 tftpboot
tftpboot [loadAddress] [bootfilename]
tftpboot 命令可以使用TFTP 協議通過網絡下載文件。按照二進制文件格式下載。另外使用這個命令,必須配置好相關的環境變量。例如serverip 和ipaddr 。
第1 個參數loadAddress 是下載到的內存地址。
第2 個參數是要下載的文件名稱,必須放在TFTP 服務器相應的目錄下。
25 、 ping
注:只能開發板PING 別的機器
26 、 usb
usb start: 起動usb 功能
usb info: 列出設備
usb scan: 掃描usb storage(u 盤) 設備
27 、 kgo
起動沒有壓縮的linux 內核
kgo 32000000
27 、 fatls
列出DOS FAT 文件系統
fatls usb 0 列出第一塊U 盤中的文件
28 、 fatload
讀入FAT 中的一個文件
fatload usb 0:0 32000000 aa.txt 把USB 中的aa.txt 讀到物理內存0x32000000 處!