siemens / meta-iot2050

SIMATIC IOT2050 Isar/Debian Board Support Package
MIT License
129 stars 76 forks source link

iot2050-firmware-update: Fix env that preserved is not right #359

Closed AsuraZeng closed 1 year ago

AsuraZeng commented 1 year ago

Issue: we used this tool on the previous release image found that if there were tow identical values will be used to sort higher. However, the backward value is used on the latest image.

It is unreasonable to have two identical environment variables in the same uboot env file. So remove the same environment variables from the default list to fix this issue.

Signed-off-by: chao zeng chao.zeng@siemens.com

BaochengSu commented 1 year ago

As we have discussed offline, if the env does not exist, for 1.1.1 the error must be handled.

jan-kiszka commented 1 year ago

Sorry, the commit message does not fully parse for me. Was this observed in a real setup?

AsuraZeng commented 1 year ago

Yes. it was observed on a real setup. for the latest release image, this tool works well. but in the previous image(transitional image), it would fail.

in the default env file u-boot-init-env, there exists one env boot_targets,

if we want to preserve that env boot_targets, for the original design, we would append the env item to the last of u-boot-init-env, then using mkenvimage to create a new binary then flash to the env mtd partitions.

the problem is that if we append one that exists in the u-boot-init-env, so there would two identical env items in the same file.

Through experiment, in the Debian bullseyes, using fw_printenv it would select the last one, so it could work as our expectation. But in the buster, it would select the previous one, we would get the wrong env.

Has two same environments in the file is not correct, so remove one

jan-kiszka commented 1 year ago

OK, makes more sense. Maybe enhance to commit log a bit (also: tow -> two).