Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Chore] tools.images_packer: refine previous offline_ota_image_builder to support 2 image packing mode #267

Merged
merged 17 commits into from
Dec 26, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion tools/images_packer/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ def main_build_offline_ota_image_bundle(args: argparse.Namespace):
image_version=_image_version,
)
)
if _ecu_id in image_files:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should not be warning. For the user, this is the unexpected behavior, so it should be error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I agree! This is unexpected behavior. Let me fix it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated at 786ef4d, now multiple images specified to the same ECU will cause the images_packer logging an error and then exit.

logger.warning(
(
f"override previously set OTA target image for ECU@{_ecu_id} "
f"from {image_files[_ecu_id]} to {_image_fpath}"
)
)
image_files[_ecu_id] = _image_fpath
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_ecu_id key must be checked if the key already exists.

Copy link
Member Author

@Bodong-Yang Bodong-Yang Dec 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated at a9edc6b. If same ECU has multiple target OTA image being specified, a warning log will be issued, and later setting will override the previous one.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if _ecu_id in image_files:
logger.warning(
(
f"override previously set OTA target image for ECU@{_ecu_id} "
f"from {image_files[_ecu_id]} to {_image_fpath}"
)
)
image_files[_ecu_id] = _image_fpath

else:
logger.warning(f"ignore illegal image pair: {raw_pair}")
Expand Down Expand Up @@ -233,7 +240,9 @@ def command_build_offline_ota_image_bundle(
"--image",
help=(
"OTA image for <ECU_ID> as tar archive(compressed or uncompressed), "
"this option can be used multiple times to include multiple images."
"this option can be used multiple times to include multiple images. \n"
"NOTE: if multiple OTA target image is specified for the same ECU, the later one "
"will override the previous set one."
),
required=True,
metavar="<ECU_NAME>:<IMAGE_PATH>[:<IMAGE_VERSION>]",
Expand Down