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

cmake: Fix mcuboot build when imgtool is available as binary #80278

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sant0s12
Copy link

This commit fixes the mcuboot build when imgtool is installed as a binary. Otherwise, the python interpreter tries to read the binary file and complains about reading null bytes.

This commit fixes the mcuboot build when `imgtool` is installed as a
binary. Otherwise, the python interpreter tries to read the binary file and
complains about reading null bytes.

Signed-off-by: Diego de los Santos <diego.delossantos@mailbox.org>
Copy link

Hello @sant0s12, and thank you very much for your first pull request to the Zephyr project!
Our Continuous Integration pipeline will execute a series of checks on your Pull Request commit messages and code, and you are expected to address any failures by updating the PR. Please take a look at our commit message guidelines to find out how to format your commit messages, and at our contribution workflow to understand how to update your Pull Request. If you haven't already, please make sure to review the project's Contributor Expectations and update (by amending and force-pushing the commits) your pull request if necessary.
If you are stuck or need help please join us on Discord and ask your question there. Additionally, you can escalate the review when applicable. 😊

Copy link
Collaborator

@nordicjm nordicjm left a comment

Choose a reason for hiding this comment

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

This is not correct, having imgtool as a binary is not supported (and I'm not even sure how you get it as a binary anyway). Python will install packages without a .py prefix, e.g. /home/user/.local/bin/imgtool

@sant0s12
Copy link
Author

@nordicjm When using a nix development environment, imgtool is wrapped as a binary and I'm trying to support this case.

In any case, imgtool should be runnable by itself even if it's not a binary, no? The only time when you would need to explicitly call the python executable is then the file is in the scripts folder.

Please let me know if I'm missing something :)

@nordicjm
Copy link
Collaborator

In any case, imgtool should be runnable by itself even if it's not a binary, no? The only time when you would need to explicitly call the python executable is then the file is in the scripts folder.

On windows? I highly doubt it

@nordicjm When using a nix development environment, imgtool is wrapped as a binary and I'm trying to support this case.

This OS is a broken design

@sant0s12
Copy link
Author

In any case, imgtool should be runnable by itself even if it's not a binary, no? The only time when you would need to explicitly call the python executable is then the file is in the scripts folder.

On windows? I highly doubt it

Ostensibly yes, although I have no way to test this myself, unfortunately. Perhaps somebody else can find out.

@nordicjm When using a nix development environment, imgtool is wrapped as a binary and I'm trying to support this case.

This OS is a broken design

🤣 That's an interesting take. I must say I enjoy it so far but to each their own.

Copy link
Collaborator

@nordicjm nordicjm left a comment

Choose a reason for hiding this comment

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

Another issue with this PR is that this drops the zephyr detected version of python and does not supply it, that means if there is no system python installed then this will now fail, and if there is a system version of python but the zephyr version of python is different, this will also fail, likewise if zephyr uses a venv (as the guide suggests) and the requirements for imgtool are installed there, this looks like it will not use that version of python.

I would instead suggest following the zephyr setup guide of using a python venv, and that way a binary build of imgtool is not an issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants