u-boot中的FAT命令

 [u-boot: v2013.04]
 
[Author: Bo Shen <voice.shen@gmail.com>]
 
1. Source Code
 
<common/cmd_fat.c>
 
此文件中定义了四个命令:fatload,fatls,fatinfo是定义"#define CONFIG_CMD_FAT"后就包括了。而fatwrite是需要再定义"#define CONFIG_FAT_WRITE"才会出现。
 
 
 
2. Usage
 
在使用FAT相关命令的时候,一定会有FAT文件系统的存储设备,此处举例使用U盘。
 
 
 
U-Boot> fatinfo  usb 0
 
Interface: USB
 
Device 0: Vendor: Kingston Rev: PMAP Prod: DataTraveler G3
 
Type: Removable Hard Disk
 
Capacity: 7441.6 MB = 7.2 GB (15240576 x 512)
 
Filesystem: FAT32 "KINGSTON "
 
U-Boot> fatls  usb 0
 
166 autorun.inf
 
39334 tbi.png
 
43134 tbi_2.png
 
43006 tms.png
 
55191 tck.png
 
57357 rtck.png
 
53981 tdo.png
 
7 file(s), 0 dir(s)
 
 
 
U-Boot> fatload   usb 0 0x20000000 tbi.png
 
reading tbi.png
 
39334 bytes read in 161ms (244.3 KiB/s)
 
 
 
3. Source Code go through
 
3.1 fatls --> do_fat_ls <common/cmd_fat.c> --> do_ls <fs/fs.c> --> fs_set_blk_dev <fs/fs.c> --> fs_ls <fs/fs.c> --> return 0;
 
3.1.1 fs_set_blk_dev <fs/fs.c> --> get_device_and_partition <disk/part.c> --> (callback: fstype_info->probe) <fs/fs.c>
 
3.1.2 fs_ls <fs/fs.c> --> fs_get_info <fs/fs.c> --> (callback: fstype_info->ls) <fs/fs.c>
 
 
 
3.2 fatinfo --> do_fat_fsinfo <common/cmd_fat.c> --> get_device_and_partition <disk/part.c> --> fat_set_blk_dev <fs/fat/fat.c> --> file_fat_detectfs <fs/fat/fat.c>
 
3.2.1 fat_set_blk_dev <fs/fat/fat.c> --> disk_read <fs/fat/fat.c>
 
3.2.2 file_fat_detectfs <fs/fat/fat.c> --> dev_print <disk/part.c> --> read_bootsectandvi <fs/fat/fat.c>
 
 
 
3.3 fatload --> do_fat_fsload --> do_load <fs/fs.c> --> fs_set_blk_dev < fs/fs.c> --> fs_read (callback: fstype_info->read

本篇文章来源于 Linux公社网站(www.linuxidc.com)  原文链接:http://www.linuxidc.com/Linux/2013-05/84186.htm

Logo

更多推荐