u-boot 下tf卡sd卡U盘读取指令

1. tf 开

1) 查看:fatls mmc 0 [目录(默认根目录)]

2) 把tf卡的内容读取到内存:fatload mmc 0 0x40000000 <file>

2. u 盘(暂时还没测试)

1) 查看:fatls usb 0 [目录(默认根目录)]

2) 把tf卡的内容读取到内存:fatload usb 0 0x40000000 <file>

/*================= 下面是转载的 uboot中挂载U盘命令 =================*/

主要说明在uboot下实现对USB设备的识别、挂载和使用的命令操作。

实验环境

Atmel公司的SAM5D3X_plained,原装系统uboot版本为U-Boot 2015.01-linux4sam_4.7;

U盘需要是fat32文件系统。

uboot下U盘操作命令

uboot挂载U盘、查看USB设备的命令:(使用help usb可以查看uboot支持的usb命令)

1. 将U盘插入USB接口后,执行usb start命令或usb reset命令;

2. 使用usb dev命令查看检测到的USB设备;

3. 使用usb info 命令可以列出板子上USB主接口的属性;

4. 使用usb storage可以列出U盘的设备信息;

5. 使用usb tree可以列出Device Tree;

6. 使用usb part可以列出U盘设备的分区信息;

7. 在U盘使用结束后,使用usb stop停止设备。

U-Boot> usb start
(Re)start USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
U-Boot> usb dev
USB device 0: Vendor: SSK      Rev: 1.00 Prod: SFD199
            Type: Removable Hard Disk
            Capacity: 3824.0 MB = 3.7 GB (7831552 x 512)
U-Boot> usb info
...
2: Mass Storage,  USB Revision 2.0
 - SSK                            SSK SFD199 USB Device          00000000000002EC
...
U-Boot> usb storage
  Device 0: Vendor: SSK      Rev: 1.00 Prod: SFD199
            Type: Removable Hard Disk
            Capacity: 3824.0 MB = 3.7 GB (7831552 x 512)
U-Boot> usb tree
USB device tree:
  1  Hub (480 Mb/s, 0mA)
  |  u-boot EHCI Host Controller
  |
  +-2  Mass Storage (480 Mb/s, 500mA)
       SSK                            SSK SFD199 USB Device          00000000000002EC
U-Boot> usb part
Partition Map for USB device 0  --   Partition Type: DOS
Part    Start Sector    Num Sectors     UUID            Type
  4     256             7831296         cad4ebea-04     0b Boot
U-Boot>

uboot查看U盘文件需要借助fat文件系统,使用的命令也是fat命令:

1. 查看U盘的信息使用fatinfo命令:fatinfo usb *;

2. 查看U盘的文件使用fatls命令:fatls usb *;

3. 读取U盘中文件使用fatload命令:fatload usb * x3000000 uboot.bin。

U-Boot> fatls usb 0:4           /  这里使用了usb part输出的信息,device 0:Part4  /
...
5 file(s), 9 dir(s)
U-Boot> fatinfo usb 0:4
Interface:  USB
  Device 0: Vendor: SSK      Rev: 1.00 Prod: SFD199
            Type: Removable Hard Disk
            Capacity: 3824.0 MB = 3.7 GB (7831552 x 512)
Filesystem: FAT32 "Ubuntu 12.0"
U-Boot> fatload usb 0:4 0x22000000 wubi.exe
reading wubi.exe
2511520 bytes read in 183 ms (13.1 MiB/s)
U-Boot>

这里比较关键的是获取U盘对应的usb标识,当有两个U盘的时候,效果如下:

U-Boot> usb start
(Re)start USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 3 USB Device(s) found
       scanning usb for storage devices... 2 Storage Device(s) found
U-Boot> usb part
Partition Map for USB device 0  --   Partition Type: DOS
Part    Start Sector    Num Sectors     UUID            Type
  1     32              15633376        728e93ad-01     0b
Partition Map for USB device 1  --   Partition Type: DOS
Part    Start Sector    Num Sectors     UUID            Type
  4     256             7831296         cad4ebea-04     0b Boot
U-Boot> fatls usb 1:4                             /  上一步骤周的0:4这里已经是1:4  /
...
5 file(s), 9 dir(s)
U-Boot> fatls usb 0:1                             /  新增的U盘的标识                  /
...
9 file(s), 4 dir(s)
U-Boot>

了解U盘操作后,设置从U盘启动就很简单了。

发布了120 篇原创文章 · 获赞 44 · 访问量 71万+

猜你喜欢

转载自blog.csdn.net/qiaoliang328/article/details/101297603