From: Alex G. Date: Thu, 8 Oct 2020 10:56:10 -0500 Subject: Something doesn't make sense with SPL_FIT and SPL_LOAD_FIT Message-ID: <526d4305-8ac2-0023-52cb-a6ddf59e3173@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 $ 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) &&