[U-boot: v2013.04]
[Author: Bo Shen <voice.shen@gmail.com>]
1. Source Code
<Common/cmd_fat.c>
This file defines four commands: fatload, fatls, and fatinfo: Definition "# define
Config_pai_fat "is included. Fatwrite requires "# define config_fat_write" to appear.
2. Usage
When using fat-related commands, there must be a storage device of the FAT file system. Here, we use a USB flash disk as an example.
U-boot> fatinfousb 0 interface: USB device 0: Vendor: Kingston Rev: pmap prod: datatraveler G3 type: removable hard disk capacity: 7441.6 MB = 7.2 GB (15240576x512) filesystem: FAT32 "Kingston" U-boot> fatlsusb 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> fatloadusb 0 0x20000000 tbi.png reading tbi.png 39334 bytes read in 161 Ms (244.3 kib/S) 3. source code go through3.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/common_fat.c> --> get_device_and_partition <Disk/part. c> --> fat_set_blk_dev <fs/fat. c> --> file_fat_detectfs <fs/fat. c> 3.2.1 fat_set_blk_dev <fs/fat. c> --> disk_read <fs/fat. c> 3.2.2 file_fat_detectfs <fs/fat. c> --> dev_print <Disk/part. c> --> read_bootsectandvi <fs/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)