Skip to contentSkip to conversation

Error reading cluster" from fs/fat/fat.c

U-Boot Oliver Graute 1 participant 3 messages Aug 22, 2019 – Aug 28, 2019

lore
Share & tools
lore
#0 lore raw

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,

Oliver

#1 lore raw
Quoted 18 lines · Oliver Graute

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
Quoted 6 lines

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().

After some more digging I found out that this error is related to the file size. I can fatload files up to 16MB but no files with 24MB like the Kernel Image. Is there some limitation somewhere?

U-Boot 2019.07-00001-g1c0a4f90ca-dirty (Aug 26 2019 - 08:36:06 +0200)

CPU: NXP i.MX8QM RevB A53 at 1200 MHz

Model: Advantech iMX8QM Qseven series
Board: ROM-7720-A1 4GB
Build: SCFW 65afe5f6
Boot:  SD2
DRAM:  3.9 GiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 2

Loading Environment from MMC... *** Warning - bad CRC, using default environment

In:    serial at 5a060000
Out:   serial at 5a060000
Err:   serial at 5a060000
Net:   eth0: ethernet at 5b040000Could not get PHY for FEC1: addr 1

, eth-1: ethernet at 5b050000
Hit any key to stop autoboot: 0
=> fatls mmc 2:1
dtbs/

 24838656   Image
 10671566   Image.gz
 18734584   initramfs-linux-fallback.img
  7263143   initramfs-linux.img
    19136   imx8qm-rom7720-a1.dtb
   102464   hdmitxfw.bin
  1048576   1mb.txt
  2097152   2MB.txt
   524288   512kb.txt
   786432   768kb.txt
 16777216   16MB.txt
 25165824   24MB.txt
  4194304   4MB.txt
  8388608   8MB.txt

14 file(s), 1 dir(s)

=> fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} 512kb.txt 524288 bytes read in 33 ms (15.2 MiB/s)
=> fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} 768kb.txt 786432 bytes read in 43 ms (17.4 MiB/s)
=> fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} 1mb.txt 1048576 bytes read in 58 ms (17.2 MiB/s)
=> fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} 2mb.txt 2097152 bytes read in 98 ms (20.4 MiB/s)
=> fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} 4mb.txt 4194304 bytes read in 190 ms (21.1 MiB/s)
=> fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} 8mb.txt 8388608 bytes read in 365 ms (21.9 MiB/s)
=> fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} 16mb.txt 16777216 bytes read in 724 ms (22.1 MiB/s)
=> fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} 24mb.txt Error reading cluster 3
** Unable to read file 24mb.txt **
=>

Best regards,

Oliver

#2 lore raw
Quoted 7 lines · Oliver Graute
Quoted 6 lines · Oliver Graute

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

Quoted 5 lines
Quoted 5 lines

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

this error occurs especially on this Swissbit SD-Card (industrial card)

=> mmcinfo
Device: FSL_SDHC
Manufacturer ID: 5d
OEM: 5342
Name: L1BM1
Bus Speed: 50000000
Mode: SD High Speed (50MHz)
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: 3.7 GiB
Bus Width: 4-bit
Erase Group Size: 512 Bytes

another San-Disk SD-Card (consumer) I tried is working fine with same u-boot image. So it looks for me for a wired hw/timing issue.

=> mmcinfo
Device: FSL_SDHC
Manufacturer ID: 13
OEM: 14e
Name: Q2J55
Bus Speed: 52000000
Mode: MMC High Speed (52MHz)
Rd Block Len: 512
MMC version 5.0
High Capacity: Yes
Capacity: 7.1 GiB
Bus Width: 8-bit
Erase Group Size: 512 KiB
HC WP Group Size: 8 MiB
User Capacity: 7.1 GiB WRREL
Boot Capacity: 16 MiB ENH
RPMB Capacity: 4 MiB ENH

Best Regards,

Oliver