当前位置:文档之家› UBOOT命令详解

UBOOT命令详解

常用U-boot命令详解(z)2010-09-30 15:05:52| 分类:学习心得体会|字号订阅U-boot发展到现在,他的命令行模式已经非常接近Linux下的shell了,在我编译的U-boot-2009.11中的命令行模式模式下支持“Tab”键的命令补全和命令的历史记录功能。

而且如果你输入的命令的前几个字符和别的命令不重复,那么你就只需要打这几个字符即可,比如我想看这个U-boot的版本号,命令就是“ version”,但是在所有的命令中没有其他任何一个的命令是由“v”开头的,所以只需要输入“v”即可。

[u-boot@MINI2440]# versionU-Boot 2009.11 ( 4月04 2010 - 12:09:25)[u-boot@MINI2440]# vU-Boot 2009.11 ( 4月04 2010 - 12:09:25)[u-boot@MINI2440]# baseBase Address: 0x00000000[u-boot@MINI2440]# baBase Address: 0x00000000由于U-boot支持的命令实在太多,一个一个细讲不现实,也没有必要。

所以下面我挑一些烧写和引导常用命令介绍一下,其他的命令大家就举一反三,或者“help”吧!(1)获取帮助命令:help 或?功能:查看当前U-boot版本中支持的所有命令。

[u-boot@MINI2440]#help?- alias for'help'askenv - get environment variables from stdinbase - print or set address offsetbdinfo - print Board Info structurebmp - manipulate BMP image databoot - boot default, i.e., run 'bootcmd'bootd - boot default, i.e., run 'bootcmd'bootelf - Boot from an ELF image in memorybootm - boot application image from memorybootp - boot image via network using BOOTP/TFTP protocolbootvx - Boot vxWorks from an ELF imagecmp - memory compareconinfo - print console devices and informationcp - memory copycrc32 - checksum calculationdate - get/set/reset date &timedcache - enable or disable data cachedhcp - boot image via network using DHCP/TFTP protocol echo - echo args to consoleeditenv - edit environment variableeeprom - EEPROM sub-systemerase - erase FLASH memoryexit-exit scriptfatinfo - print information about filesystemfatload - load binary file from a dos filesystemfatls -list files in a directory (default/)flinfo - print FLASH memory informationfsinfo - print information about filesystemsfsload - load binary file from a filesystem imagego - start application at address 'addr'help - print online helpi2c - I2C sub-systemicache - enable or disable instruction cacheiminfo - print header information for application image imls -list all images found in flashimxtract- extract a part of a multi-imageitest -return true/false on integer compareloadb - load binary file over serial line(kermit mode) loads - load S-Record file over serial lineloadx - load binary file over serial line(xmodem mode) loady - load binary file over serial line(ymodem mode) loop - infinite loop on address rangels -list files in a directory (default/)md - memory displaymm - memory modify (auto-incrementing address)mmc - MMC sub-systemmtest - simple RAM read/write testmw - memory write(fill)nand - NAND sub-systemnboot - boot from NAND devicenfs - boot image via network using NFS protocolnm - memory modify (constant address)ping -send ICMP ECHO_REQUEST to network hostprintenv- print environment variablesprotect - enable or disable FLASH write protection rarpboot- boot image via network using RARP/TFTP protocol reginfo - print register informationreset- Perform RESET of the CPUrun - run commands in an environment variablesaveenv - save environment variables to persistent storage setenv -set environment variablesshowvar - print local hushshell variablessleep- delay execution for some timesource - run script from memorytest- minimal test like /bin/shtftpboot- boot image via network using TFTP protocolunzip - unzip a memory regionusb - USB sub-systemusbboot - boot from USB deviceversion - print monitor version以bmp指令为例:Usage:bmp info <imageAddr>- display image infobmp display <imageAddr>[x y]- display image at x,y[u-boot@MINI2440]# h bmbmp - manipulate BMP image dataUsage:bmp info <imageAddr>- display image infobmp display <imageAddr>[x y]- display image at x,y(2)环境变量(environment variables,简称ENV)与相关指令和shell类似,U-Boot也有环境变量。

一些U-boot默认的环境变量如下:环境变量解释说明bootdelay执行自动启动(bootcmd中的命令)的等候秒数baudrate串口控制台的波特率netmask以太网的网络掩码ethaddr以太网的MAC地址bootfile默认的下载文件名bootargs传递给Linux内核的启动参数bootcmd自动启动时执行命令serverip TFTP服务器端的IP地址ipaddr本地的IP地址stdin标准输入设备,一般是串口stdout标准输出,一般是串口,也可是LCD(VGA)stderr标准出错,一般是串口,也可是LCD(VGA)要看到你的板上的ENV值可使用printenv命令,例如我的板子:baudrate=115200ethaddr=08:08:11:18:12:27ipaddr=192.168.0.2serverip=192.168.0.1gatewayip=192.168.0.1netmask=255.255.255.0tekkaman=bmp d 70000stdin=serialstdout=serialstderr=serialethact=dm9000Environment size: 470/131068 bytes你会发现有些有的ENV我没有,还有一个“tekkaman”的ENV。

原因是如果你没有设置这个环境变量就不会打印出,你也可以自己定义ENV,并在命令中使用${ENV}来调用它。

第1个参数是环境变量的名称。

第2个参数是要设置的值,如果没有第2个参数,表示删除这个环境变量。

例如:我先将”tekkaman”参数删除,再设置,最后在一个命令串中调用。

[u-boot@MINI2440]# printenv tekkamantekkaman=bmp d 70000[u-boot@MINI2440]# setenv tekkaman[u-boot@MINI2440]# printenv tekkaman##Error:"tekkaman"not defined[u-boot@MINI2440]# setenv tekkaman echo "I am Tekkaman Ninja!"[u-boot@MINI2440]# printenv tekkamantekkaman=echo I am Tekkaman[u-boot@MINI2440]# echo I Love Linux ;${tekkaman}I Love LinuxI am Tekkaman当你设置了ENV,它只保存在内存中,如果你要它保存在存放ENV的固态存储器中,请使用:saveenv。

相关主题