[U-Boot] [PATCH 1/2] env_mmc: make board configurable the partition for the environment

Otavio Salvador otavio at ossystems.com.br
Wed Jan 15 12:09:08 CET 2014


Hello Hector,

On Wed, Jan 15, 2014 at 8:53 AM, Hector Palacios
<hector.palacios at digi.com>wrote:

> This complements commit 9404a5fc7cb58 "env_mmc: allow environment to be
> in an eMMC partition" by allowing boards to accommodate the partition
> to use for the environment in different scenarios (similarly to what is
> done with the mmc dev number). Depending on the detected boot media,
> boards may decide to store the environment in a different partition.
>
> The __weak function also allows to remove some ifdefs from the code.
> If CONFIG_SYS_MMC_ENV_PART is not defined, partition 0 is assumed
> (default value for U-Boot when a partition is not provided).
>
> Signed-off-by: Hector Palacios <hector.palacios at digi.com>
> CC: Stephen Warren <swarren at nvidia.com>
> CC: Andy Fleming <afleming at freescale.com>
> ---
>  common/env_mmc.c | 27 +++++++++++++++------------
>  1 file changed, 15 insertions(+), 12 deletions(-)
>
> diff --git a/common/env_mmc.c b/common/env_mmc.c
> index 78c2bc7a1f08..d569b070e005 100644
> --- a/common/env_mmc.c
> +++ b/common/env_mmc.c
> @@ -64,6 +64,13 @@ __weak int mmc_get_env_addr(struct mmc *mmc, int copy,
> u32 *env_addr)
>  __weak int mmc_get_env_devno(void)
>  {
>         return CONFIG_SYS_MMC_ENV_DEV;
> +
> +__weak int mmc_get_env_partno(void)
> +{
> +#ifdef CONFIG_SYS_MMC_ENV_PART
> +       return CONFIG_SYS_MMC_ENV_PART;
> +#endif
> +       return 0;
>

Maybe:

#ifndef CONFIG_SYS_MMC_ENV_PART
#define CONFIG_SYS_MMC_ENV_PART 0
#endif

__weak int mmc_get_env_partno(void)
{
    return CONFIG_SYS_MMC_ENV_PART;
}

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


More information about the U-Boot mailing list