[PATCH] tools: fw_env: use erasesize from MEMGETINFO ioctl
Wolfgang Denk
wd at denx.de
Fri Mar 20 15:11:59 CET 2020
Dear Rasmus,
In message <20200320140414.19689-1-rasmus.villemoes at prevas.dk> you wrote:
>
> Having different fw_env.config files for the different revisions is
> highly impractical, and the correct information is already available
> right at our fingertips. So use the erasesize returned by the
> MEMGETINFO ioctl when the fourth column is absent or contains a 0.
>
> As I'm only testing this on a NOR flash, I'm only changing the logic
> for that case, though I think it should be possible for the other
> types as well.
>
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
> ---
> tools/env/fw_env.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
> index 381739d28d..87c3504315 100644
> --- a/tools/env/fw_env.c
> +++ b/tools/env/fw_env.c
> @@ -1647,6 +1647,8 @@ static int check_device_config(int dev)
> goto err;
> }
> DEVTYPE(dev) = mtdinfo.type;
> + if (DEVESIZE(dev) == 0 && mtdinfo.type == MTD_NORFLASH)
> + DEVESIZE(dev) = mtdinfo.erasesize;
> if (DEVESIZE(dev) == 0)
> /* Assume the erase size is the same as the env-size */
> DEVESIZE(dev) = ENVSIZE(dev);
What happens if you - say - have an environment size of 16 KiB and
an erase block size of 4 KiB?
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A memorandum is written not to inform the reader, but to protect the
writer. -- Dean Acheson
More information about the U-Boot
mailing list