[U-Boot] Error reading cluster" from fs/fat/fat.c

Oliver Graute oliver.graute at kococonnector.com
Thu Aug 22 09:47:12 UTC 2019

Hello list,

I have a annoying problem with u-boot 2019.07. I try to boot a Linux
Image from a fat16 partition on a SD-Card. But I got the "Error reading
cluster" Message from fs/fat/fat.c

=> boot
switch to partitions #0, OK
mmc2 is current device
Error reading cluster
** Unable to read file Image **

=> mmc part
Partition Map for MMC device 2  --   Partition Type: DOS
Part    Start Sector    Num Sectors     UUID            Type
  1     16384           266240          d38187c8-01     06
  2     282624          7491584         d38187c8-02     83

After some debugging I end up in blk_dread() from drivers/block/blk-uclass.c

blks_read = ops->read(dev, start, blkcnt, buffer);

here I got blks_read=0 which seems is the cause for the "Error reading cluster"
later in get_cluster().

Here a Debug Trace with some variables printed out:

get_fatent() FAT16: entry: 0x0000595c = 22876, offset: 0x055c = 1372
get_fatent() FAT16: ret: 0x0000595d, entry: 0x0000595c, offset: 0x055c
get_cluster() gc - clustnum: 16813, startsect: 134800
blkcache_read() miss: start 24e90, count 48513
blk_dread() dev=fd6ebaa0
blk_dread() start=24e90
blk_dread() blkcnt=48513
blk_dread() buffer=80280000
blk_find_device() blk_find_device: if_type=6, devnum=2: usdhc at 5b010000.blk, 6, 0
blk_find_device() blk_find_device: if_type=6, devnum=2: usdhc at 5b030000.blk, 6, 2
blk_dread() blks_read=0
blk_dread() blkcnt=48513
disk_read() ret=0
disk_read() nr_blocks=48513
get_cluster() Error reading data (got -1) 2
get_cluster() ret=-1
get_cluster() idx=48513
Error reading cluster 2
** Unable to read file Image **

Can somebody help me to find the cause of this problem? Is something
with my fat partion or partition table wrong or do I hit a bug?

Best regards,


More information about the U-Boot mailing list