[PATCH v2 3/9] spl: Convert fat to spl_load

Sean Anderson sean.anderson at seco.com
Thu May 5 20:53:55 CEST 2022



On 5/5/22 11:38 AM, Tom Rini wrote:
> On Thu, May 05, 2022 at 10:51:39AM -0400, Sean Anderson wrote:
>> Hi Tom,
>> 
>> On 5/4/22 8:06 PM, Tom Rini wrote:
>> > On Fri, Apr 22, 2022 at 02:27:41PM -0400, Sean Anderson wrote:
>> > 
>> >> This converts the fat loader to use spl_load.
>> >> 
>> >> Signed-off-by: Sean Anderson <sean.anderson at seco.com>
>> >> Reviewed-by: Stefan Roese <sr at denx.de>
>> > 
>> > On am335x_evm_defconfig, and booting from a FAT SD card I see:
>> > Trying to boot from MMC1
>> > spl_load_image_fat: error reading image u-boot.img, err - 0
>> > SPL: failed to boot from all boot devices
>> > ### ERROR ### Please RESET the board ###
>> 
>> Looks like spl_load_image_fat was expecting bytes read and
>> not an errno (and so turned your success into a failure). Will fix.
> 
> OK.
> 
>> > Note that while not _this_ patch (but likely the one for raw) breaks
>> > booting from my mx6cuboxi via SD card with:
>> > Trying to boot from MMC1
>> > [hang]
>> > 
>> 
>> Hm, if there's a problem you should at least see
>> "mmc_load_image_raw_sector: mmc block read error\n"
>> 
>> Could you enable DEBUG in common/spl/spl.c and common/spl/spl_mmc.c?
> 
> U-Boot SPL 2022.07-rc1-00267-g064334e21dde-dirty (May 05 2022 - 11:33:38 -0400)
>>>SPL: board_init_r()
> spl_init
> Trying to boot from MMC1
> spl: mmc boot mode: raw
> hdr read sector 8a, count=1
> 

Looks like there's a bug in spl_simple_read

	size_t bl_len = info->filename ? ARCH_DMA_MINALIGN : bl_len;

should be

	size_t bl_len = info->filename ? ARCH_DMA_MINALIGN : info->bl_len;

The funny thing is that this kind of bug results in a -Wuninitialized warning
on godbolt [1] but *not* from my installed gcc 9.4... Not sure what's going on
there.

In other bugs, there was also a problem calculating bl_shift (ffs instead of fls).
I probably should have tested this the first two times around, but I now have a "raw"
MMC working. I expect that there are probably some similar bugs lurking in spi/net/nor.
I will try and test net, but I don't think I have any spi/nor boards I can test with.

--Sean

[1] https://godbolt.org/z/fnaGKvTMr


More information about the U-Boot mailing list