-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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: Escape literal '"' chars in image_preload variables #7997
cmake: Escape literal '"' chars in image_preload variables #7997
Conversation
Thank you for your contribution! Note: This comment is automatically posted and updated by the Contribs GitHub Action. |
Thank you for contributing to NCS! |
You can find the documentation preview for this PR at this link. It will be updated about 10 minutes after the documentation build succeeds. Note: This comment is automatically posted by the Documentation Publishing GitHub Action. |
abd0684
to
e2ee1f2
Compare
The Zephyr build system supports passing CONFIG_ variables on the west command line, like this: west build -- -D"CONFIG_SOME_STRING=\"some string\"" The logic in zephyr/cmake/modules/kconfig.cmake which implements this feature takes each CONFIG_ variable defined in the cmake cache, and writes the value of that variable directly into extra_kconfig_options.conf. Therefore, if the user wants to add a *string* value to kconfig using this mechanism, the extra_kconfig_options.conf entry would need to look like: CONFIG_BOOT_SIGNATURE_KEY_FILE="/foo/bar/private.pem" and the image_preload.cmake definition that generates this result would therefore be: set(CONFIG_BOOT_SIGNATURE_KEY_FILE "\"/foo/bar/private.pem\"" CACHE INTERNAL "NCS child image controlled") However, as of NCS v2.0.0, this doesn't work correctly. If I build with this command line: west build --pristine --cmake-only -b nrf52840dk_nrf52840 -- \ -D"mcuboot_CONFIG_BOOT_SIGNATURE_KEY_FILE=\"/foo/bar/private.pem\"" I see that the multi_image.cmake script from NCS generates invalid syntax in both image_preload files: set(CONFIG_BOOT_SIGNATURE_KEY_FILE ""/foo/bar/private.pem"" CACHE INTERNAL "NCS child image controlled") To fix this, NCS must add explicit escaping of '"' characters if they are present in the user-supplied string. Signed-off-by: Michael Scofield <mscof4378@gmail.com>
e2ee1f2
to
99dae83
Compare
Further testing indicated that the |
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
The Zephyr build system supports passing
CONFIG_
variables on the west command line, like this:The logic in zephyr/cmake/modules/kconfig.cmake which implements this feature takes each
CONFIG_
variable defined in the cmake cache, and writes the value of that variable directly into extra_kconfig_options.conf. Therefore, if the user wants to add a string value to kconfig using this mechanism, the extra_kconfig_options.conf entry would need to look like:and the image_preload.cmake definition that generates this result would therefore be:
However, as of NCS v2.0.0, this doesn't work correctly. If I build with this command line:
I see that the multi_image.cmake script from NCS generates invalid syntax in both image_preload files:
To fix this, NCS must add explicit escaping of '"' characters if they are present in the user-supplied string.