[PATCH 2/4] spl: mmc: Account for SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE being a choice

Chee, Tien Fong tienfong.chee at altera.com
Tue Nov 25 04:58:30 CET 2025


Hi Jan,

On 15/11/2025 1:13 am, Jan Kiszka wrote:
> [CAUTION: This email is from outside your organization. Unless you trust the sender, do not click on links or open attachments as it may be a fraudulent email attempting to steal your information and/or compromise your computer.]
>
> From: Jan Kiszka <jan.kiszka at siemens.com>
>
> Add SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE as condition where so
> far SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION was enough - though often
> by chance as both options were enabled.
>
> We also need to explicitly select SPL_LOAD_BLOCK when UES_PARTITION_TYPE
> is enabled, just like the other choices do.
>
> Fixes: 2a00d73d081a ("spl: mmc: Try to clean up raw-mode options")
> Signed-off-by: Jan Kiszka <jan.kiszka at siemens.com>
> ---
>   common/spl/Kconfig   |  1 +
>   common/spl/spl_mmc.c | 16 ++++++++--------
>   include/part.h       |  3 ++-
>   3 files changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> index 8dade2b501e..d24466b0c66 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -573,6 +573,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
>
>   config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE
>          bool "MMC raw mode: by partition type"
> +       select SPL_LOAD_BLOCK
>          depends on DOS_PARTITION
>          help
>            Use partition type for specifying U-Boot partition on MMC/SD in
> diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
> index 467114f8d9a..09e881c464c 100644
> --- a/common/spl/spl_mmc.c
> +++ b/common/spl/spl_mmc.c
> @@ -106,7 +106,8 @@ static int spl_mmc_find_device(struct mmc **mmcp, int mmc_dev)
>          return 0;
>   }
>
> -#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
> +#if defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION) || \
> +    defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE)
>   static int mmc_load_image_raw_partition(struct spl_image_info *spl_image,
>                                          struct spl_boot_device *bootdev,
>                                          struct mmc *mmc, int partition,
> @@ -415,19 +416,18 @@ int spl_mmc_load(struct spl_image_info *spl_image,
>
>                  raw_sect = spl_mmc_get_uboot_raw_sector(mmc, raw_sect);
>
> -#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
> -               ret = mmc_load_image_raw_partition(spl_image, bootdev,
> -                                                  mmc, raw_part,
> -                                                  raw_sect);
> -               if (!ret)
> -                       return 0;
> -#endif
>   #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
>                  ret = mmc_load_image_raw_sector(spl_image, bootdev, mmc,
>                                                  raw_sect +
>                                                  spl_mmc_raw_uboot_offset(part));
>                  if (!ret)
>                          return 0;
> +#else


There is a build issue when CONFIG_SYS_MMCSD_RAW_MODE is disabled.


common/spl/spl_mmc.c: In function ‘spl_mmc_load’: 
common/spl/spl_mmc.c:426:9: error: implicit declaration of function 
‘mmc_load_image_raw_partition’; did you mean 
‘mmc_load_image_raw_sector’? [-Werror=implicit-function-declaration] ret 
= mmc_load_image_raw_partition(spl_image, bootdev, 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~ mmc_load_image_raw_sector cc1: some 
warnings being treated as errors make[2]: *** 
[scripts/Makefile.build:297: spl/common/spl/spl_mmc.o] Error 1 make[2]: 
*** Waiting for unfinished jobs....



In spl_mmc.c, the block currently guarded by #else should instead be:


#elif defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION) || \
       defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE)

Otherwise, mmc_load_image_raw_partition() becomes visible only in that 
branch, leading to:


error: implicit declaration of function ‘mmc_load_image_raw_partition’

This happens when both USE_SECTOR and USE_PARTITION{,_TYPE} are turned off.

Correcting the #else to #elif resolves the compilation error.

Thanks,
Tien Fong



More information about the U-Boot mailing list