无线论坛 门户 我要刷机 查看内容

最全的u-boot命令详解

2016-6-28 13:59| 查看: 12451| 评论: 6|来自: Anywlan

uboot一个小型的linux核心,其命令非常丰富,本文收集了常用的命令和操作供大家参考。
十六、下载与烧写


使用U-boot将映像文件烧写到板上的Flash,一般步骤是:
(1)通过网络、串口、U盘、SD卡等方式将文件传输到SDRAM;
(2)使用Nand Flash或Nor Flash相关的读写命令将SDRAM中的数据烧入Flash。

下面是烧写范例:
如果使用 SD卡和U盘形式更新U-boot,那么首先SD卡和U盘中必须有FAT32文件系统,并在里面存放了u-boot.bin 文件。
1) 通过SD卡烧入Nand Flash:
[u-boot@MINI2440]# mmc init
mmc: Probing for SDHC ...
mmc: SD 2.0 or later card found
trying to detect SD Card...
Manufacturer:
0x00, OEM "roduct name:
"
", revision 0.0

Serial number:
7864775

Manufacturing date: 11/2006
CRC:
0x4f, b0 = 1

READ_BL_LEN=6, C_SIZE_MULT=7, C_SIZE=4095
size = 0
SD Card detected RCA: 0x2 type: SD
mmc1 is available
[u-boot@MINI2440]# fatload mmc 1 0x30008000 u-boot.bin
reading u-boot.bin

256220 bytes read
[u-boot@MINI2440]# nand erase 0 0x40000

NAND erase: device 0 offset 0x0, size 0x40000
Erasing at 0x2000000000004 --
0% complete.

OK
[u-boot@MINI2440]# nand write 0x30008000 0 0x40000

NAND write: device 0 offset 0x0, size 0x40000
Writing at 0x2000000020000 -- 100% is complete. 262144 bytes written: OK

2) 通过U盘烧入Nor Flash:
[u-boot@MINI2440]# usb start
(Re)start USB...
USB:
scanning bus for devices... 2 USB Device(s) found


scanning bus for storage devices... 1 Storage Device(s) found

[u-boot@MINI2440]# usb storage

Device 0
: Vendor: Kingston Rev: PMAP Prod: DT 101 II


Type: Removable Hard Disk


Capacity: 3875.0 MB = 3.7 GB (7936000 x 512)

[u-boot@MINI2440]# usb part 0
print_part of 0

Partition Map for USB device 0
--
Partition Type: DOS


Partition
Start Sector
Num Sectors
Type



4


63

7935937
c


[u-boot@MINI2440]# fatload usb 0:4 0x30008000 u-boot.bin

reading u-boot.bin
........................

256220 bytes read
[u-boot@MINI2440]# protect off all
Un-Protect Flash Bank # 1
[u-boot@MINI2440]# erase 0x0 0x3ffff
Erasing sector
0 ... ok.

Erasing sector
1 ... ok.

Erasing sector
2 ... ok.

Erasing sector
3 ... ok.

Erased 4 sectors
[u-boot@MINI2440]# cp.b 0x30008000 0x0
0x3ffff

Copy to Flash... done

3) 通过TFTP服务烧入Nand Flash:
[u-boot@MINI2440]# tftpboot 30008000 192.168.1.100:u-boot.bin
dm9000 i/o: 0x20000300, id: 0x90000a46 
DM9000: running in 16 bit mode
MAC: 08:08:11:18:12:27
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 192.168.1.100; our IP address is 192.168.1.101
Filename 'u-boot.bin'.
Load address: 0x30008000
Loading: T ##################
done
Bytes transferred = 256220 (3e8dc hex)
[u-boot@MINI2440]# nand erase 0 0x40000
NAND erase: device 0 offset 0x0, size 0x40000
Erasing at 0x2000000000004 --
0% complete.

OK
[u-boot@MINI2440]# nand write 0x30008000 0 0x40000

NAND write: device 0 offset 0x0, size 0x40000
Writing at 0x2000000020000 -- 100% is complete. 262144 bytes written: OK

4) 通过NFS 服务烧入Nand Flash:

[u-boot@MINI2440]# nfs 30008000 192.168.1.100:/home/tekkaman/development/share/u-boot.bin
dm9000 i/o: 0x20000300, id: 0x90000a46 
DM9000: running in 16 bit mode
MAC: 08:08:11:18:12:27
operating at 100M full duplex mode
Using dm9000 device
File transfer via NFS from server 192.168.1.100; our IP address is 192.168.1.101
Filename '/home/tekkaman/development/share/u-boot.bin'.
Load address: 0x30008000
Loading: ###################################################
done
Bytes transferred = 256220 (3e8dc hex)
[u-boot@MINI2440]# nand erase 0 0x40000
NAND erase: device 0 offset 0x0, size 0x40000
Erasing at 0x2000000000004 --
0% complete.

OK
[u-boot@MINI2440]# nand write 0x30008000 0 0x40000

NAND write: device 0 offset 0x0, size 0x40000
Writing at 0x2000000020000 -- 100% is complete. 262144 bytes written: OK


19

高人
2

专业

握手

霸气

雷人

吐血

山寨

奋斗

刚表态过的朋友 (21 人)

发表评论

最新评论

引用 gd28084646 2016-10-26 19:04
看不懂
引用 deepinwl 2016-8-8 01:37
搞成一个PDF文件更好学与用吧
引用 deepinwl 2016-8-8 01:35
与CISCO的IOS一样的啦
引用 below63 2016-6-29 13:07
但是uboot已经不再更新了/微笑
引用 wyzabc110 2016-6-28 22:13
学习下...............
引用 modi5156 2016-6-28 21:53
菜鸟来学习下!灰常感谢大神科普

查看全部评论(6)

文章栏目
论坛新贴
今日热议
本周排行
最新文章

站点统计 | Archiver | 手机版 | 无线门户 ( 粤ICP备11076993号|粤公网安备44010602008359号 ) |网站地图

GMT+8, 2025-5-1 22:21

返回顶部