Chinaunix首页 | 论坛 | 博客
  • 博客访问: 588792
  • 博文数量: 169
  • 博客积分: 2656
  • 博客等级: 少校
  • 技术积分: 1685
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-30 13:03
文章分类

全部博文(169)

文章存档

2011年(1)

2010年(135)

2009年(33)

我的朋友

分类: 嵌入式

2010-06-15 03:06:07

setenv ethaddr 00:0E:99:02:07:43
setenv serverip 138.198.187.68
setenv ipaddr 138.198.187.199

setenv bootcmd bootm 0x40000

setenv bootargs console=ttyS0,115200n8 noinitrd rw ip=on root=/dev/mtdblock3 rootfstype=jffs2 init=/sbin/init

tftpboot 0x10000000 uImage.cc

常用命令
ping 138.198.187.68
ifconfig   查看以太网信息
uname -a   查看Linux的版本
version    查看UBoot的版本

So far just notes on how to flash images ...

Flash u-boot, assumes tftp download and u-boot named uboot.bin.

OMAP5912 OSK # tftpboot 0x10000000 uboot.bin
OMAP5912 OSK # protect off 1:0
OMAP5912 OSK # erase 1:0
OMAP5912 OSK # cp.b 0x10000000 0x0 $(filesize)
OMAP5912 OSK # protect on 1:0
Flash kernel, assumes tftp download and kernel named uImage.cc. Here are the u-boot commands.

OMAP5912 OSK # tftpboot 0x10000000 uImage.cc
OMAP5912 OSK # erase 0x40000 0x23ffff
OMAP5912 OSK # cp.b 0x10000000 0x40000 $(filesize)
Flash jffs2 file system, assumes tftp download and file system image named fs.jffs2.

OMAP5912 OSK # tftpboot 0x10000000 fs.jffs2
OMAP5912 OSK # erase 0x240000 0x1ffffff
OMAP5912 OSK # cp.b 0x10000000 0x240000 $(filesize)

Here is my uboot environment.

OMAP5912 OSK # printenv
baudrate=115200
bootdelay=10
ethaddr=00:0e:99:02:03:fc
bootfile=u-boot.bin
filesize=16144
fileaddr=10000000
gatewayip=192.168.1.99
netmask=255.255.255.0
ipaddr=192.168.1.150
serverip=192.168.1.81
bootcmd=bootm 0x40000
bootargs== console=ttyS0,115200n8 noinitrd rw ip=on root=/dev/mtdblock3 rootfstype=jffs2 init=/sbin/init
stdin=serial
stdout=serial
stderr=serial

Environment size: 364/131068 bytes
OMAP5912 OSK #

Some quick info on using Das U-Boot

1 Table of Contents

  1. Table of Contents
  2. Check this first
  3. Ethernet Usage
  4. Serial Port Usage
  5. Programming Flash Memory
  6. Booting the Kernel

2 Check this first

The version of u-boot that comes on the OSK has the incorrect arch number. Before trying out new kernels, you should update to a newer version. Check the output of bdinfo to see what arch number uboot thinks you have. The old incorrect one is 0x000000EA and the new correct one is 0x00000203. New kernel will fail to boot if given the incorrect arch number. The output should look like this:

    OMAP5912 OSK # bdinfo 
    arch_number = 0x00000203 
    env_t       = 0x00000000 
    boot_params = 0x10000100 
    DRAM bank   = 0x00000000 
    -> start    = 0x10000000 
    -> size     = 0x02000000 
    ethaddr     = 00:0E:99:xx:xx:xx 
    ip_addr     = x.x.x.x 
    baudrate    = 115200 bps 
     

3 Ethernet Usage

u-boot can use dhcp/bootp. You only need to set the u-boot ethaddr environment variable:

    OMAP5912 OSK # printenv 
    baudrate=115200 
    bootdelay=20 
    ethaddr=00:0E:99:xx:xx:xx 
    bootcmd=bootp; bootm 
    stdin=serial 
    stdout=serial 
    stderr=serial 
     
    Environment size: 117/131068 bytes 
    OMAP5912 OSK # bootp 
    Using MAC Address 00:0E:99:xx:xx:xx 
    BOOTP broadcast 1 
    DHCP client bound to address 192.168.1.56 
    TFTP from server 192.168.1.10; our IP address is 192.168.1.56 
    Filename 'osk1/boot/uImage'. 
    Load address: 0x10000000 
    Loading: ################################################################# 
             ################################################################# 
             ################################################################# 
             ################### 
    done 
    Bytes transferred = 1095068 (10b59c hex) 
    OMAP5912 OSK # 
     

u-boot uses tftp to transfer files. You'll need to setup a tftp server. To upload a kernel or other file using Ethernet:

    OMAP5912 OSK # tftp 0x10000000 osk1/boot/uImage 
    Using MAC Address 00:0E:99:xx:xx:xx 
    TFTP from server 192.168.1.10; our IP address is 192.168.1.56 
    Filename 'osk1/boot/uImage'. 
    Load address: 0x10000000 
    Loading: ################################################################# 
             ################################################################# 
             ################################################################# 
             ################### 
    done 
    Bytes transferred = 1095068 (10b59c hex) 
    OMAP5912 OSK # 
     

    OMAP5912 OSK # tftp 0x10000000 osk1/u-boot-1.1.2.bin 
    Using MAC Address 00:0E:99:xx:xx:xx 
    TFTP from server 192.168.1.10; our IP address is 192.168.1.56 
    Filename 'osk1/u-boot-1.1.2.bin'. 
    Load address: 0x10000000 
    Loading: ################## 
    done 
    Bytes transferred = 87764 (156d4 hex) 
    OMAP5912 OSK # 
     

4 Serial Port Usage

To upload a kernel using the serial port:

    OMAP5912 OSK #  loadb 0x10000000  
    ## Ready for binary (kermit) download to 0x10000000 at 115200 bps... 
     
  • Then send a uImage.cc using kermit.

5 Programming Flash Memory

To flash the kernel:

    OMAP5912 OSK # erase 0x0040000 0x0023ffff 
     
    Erasing sector  2 ...  done 
    Erasing sector  3 ...  done 
    ... 
    Erasing sector 16 ...  done 
    Erasing sector 17 ...  done 
    Erased 16 sectors 
     
    OMAP5912 OSK # cp 0x10000000 0x00040000 0x00200000 <- replace with smaller kenel value if desired 
    Copy to Flash...\done 
     
    OMAP5912 OSK # imls 
    Image at 00040000: 
       Image Name:   Linux-2.4.20_mvl31-omap5912_osk 
       Image Type:   ARM Linux Kernel Image (uncompressed) 
       Data Size:    741532 Bytes = 724.2 kB 
       Load Address: 10008000 
       Entry Point:  10008000 
       Verifying Checksum ... OK 
     

Instructions on updating u-boot (tested)

    OMAP5912 OSK # tftp 0x10000000 osk1/u-boot-1.1.2.bin 
    Using MAC Address 00:0E:99:xx:xx:xx 
    TFTP from server 192.168.1.10; our IP address is 192.168.1.56 
    Filename 'osk1/u-boot-1.1.2.bin'. 
    Load address: 0x10000000 
    Loading: ################## 
    done 
    Bytes transferred = 87764 (156d4 hex) 
    OMAP5912 OSK # protect off 00000000 0001ffff 
    Un-Protected 1 sectors 
    OMAP5912 OSK # era 00000000 0001ffff 
     
    Erasing sector  0 ...  done 
    Erased 1 sectors 
    OMAP5912 OSK # cp.b 0x10000000 0x00000000 0x156d4 
    Copy to Flash...-done 
    OMAP5912 OSK # protect on 00000000 0001ffff 
    Protected 1 sectors 
    OMAP5912 OSK # 
     

Instructions on flashing a root filesystem: First send over a filesytem image like betafilesys.jffs2 to address 0x10000000 as the kernel uploading instructions above and then flash it:

    OMAP5912 OSK # erase 0x01000000 0x001ffffff 
    Erasing sector 128 ...  done 
    ... 
    Erasing sector 258 ...  done <- why does it go to 258 instead of just 255 ? 
    OMAP5912 OSK # loadb 0x10000000 
    ## Ready for binary (kermit) download to 0x10000000 at 115200 bps...                                            
    ## Total Size      = 0x00e34b14 = 14895892 Bytes 
    ## Start Addr      = 0x10000000 
    OMAP5912 OSK # cp.b  0x10000000 0x1000000 0x00e34b14 <- replace with Total Size above (might need to be +64 bytes?) 
    Copy to Flash...-done 
     

Flash is partitioned as follows:

    # cat /proc/mtd 
    dev:    size   erasesize  name 
    mtd0: 00020000 00020000 "BootLoader" 
    mtd1: 00020000 00020000 "Params" 
    mtd2: 00200000 00020000 "Kernel" 
    mtd3: 00dc0000 00020000 "Flash0 FileSys" 
    mtd4: 01000000 00020000 "Flash1 FileSys" 
     
    cfi_cmdset_0001: Erase suspend on write enabled                                                                                                  
    Using buffer write method                                                                                                                        
    OMAP flash: CFI device at 0x00000000, 16MiB, 16-bit                                                                                              
    cfi_cmdset_0001: Erase suspend on write enabled                                                                                                  
    Using buffer write method                                                                                                                        
    OMAP flash: CFI device at 0x01000000, 16MiB, 16-bit                                                                                              
    Concatenating MTD devices:                                                                                                                       
    (0): ""                                                                                                                                    
    (1): ""                                                                                                                                    
    into device "omap-flash"                                                                                                                         
    No RedBoot partition table detected in omap-flash                                                                                                
    OMAP flash: using static partition definition                                                                                                    
    Creating 5 MTD partitions on "omap-flash":                                                                                                       
    0x00000000-0x00020000 : "BootLoader"                                                                                                             
    0x00020000-0x00040000 : "Params"                                                                                                                 
    0x00040000-0x00240000 : "Kernel" 
    0x00240000-0x01000000 : "Flash0 FileSys" 
    0x01000000-0x02000000 : "Flash1 FileSys" 
     

6 Booting the Kernel

To boot, use setenv and saveenv to get the correct environment. You can boot by hand using something like:

    OMAP5912 OSK # cp 0x00040000 0x10000000 0x00200000 
    OMAP5912 OSK # bootm 
     

You can make this automatic with:

    OMAP5912 OSK # setenv bootcmd 'cp 0x00040000 0x10000000 0x00200000;bootm' 
    OMAP5912 OSK # saveenv 
    Saving Environment to Flash... 
    Un-Protected 1 sectors 
    Erasing Flash... 
    Erasing sector  1 ...  done 
    Erased 1 sectors 
    Writing to Flash.../done 
    Protected 1 sectors 
     

Or

    OMAP5912 OSK # setenv bootcmd 'bootp; bootm' 
    OMAP5912 OSK # saveenv 
     

Or

    OMAP5912 OSK # setenv bootcmd bootm 0x40000 
    OMAP5912 OSK # setenv bootdelay 2 
    OMAP5912 OSK # saveenv 
     

Or to tftp a kernel, and then nfs mount debian TimRiker uses:

    OMAP5912 OSK # setenv bootargs console=ttyS0,115200n8 noinitrd ro devfs=nomount ip=dhcp root=/dev/nfs rootfstype=nfs nfsroot=1.2.3.4:/tftpboot/debian-unstable-arm/ 
    OMAP5912 OSK # setenv bootcmd 'dhcp; bootm' 
    OMAP5912 OSK # setenv bootdelay 2 
    OMAP5912 OSK # saveenv 
    
阅读(745) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~