Skip to contentSkip to conversation

Something doesn't make sense with SPL_FIT and SPL_LOAD_FIT

DISCUSSION Alex G. 1 participant 1 message Oct 8, 2020

lore
Share & tools
lore

Alex G.

author
#0 lore raw

Hi,

I think there's something wrong with the implementation distinction of SPL_FIT and SPL_LOAD_FIT.

CONFIG_SPL_FIT:
* Support Flattened Image Tree within SPL
CONFIG_SPL_LOAD_FIT:
* This option instead enables generation of a FIT (Flat Image Tree) which provides more flexibility.

I would expect that enabling SPL_FIT _alone_ will allow SPL to load FIT images. However, that's not what the code implements:

common/spl/spl_mmc.c:

	int mmc_load_image_raw_sector(...)
	{
		if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
		    image_get_magic(header) == FDT_MAGIC) {

In order to "Support Flattened Image Tree within SPL" we actually need to enable SPL_LOAD_FIT. This has the side effect of making the u-boot image a FIT, which we may or may not want. I think the correct code should say:

if (IS_ENABLED(CONFIG_SPL_FIT))

Is this something that was overlooked (for so many years)? Is there something I'm missing?

Alex

Appendix A: Occurences of SPL_FIT vs SPL_LOAD_FIT

$ git grep '(IS_ENABLED(CONFIG_SPL_FIT)' -- common/spl
<no results>
$ git grep '(IS_ENABLED(CONFIG_SPL_LOAD_FIT)' -- common/spl
common/spl/spl_fat.c:   } else if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
common/spl/spl_mmc.c:   if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
common/spl/spl_nand.c:  if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
common/spl/spl_net.c:   if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
common/spl/spl_ram.c:   if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
common/spl/spl_spi.c:           } else if 
(IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
common/spl/spl_ymodem.c:        } else if 
(IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
common/spl/spl_ymodem.c:        if (!(IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&