swupdate fw_env.config

781 views
Skip to first unread message

sajjad ahmed

unread,
Mar 16, 2018, 11:29:56 AM3/16/18
to swupdate
Hi,

I'm trying to understand the fw_printenv and fw_saveenv workflow. It requires a fw_env.config file to read uEnv.txt which I'm providing as

/dev/mmcblk0p1        0x10000       0x80000

where 0x100000 is CONFIG_ENV_ADDR and 0x80000 is CONFIG_ENV_SIZE

When I try to read environment using fw_printenv it gives me warning [bad CRC using default environment swupdate]

but I'm unable to understand the addresses we provide in fw_env.config and what's its relation with uboot's CONFIG_ENV_ADDR. mmcblk0p1 is a FAT partition where all boot files + kernel is placed, and location of uEnvt.txt is non-deterministic. How it's working?

With the above implementation, rootfs update procedure corrupts the kernel image and target can't boot again.

Also, can I don something like this in fw_env.config?

/mnt/uEnv.txt    0x0000     0x2000

-Sajjad

Stefano Babic

unread,
Mar 16, 2018, 12:11:14 PM3/16/18
to sajjad ahmed, swupdate
Hi Sajjad,

On 16/03/2018 16:29, sajjad ahmed wrote:
> Hi,
>
> I'm trying to understand the *fw_printenv *and *fw_saveenv *workflow. It
> requires a *fw_env.config* file to read uEnv.txt which I'm providing as
>
> /dev/mmcblk0p1        0x10000       0x80000
>
> * where 0x100000 is CONFIG_ENV_ADDR and 0x80000 is CONFIG_ENV_SIZE
>
> When I try to read environment using *fw_printenv *it gives me
> warning *[bad CRC using default environment swupdate]*
>

This tells you that it does not work. Until you cannot read / write the
environment from Linux, you cannot start with SWUpdate.

This is really independent from SWUpdate - it is related to U-Boot and
to your U-Boot port.

> but I'm unable to understand the addresses we provide in fw_env.config
> and what's its relation with uboot's *CONFIG_ENV_ADDR*. mmcblk0p1 is a
> FAT partition where all boot files + kernel is placed, and location of
> uEnvt.txt is non-deterministic.

Well, this is part of the design. I guess this is a evauation board, and
for such as board, it makes sense to have a easy way to write the
environment. Howvwer, to provide power-off safe update, you need
redundant environment in U-Boot. This is not provided in your design and
an update cannot safely work in all conditions.

> How it's working?
>
> With the above implementation, rootfs update procedure corrupts the
> kernel image and target can't boot again.

The above implementation does not reflect where the environment is
stored. If you write raw data in mmcblk0p1, you are corrumping mmcblkp1.

>
> Also, can I don something like this in fw_env.config?
>
> /mnt/uEnv.txt    0x0000     0x2000

This is allowed in U-Boot - anyway, single copy, in a file,...do not
expect a safe update.

Best regards,
Stefano Babic


--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=====================================================================
Reply all
Reply to author
Forward
0 new messages