Failedto read big file with "Invald FAT entry' from USB disk (FAT16)

target simitel at 163.com
Wed Oct 25 02:00:37 CEST 2023


I am using u-boot 2017.03 in my system and enabled the debug in fs/fat/fat.c
I had a USB disk formatted in FAT16 in Linux, I put a bigfile.bin into / in the USB disk and plugged the disk into by board.
Then I want to read/load the bigfile.bin into RAM with u-boot's fatload command, I did followings.


# usb reset
# fatls usb 0, it showd,
VFAT Support enabled
FAT16, fat_sect: 128, fatlength: 128
Rootdir begins at cluster: 0, sector: 384, offset: 30000
Data begins at: 256
Sector size: 512, cluster size: 128
FAT read(sect=384, cnt:2), clust_size=128, DIRENTSPERBLOCK=16
 36438016   bigfile.bin
     1012   s01syslogd
     1004   s02klogd
     1876   s02sysctl
     1684   s20urandom
      214   s21mount
END LOOP: buffer_blk_cnt=0   clust_size=128
FAT read(sect=385, cnt:2), clust_size=128, DIRENTSPERBLOCK=16
     1635   s30dbus
      438   s40network
RootDentname == NULL - 13


8 file(s), 0 dir(s)
# fatload usb 0 0x100000 bigfile.bin
reading bigile.bin
VFAT Support enabled
FAT16, fat_sect: 128, fatlength: 128
Rootdir begins at cluster: 0, sector: 384, offset: 30000
Data begins at: 256
Sector size: 512, cluster size: 128
FAT read(sect=384, cnt:2), clust_size=128, DIRENTSPERBLOCK=16
Rootvfatname: |bigfile.bin|
RootName: bigfile.bin, start: 0x3, size:  0x22c0000
Filesize: 36438016 bytes
36438016 bytes
FAT16: entry: 0x0003 = 3, offset: 0x0003 = 3
FAT16: ret: 00000004, offset: 0003
FAT16: entry: 0x0004 = 4, offset: 0x0004 = 4
FAT16: ret: 00000005, offset: 0004
FAT16: entry: 0x0005 = 5, offset: 0x0005 = 5
FAT16: ret: 00000006, offset: 0005
FAT16: entry: 0x0006 = 6, offset: 0x0006 = 6
FAT16: ret: 00000007, offset: 0006
FAT16: entry: 0x0007 = 7, offset: 0x0007 = 7
FAT16: ret: 00000008, offset: 0007
FAT16: entry: 0x0008 = 8, offset: 0x0008 = 8
FAT16: ret: 00000009, offset: 0008
FAT16: entry: 0x0009 = 9, offset: 0x0009 = 9
FAT16: ret: 0000000a, offset: 0009
.....
.....
FAT16: entry: 0x020e = 526, offset: 0x020e = 526
FAT16: ret: 0000020f, offset: 020e
FAT16: entry: 0x020f = 527, offset: 0x020f = 527
FAT16: ret: 00000210, offset: 020f
FAT16: entry: 0x0210 = 528, offset: 0x0210 = 528
FAT16: ret: 0000ffff, offset: 0210
gc - clustnum: 3, startsect: 640
FAT16: entry: 0x0210 = 528, offset: 0x0210 = 528
FAT16: ret: 0000ffff, offset: 0210
curclust: 0xffff
Invalid FAT entry
Size: 36438016, got: 34471936


I have tried many times, even with "fatload usb 0 0x100000 bigfile.bin 2000000", it still failed with above error.
I can not test newer version of u-boot, since there are lots of old drivers I am using.







More information about the U-Boot mailing list