技术专栏
海思Hi35xx 通过uboot 读取U盘文件进行固件升级
前言
基本过程为:uboot 启动后,通过命令将U盘的的文件读取到内存中,再通过uboot 的flash 写入命令将读取到内存中的升级文件写入到flash的固定位置。
(一)usb常用命令
uboot一般支持对usb的操作命令有:start,reset,stop,tree,info,storage,dev,part,read,write
等。
Usage:
usb start - start (scan) USB controller
usb reset - reset (rescan) USB controller
usb stop [f] - stop USB [f]=force stop
usb tree - show USB device tree
usb info [dev] - show available USB devices
usb storage - show details of USB storage devices
usb dev [dev] - show or set current USB storage device
usb part [dev] - print partition table of one or all USB storage devices
usb read addr blk# cnt - read `cnt' blocks starting at block `blk#' to memory address `addr'
usb write addr blk# cnt - write `cnt' blocks starting at block `blk#' from memory address `addr'
1.usb start
Wisdom # usb start
(Re)start USB...
USB: scanning bus for devices...
2 USB Device(s) found
scanning bus for storage devices... iVendor 0 iProduct 0
iVendor 5E3 iProduct 727
ss->subclass : 0x6
usb_stor_get_info->1496,blksz:512
1 Storage Device(s) found
Wisdom #
2.usb tree
Wisdom # usb tree
Device Tree:
1 Hub (12 Mb/s, 0mA)
| OHCI Root Hub
|
+-2 Mass Storage (12 Mb/s, 500mA)
Generic USB Storage 000000000250
3.usb infor
Wisdom #
Wisdom # usb info
1: Hub, USB Revision 1.10
- OHCI Root Hub
- Class: Hub
- PacketSize: 8 Configurations: 1
- Vendor: 0x0000 Product 0x0000 Version 0.0
Configuration: 1
- Interfaces: 1 Self Powered 0mA
Interface: 0
- Alternate Setting 0, Endpoints: 1
- Class Hub
- Endpoint 1 In Interrupt MaxPacket 2 Interval 255ms
2: Mass Storage, USB Revision 2.0
- Generic USB Storage 000000000250
- Class: (from Interface) Mass Storage
- PacketSize: 64 Configurations: 1
- Vendor: 0x05e3 Product 0x0727 Version 2.80
Configuration: 1
- Interfaces: 1 Bus Powered 500mA
Interface: 0
- Alternate Setting 0, Endpoints: 2
- Class Mass Storage, Transp. SCSI, Bulk only
- Endpoint 1 In Bulk MaxPacket 64
- Endpoint 2 Out Bulk MaxPacket 64
4.usb part
Wisdom # usb part
index: 0
Partition Map for USB device 0 -- Partition Type: DOS
Partition Start Sector Num Sectors Type
1 8192 7618560 b
index: 1
Wisdom #
5.usb storage
Wisdom # usb storage
Device 0: Vendor: Generic Rev: 0250 Prod: STORAGE DEVICE
Type: Removable Hard Disk
Capacity: 3724.0 MB = 3.6 GB (7626752 x 512)
Wisdom #
(二)U盘升级操作
1. usb start 开始usb 操作
Wisdom # usb start
(Re)start USB...
USB: scanning bus for devices...
2 USB Device(s) found
scanning bus for storage devices... iVendor 0 iProduct 0
iVendor 5E3 iProduct 727
ss->subclass : 0x6
usb_stor_get_info->1496,blksz:512
1 Storage Device(s) found
2. fatls usb 0 查看usb 中的文件
Wisdom # fatls usb 0
index: 0
.trash-1000/
4.8.7/
5.9.0/
20190323/
dejavu/
fb/
install/
mouse/
qt_4.8_install/
rules.d/
935839 gui_test
727 profile
3671576 uidemo18
3190568 uimage
4 file(s), 10 dir(s)
Wisdom #
3. 擦除内存中的一块空间用来放置升级文件:
将0x82000000开始的 4M空间填上0xFF
mw.b 82000000 ff 400000
4. 加载usb的升级文件到内存
fatload usb 0 0x82000000 uimage
5. 擦除flash中原来的数据
nand erase 100000 400000
6. 将内存中的升级文件写入到flash中去
nand write 82000000 100000 400000
3~6操作过程
Wisdom # mw.b 82000000 ff 400000
Wisdom # fatload usb 0 0x82000000 uimage
index: 0
##########################################################################################################################################################################################
3190568 bytes read
Wisdom # nand erase 100000 400000
NAND erase: device 0 offset 0x100000, size 0x400000
Erasing at 0x4e0000 -- 100% complete.
OK
Wisdom # nand write 82000000 100000 400000
NAND write: device 0 offset 0x100000, size 0x400000
4194304 bytes written: OK
Wisdom #
全部升级操作命令:
usb start
fatls usb 0
mw.b 82000000 ff 400000
fatload usb 0 0x82000000 uimage
nand erase 100000 400000
nand write 82000000 100000 400000
声明:本文内容由易百纳平台入驻作者撰写,文章观点仅代表作者本人,不代表易百纳立场。如有内容侵权或者其他问题,请联系本站进行删除。
红包
1
收藏
评论
打赏
- 分享
- 举报
评论
0个
手气红包
暂无数据
相关专栏
-
浏览量:794次2023-11-06 16:38:09
-
浏览量:1299次2023-11-06 15:17:14
-
浏览量:4459次2020-07-27 16:34:42
-
浏览量:2509次2020-08-26 17:32:45
-
浏览量:865次2023-11-24 16:31:45
-
浏览量:2012次2020-08-04 20:24:33
-
浏览量:930次2024-01-05 10:33:11
-
浏览量:870次2023-10-25 15:43:39
-
浏览量:914次2023-10-26 15:18:07
-
浏览量:1007次2023-10-26 15:06:55
-
浏览量:2707次2020-08-04 20:12:26
-
浏览量:2275次2020-08-04 20:26:22
-
浏览量:3575次2020-07-27 15:12:15
-
浏览量:3671次2020-07-28 10:49:06
-
浏览量:4515次2020-07-30 10:26:53
-
浏览量:2683次2020-07-28 17:54:29
-
浏览量:3775次2020-03-03 22:16:15
-
浏览量:2786次2020-07-31 15:13:59
-
浏览量:6761次2020-09-27 14:15:09
置顶时间设置
结束时间
删除原因
-
广告/SPAM
-
恶意灌水
-
违规内容
-
文不对题
-
重复发帖
打赏作者
JQ
您的支持将鼓励我继续创作!
打赏金额:
¥1
¥5
¥10
¥50
¥100
支付方式:
微信支付
打赏成功!
感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
审核成功
发布时间设置
发布时间:
请选择发布时间设置
是否关联周任务-专栏模块
审核失败
失败原因
请选择失败原因
备注
请输入备注