mini2440uboot移植-uboot基本命令之kermit

mini2440uboot移植----uboot基本命令之kermit

要开发移植uboot,首先要对uboot有一定的了解,起码要会使用,所以这里首先熟悉一下uboot的使用以及如何将uboot烧入mini2440。

当让,在去探究uboot之前,必须保证你的开发板上有了uboot,如果没有,请先烧入一个已经编译好的uboot,这里为了方便,我直接下载了Tekkaman Ninja大侠已经编译好的.bin文件,有需要的可以自己下载http://blogimg.chinaunix.net/blog/upfile2/100404122259.bz2

把你下载的uboot.bin烧到mini2440的nand或者nor nand的起始地址即可,烧入的方法,连接串口,连接USB下载线,选择nor falsh方式启动,输入f格式化,然后使用v命令下载uboot.bin,然后从nand方式启动,你的uboot已经烧录成功,具体方法参考mini2440的官方手册

开机启动信息:

U-Boot 2009.11 ( 4-04 2010 - 12:09:25)
modified by tekkamanninja ([email protected])
Love Linux forever!!
I2C:   ready
DRAM:  64 MB
Flash:  2 MB
NAND:  256 MiB
Video: 240x320x16 20kHz 62Hz
In:    
serial
Out:   
serial
Err:   
serial
Net:   dm9000

U-Boot 2009.11 ( 4-04 2010 - 12:09:25)
modified by tekkamanninja
([email protected])
Love Linux forever!!
Hit any key to stop autoboot:  1  0 
[u-boot@MINI2440]# 
查看版本信息和起始地址信息:
[u-boot@MINI2440]# version
U-Boot 2009.11 ( 4月 04 2010 - 12:09:25)
[u-boot@MINI2440]# v
U-Boot 2009.11 ( 4月 04 2010 - 12:09:25)
[u-boot@MINI2440]# ba
Base Address: 0x00000000
[u-boot@MINI2440]# base
Base Address: 0x00000000
[u-boot@MINI2440]# 
查看帮助信息:
[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 image data
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
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 image 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 image
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 image
imls    - list all images found in flash
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
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 image 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 image 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 image via network using TFTP protocol
unzip   - unzip a memory region
usb     - USB sub-system
usbboot - boot from USB device
version - print monitor version
也可以单独获得某一条命令的使用帮助:
[u-boot@MINI2440]# help setenv
setenv - set environment variables
Usage:
setenv name value ...
    - set environment variable 'name' to 'value ...'
setenv name
环境变量与相关指令:

bootdelay 执行自启动的等候秒数

baudrate  串口控制台的波特率

metmask 以太网的网络掩码

ethaddr  以太网的mac地址

bootfile  默认下载文件

bootargs 传递给linux内核的启动参数

bootcmd  自动启动时的执行命令

serverip  文件服务器端的IP地址

stdin 标准输入设备

stdout  标准输出设备

stderr  标准出错

看看此系统下面都有哪些环境变量:

[u-boot@MINI2440]# printenv
bootargs=noinitrd root=/dev/nfs rw nfsroot=192.168.0.1:/home/tekkaman/working/nfs/rootfs ip=192.168.0.2:192.168.0.1::255.255.255.0 console=ttySAC0,115200 init=/linuxrc mem=64M
bootcmd=nfs 0x30008000 192.168.0.1:/home/tekkaman/working/nfs/zImage.img;bootm
baudrate=115200
ethaddr=08:08:11:18:12:27
ipaddr=192.168.0.2
serverip=192.168.0.1
gatewayip=192.168.0.1
netmask=255.255.255.0
tekkaman=bmp d 70000
stdin=serial
stdout=serial
stderr=serial
ethact=dm9000
bootdelay=5

Environment size: 470/131068 bytes
上面有一个bootdelay其实少些完成后默认的是1秒,这里是5秒,我想时间停留长一点,所以这里已经做过改动,下面是设置变量的方法

[u-boot@MINI2440]# set var 1
[u-boot@MINI2440]# printent var
Unknown command 'printent' - try 'help'
[u-boot@MINI2440]# printenv var
var=1
[u-boot@MINI2440]# set var
[u-boot@MINI2440]# printenv var
## Error: "var" not defined
[u-boot@MINI2440]# 
另外还有一个比较重要的地方,这里要说一下,最初在烧完uboot的时候显示的信息其实并不完全是我上面贴出来的打印信息,有一条信息很重要“Warning - bad CRC, using default environment”,这条信息也许每个人都会遇到,说明uboot没有在存放ENV的固态存储器中找到有效的ENV,只好使用编译时定义的默认ENV。如果uboot存放ENV的固态存储器的驱动时没有问题的,那 只要运行saveenv就可以把当前系统的所有ENV写入固态存储器中,下次启动就不会有这个警告了

下面我们要真正开始看点实际的了,怎么通过串口将数据传送到mini2440开发板,这里要说的是ubuntu上通过c-kermit数据传送,c-kermit的安装这里就不再说了,但是配置必须要说一说了,我在配置的时候可是吃了点苦头

在用户根目录下创建一个.kermrc的文件,输入一下内容:

set line /dev/ttyUSB0
set speed 115200
set carrier-watch off
set handshake none
set flow-control none
robust
set file type bin
set file name lit
set rec pack 1000
set send pack 1000
set window 5
最开始我第一行是这样的:set line /dev/ttyS0,总是不成功,这里自己去dev下看吧
root@ubuntu:~# ls /dev/tty
tty      tty16    tty24    tty32    tty40    tty49    tty57    tty8
tty0     tty17    tty25    tty33    tty41    tty5     tty58    tty9
tty1     tty18    tty26    tty34    tty42    tty50    tty59    ttyS0
tty10    tty19    tty27    tty35    tty43    tty51    tty6     ttyS1
tty11    tty2     tty28    tty36    tty44    tty52    tty60    ttyS2
tty12    tty20    tty29    tty37    tty45    tty53    tty61    ttyS3
tty13    tty21    tty3     tty38    tty46    tty54    tty62    ttyUSB0
tty14    tty22    tty30    tty39    tty47    tty55    tty63    
tty15    tty23    tty31    tty4     tty48    tty56    tty7     
root@ubuntu:~# ls /dev/tty
/dev/tty
root@ubuntu:~# ls /dev/ttyUSB0 
/dev/ttyUSB0
然后通过kermit打开c-kermit,进入工作环境,然后输入connect连接,或者直接输入kermit -c同时实现上面两步操作,
root@ubuntu:~# kermit
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.
(/root/) C-Kermit>connect
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.
----------------------------------------------------
T �

U-Boot 2009.11 ( 4月 04 2010 - 12:09:25)

 modified by tekkamanninja ([email protected])
 Love Linux forever!!

I2C:   ready
DRAM:  64 MB
Flash:  2 MB
NAND:  256 MiB
Video: 240x320x16 20kHz 62Hz
In:    serial
Out:   serial
Err:   serial
Net:   dm9000
U-Boot 2009.11 ( 4月 04 2010 - 12:09:25)
modified by tekkamanninja
([email protected])
Love Linux forever!!
Hit any key to stop autoboot:  0 
[u-boot@MINI2440]# loadb
## Ready for binary (kermit) download to 0x30008000 at 115200 bps...

(Back at ubuntu)
----------------------------------------------------
(/root/) C-Kermit>send /root/image/zImage_W35 
(/root/) C-Kermit>
上面send /root/image/zImage_W35传送文件界面是这样的
C-Kermit 8.0.211, 10 Apr 2004, MAGI-Linux 
 
   Current Directory: /home/tekkaman/~L~] 
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, 
同时下面两行还有传输结果:
[u-boot@MINI2440]# loadb 
## Ready for binary (kermit) download to 0x30008000 at 115200 bps...

(Back at ubuntu)
----------------------------------------------------
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.
(/root/) C-Kermit>send /root/image/uboot.bin 
(/root/) 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      = 0x0003e8dc = 256220 Bytes
## Start Addr      = 0x30008000
[u-boot@MINI2440]# 
输入c后退出传输界面,返回到串口终端,继续接收串口显示

待续。。。。

你可能感兴趣的:(uboot)