[PATCH] scripts: imx: pass semicolons as substitute chars to compiler macros for CSF templating
Bastian Krause
bst at pengutronix.de
Thu Jan 16 02:15:31 PST 2025
On 1/16/25 11:01 AM, Sascha Hauer wrote:
> On Fri, Jan 10, 2025 at 05:18:51PM +0100, Bastian Krause wrote:
>> Hi Sascha,
>>
>> On 1/10/25 12:31 PM, Sascha Hauer wrote:
>>> On Mon, Jan 06, 2025 at 12:33:40PM +0100, Bastian Krause wrote:
>>>> With CONFIG_HAB_CERTS_ENV=y, paths and PKCS#11 URIs to the HAB
>>>> certificates are taken from environment variables (allowing for better
>>>> integration with build systems). In this case these values are passed
>>>> internally via compiler macros (-D) to the imx-image host tool. PKCS#11
>>>> URIs usually contain semicolons. Semicolons, however, cannot be passed
>>>> via compiler macros and cannot be escaped.
>>>
>>> Try harder.
>>>
>>> gcc -DFOO='"bar;baz"' test.c
>>>
>>> #include <stdio.h>
>>>
>>> int main(void)
>>> {
>>> printf(FOO);
>>> }
>>>
>>> Works as expected, so does it work when you add single quotes around the
>>> URI?
>>
>> This actually works:
>>
>> --- a/scripts/Makefile.lib
>> +++ b/scripts/Makefile.lib
>> @@ -570,8 +570,8 @@ imxcfg_cpp_flags = -Wp,-MD,$(depfile) -nostdinc -x
>> assembler-with-cpp \
>> $(call overwrite-hab-env,CONFIG_HABV3_CSF_CRT_DER) \
>> $(call overwrite-hab-env,CONFIG_HABV3_IMG_CRT_DER) \
>> $(call overwrite-hab-env,CONFIG_HABV4_TABLE_BIN) \
>> - $(call overwrite-hab-env,CONFIG_HABV4_CSF_CRT_PEM) \
>> - $(call overwrite-hab-env,CONFIG_HABV4_IMG_CRT_PEM) \
>> + -DCONFIG_HABV4_CSF_CRT_PEM='"$(CONFIG_HABV4_CSF_CRT_PEM)"' \
>> + -DCONFIG_HABV4_IMG_CRT_PEM='"$(CONFIG_HABV4_IMG_CRT_PEM)"' \
>> $(call overwrite-fit-env,CONFIG_BOOTM_FITIMAGE_PUBKEY) \
>>
>> dcd-tmp = $(subst $(comma),_,$(dot-target).dcd.tmp)
>>
>>
>> But I had no luck integrating the single quote approach in overwrite-
>> hab-env. Maybe my quoting/escaping fu is not strong enough. Could you
>> take a look?
>
> Took some time, but it should work now. See the patch I just sent.
Nice, thanks! I'll give it a spin and will let you know if it works for me.
Regards,
Bastian
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list