-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
base: main
Are you sure you want to change the base?
Conversation
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>
Hello @sant0s12, and thank you very much for your first pull request to the Zephyr project! |
There was a problem hiding this 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
@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 :) |
On windows? I highly doubt it
This OS is a broken design |
Ostensibly yes, although I have no way to test this myself, unfortunately. Perhaps somebody else can find out.
🤣 That's an interesting take. I must say I enjoy it so far but to each their own. |
There was a problem hiding this 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
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.