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

Add new HAB fuse update type #208

Merged
merged 2 commits into from
Jan 27, 2025
Merged

Conversation

jsrc27
Copy link
Collaborator

@jsrc27 jsrc27 commented Jan 17, 2025

Tested on Verdin i.MX8MP and Apalis i.MX8. Also did a test build for AM62 just to make sure the build still works on non-NXP machines.

Marking as draft for now till after the quarterly release is done, but should be ready for review otherwise.

@jsrc27 jsrc27 requested a review from EdTheBearded January 17, 2025 01:46
@jsrc27 jsrc27 marked this pull request as draft January 17, 2025 01:46
EdTheBearded
EdTheBearded previously approved these changes Jan 17, 2025
@EdTheBearded EdTheBearded requested a review from rborn-tx January 20, 2025 16:03
@rborn-tx
Copy link
Contributor

I'm about to start a review but I have some comments on the commit messages for things you may want to change:

Regarding commit "aktualizr-default-sec: Refactor common functions from bootloader action handler":

  • Commit title exceeds the 68 characters limit.
  • Typo: "prepartion" -> "preparation".

Regarding the two commits:

  • They are signed with a personal e-mail account rather than a Toradex one.

Copy link
Contributor

@rborn-tx rborn-tx left a comment

Choose a reason for hiding this comment

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

Finished my first pass.

I looks like we're in the right path but I raised a couple of points I believe we should address before merging.

recipes-sota/config/aktualizr-default-sec.bb Outdated Show resolved Hide resolved
recipes-sota/config/aktualizr-default-sec.bb Outdated Show resolved Hide resolved
recipes-sota/config/aktualizr-default-sec.bb Show resolved Hide resolved
recipes-sota/config/files/fuse_actions.sh Outdated Show resolved Hide resolved
recipes-sota/config/files/fuse_actions.sh Outdated Show resolved Hide resolved
recipes-sota/config/files/fuse_actions.sh Outdated Show resolved Hide resolved
recipes-sota/config/files/fuse_actions.sh Outdated Show resolved Hide resolved
recipes-sota/config/files/fuse_actions.sh Outdated Show resolved Hide resolved
recipes-sota/config/files/common_actions.sh Outdated Show resolved Hide resolved
recipes-sota/config/files/fuse_actions.sh Outdated Show resolved Hide resolved
@jsrc27
Copy link
Collaborator Author

jsrc27 commented Jan 22, 2025

Regarding the comments surrounding get-firmware-info, I'm not sure I understand the point. Currently the way the logic works is a fuse.yaml file will get generated if and only if there wasn't a file there to begin with. In normal operation this would only happen once really.

Once the file is generated based on the U-Boot environment (which is our source of truth), why not just pass normal operation (exit code 64) back to Aktualizr? Aktualizr already has the logic and operations to determine hash, length, target-name, and all that based on the file. Seems like it would just be duplicate work to have logic in the action handler to determine these when Aktualizr can already do this for us.

The end result is the same on the web UI the device reports a correct hash for the fuse secondary.

Then if the firmware file came from a real update then we would want to pass normal operation (exit code 64) to Aktualizr anyways.

@jsrc27
Copy link
Collaborator Author

jsrc27 commented Jan 22, 2025

Commit title exceeds the 68 characters limit.

Since when has this been an enforced rule in this repo?

I can see we have various commit titles that do not adhere to this.

@rborn-tx
Copy link
Contributor

Commit title exceeds the 68 characters limit.

Since when has this been an enforced rule in this repo?

I can see we have various commit titles that do not adhere to this.

Sorry, my mistake. For some reason I thought we had that general rule but checking internal docs that doesn't seem to be the case.

@rborn-tx
Copy link
Contributor

Regarding the comments surrounding get-firmware-info, I'm not sure I understand the point. Currently the way the logic works is a fuse.yaml file will get generated if and only if there wasn't a file there to begin with. In normal operation this would only happen once really.

Got it. So it's not bad in terms of flash wearing.

Once the file is generated based on the U-Boot environment (which is our source of truth), why not just pass normal operation (exit code 64) back to Aktualizr? Aktualizr already has the logic and operations to determine hash, length, target-name, and all that based on the file. Seems like it would just be duplicate work to have logic in the action handler to determine these when Aktualizr can already do this for us.

The end result is the same on the web UI the device reports a correct hash for the fuse secondary.

Then if the firmware file came from a real update then we would want to pass normal operation (exit code 64) to Aktualizr anyways.

The ideal case is to always get the information from the source of truth because then we'd report a correct hash even when the information changes outside of control of Aktualizr. If we were to follow this ideal case with the present approach then we'd need to always write to the file (pretending it was downloaded) to let Aktualizr determine all the information to report to the server which would be bad for flash wear. That's why I mentioned generating a temporary/volatile file and determining the information from it. Though this means some duplication of logic that exists inside Aktualizr, we're talking about a couple of lines of script code.

Having said that, I don't think it's bad to keep it as is since we expect users to only do fusing through subsystem updates. Thus, feel free to close the related threads if the above doesn't change your opinion.

Copy link
Contributor

@rborn-tx rborn-tx left a comment

Choose a reason for hiding this comment

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

It looks like all points have been addressed - approving now.

…on handler

In preparation for future action handlers, factor some useful functions out
of the bootloader action handler to a common script. This common script can
be used by other action handlers to improve code reuse.

Related-to: TOR-3635

Signed-off-by: Jeremias Cordoba <[email protected]>
Add the script and configurations for the new HAB fuses update type.
These new additions will only take effect when building for currently
supported NXP machines.

Related-to: TOR-3635

Signed-off-by: Jeremias Cordoba <[email protected]>
@jsrc27 jsrc27 marked this pull request as ready for review January 24, 2025 02:04
@EdTheBearded EdTheBearded merged commit f75be1b into torizon:scarthgap-7.x.y Jan 27, 2025
@jsrc27 jsrc27 deleted the TOR-3635 branch January 29, 2025 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants