Something doesn't make sense with SPL_FIT and SPL_LOAD_FIT

Alex G. mr.nuke.me at gmail.com
Thu Oct 8 17:56:10 CEST 2020


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) &&




More information about the U-Boot mailing list