rt5350 uboot 命令的简单分析

rt5350在刷机的时候。需要我们填写 服务器IP 板子IP 文件名,每次都要手动写。很麻烦。下面,我们通过 uboot 命令行来修改这三个默认参数。

rt5350 进入开机界面。此时输入 4 进入 uboot 命令行,在这里我们可以做一些简单的设置。

Please choose the operation: 
   1: Load system code to SDRAM via TFTP. 
   2: Load system code then write to Flash via TFTP. 
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   7: Load Boot Loader code then write to Flash via Serial. 
   9: Load Boot Loader code then write to Flash via TFTP. 

You choosed 4

 0 
raspi_read: from:40028 len:6 
.

4: System Enter Boot Command Line Interface.

U-Boot 1.1.3 (Oct  9 2013 - 21:17:42)
RT5350 # 

输入 help 。可以看到uboot支持的所有命令

RT5350 # help
?       - alias for 'help'
bootm   - boot application image from memory
cp      - memory copy
erase   - erase SPI FLASH memory
go      - start application at address 'addr'
help    - print online help
loadb   - load binary file over serial line (kermit mode)
md      - memory display
mdio   - Ralink PHY register R/W command !!
mm      - memory modify (auto-incrementing)
mw      - memory write (fill)
nm      - memory modify (constant address)
printenv- print environment variables
reset   - Perform RESET of the CPU
rf      - read/write rf register
saveenv - save environment variables to persistent storage
setenv  - set environment variables
tftpboot- boot image via network using TFTP protocol
version - print monitor version

我们输入以下几个命令。来设置 serverip ipaddr bootfile

RT5350 # setenv serverip 192.168.10.117
RT5350 # setenv ipaddr 192.168.10.111
RT5350 # setenv bootfile openwrt-ramips-rt305x-mpr-a2-squashfs-sysupgrade.bin
RT5350 # saveenv
Saving Environment to SPI Flash...
raspi_read: from:30000 len:10000 
.Erasing SPI Flash...
raspi_erase: offs:30000 len:10000
.
Writing to SPI Flash...
raspi_write: to:30000 len:10000 
.
done

命令说明:
setenv :用来修改变量 使用方法: setenv 变量 变量值
saveenv 保存变量到flash。如果不保存的话。掉电后变量又会回到原来的数值

接下来。我们使用 printenv 来查看变量是否都修改过来了

RT5350 # printenv
bootcmd=tftp
bootdelay=5
baudrate=57600
ethaddr="00:AA:BB:CC:DD:10"
ramargs=setenv bootargs root=/dev/ram rw
addip=setenv bootargs $(bootargs) ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname):$(netdev):off
addmisc=setenv bootargs $(bootargs) console=ttyS0,$(baudrate) ethaddr=$(ethaddr) panic=1
flash_self=run ramargs addip addmisc;bootm $(kernel_addr) $(ramdisk_addr)
kernel_addr=BFC40000
u-boot=u-boot.bin
load=tftp 8A100000 $(u-boot)
u_b=protect off 1:0-1;era 1:0-1;cp.b 8A100000 BC400000 $(filesize)
loadfs=tftp 8A100000 root.cramfs
u_fs=era bc540000 bc83ffff;cp.b 8A100000 BC540000 $(filesize)
test_tftp=tftp 8A100000 root.cramfs;run test_tftp
ethact=Eth0 (10/100-M)
filesize=3ff0cb
fileaddr=80800000
autostart=no
stdin=serial
stdout=serial
stderr=serial
serverip=192.168.10.117
ipaddr=192.168.10.111
bootfile=openwrt-ramips-rt305x-mpr-a2-squashfs-sysupgrade.bin

Environment size: 880/4092 bytes

输入 reset 重启。输入2进入刷机界面,看修改是否成功

RT5350 # reset


U-Boot 1.1.3 (Oct  9 2013 - 21:17:42)

Board: Ralink APSoC DRAM:  32 MB
relocate_code Pointer at: 81fb4000
******************************
Software System Reset Occurred
******************************
spi_wait_nsec: 42 
spi device id: ef 40 17 0 0 (40170000)
find flash: W25Q64BV
raspi_read: from:30000 len:1000 
.raspi_read: from:30000 len:1000 
.============================================ 
Ralink UBoot Version: 3.6.0.0
-------------------------------------------- 
ASIC 5350_MP (Port5<->None)
DRAM_CONF_FROM: EEPROM 
DRAM_SIZE: 256 Mbits SDR
DRAM_TOTAL_WIDTH: 16 bits
TOTAL_MEMORY_SIZE: 32 MBytes
Flash component: SPI Flash
Date:Oct  9 2013  Time:21:17:42
============================================ 
icache: sets:256, ways:4, linesz:32 ,total:32768
dcache: sets:128, ways:4, linesz:32 ,total:16384 

 ##### The CPU freq = 360 MHZ #### 
 estimate memory size =32 Mbytes

Please choose the operation: 
   1: Load system code to SDRAM via TFTP. 
   2: Load system code then write to Flash via TFTP. 
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   7: Load Boot Loader code then write to Flash via Serial. 
   9: Load Boot Loader code then write to Flash via TFTP. 

You choosed 2

 0 
raspi_read: from:40028 len:6 
.

2: System Load Linux Kernel then write to Flash via TFTP. 
 Warning!! Erase Linux in Flash then burn new one. Are you sure?(Y/N)
 Please Input new ones /or Ctrl-C to discard
        Input device IP (192.168.10.111) ==:192.168.10.111
        Input server IP (192.168.10.117) ==:192.168.10.117
        Input Linux Kernel filename (openwrt-ramips-rt305x-mpr-a2-squashfs-sysupgrade.bin) ==:openwrt-ramips-rt305x-mpr-a2-squashfs-sysupgrade.bin

我们可以看到。三个变量修改都生效了。下次刷机我们就不用老是手动来填写这个三个变量了。只需要回车3次即可。

你可能感兴趣的:(rt5350)