[U-Boot] [PATCH] tools: fw_printenv supports mmc device

Stefano Babic sbabic at denx.de
Thu Dec 16 07:42:23 CET 2010


On 12/16/2010 02:22 AM, Donghwa Lee wrote:
> diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
> index 8ff7052..5a707f6 100644
> --- a/tools/env/fw_env.c
> +++ b/tools/env/fw_env.c
> @@ -855,6 +855,7 @@ static int flash_write_buf (int dev, int fd, void *buf, size_t count,
>  		}
>  
>  		erase.start = blockstart;
> +#ifndef CONFIG_ENV_IS_IN_MMC

Can we get rid of this #ifdef statement ? This does not allow to include
the binary in a distro, because it is decided at compile time where the
environment is stored.

We already check if we are using a flash device in fw_env.c, when we
call ioctl (fd, MEMGETINFO, &mtdinfo). At the moment, we set the
mtd_type field in the envdevices structure only with MTD_NORFLASH or
MTD_NANDFLASH. I think it should be better to improve the check to find
on which medium we store the environment and set the mtd_type according
to its result if a SD/MMC is found (with MTD_MMC, maybe ?).

>  # Notice, that the "Number of sectors" is ignored on NOR.
>  
>  # MTD device name	Device offset	Env. size	Flash sector size	Number of sectors
> -/dev/mtd1		0x0000		0x4000		0x4000
> -/dev/mtd2		0x0000		0x4000		0x4000
> +#/dev/mtd1		0x0000		0x4000		0x4000
> +#/dev/mtd2		0x0000		0x4000		0x4000

I do not see any change in these lines..

>  
>  # NAND example
>  #/dev/mtd0		0x4000		0x4000		0x20000			2
> +
> +# MMC device name	Device offset	Env. size	Flash sector size	Number of sectors
> +/dev/mmcblk0		0x7000		0x1000		0x1000

Do we need Flash sector size for MMC ?

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================


More information about the U-Boot mailing list