From b7e00560c8295d5ff457331dd92c296185f7dc14 Mon Sep 17 00:00:00 2001 From: Karol Trzcinski Date: Wed, 20 May 2020 11:46:35 +0200 Subject: [PATCH] ext_manifest: byt: fix .fw_metadata section alignment Section of this section should be aligned to EXT_MAN_ALIGN, proper way of doing this with ALIGN() function inside linker script didn't work, because of removing READONLY attribute for this segment, what leads to error in rimage. This solution introduce changes only for platforms, where problem exists, so generic tools like rimage are kept clean of such a hacks. Signed-off-by: Karol Trzcinski --- src/platform/baytrail/baytrail.x.in | 3 ++- src/platform/baytrail/platform.c | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/platform/baytrail/baytrail.x.in b/src/platform/baytrail/baytrail.x.in index 22c0e4a1deab..ffdf5599253e 100644 --- a/src/platform/baytrail/baytrail.x.in +++ b/src/platform/baytrail/baytrail.x.in @@ -552,7 +552,8 @@ SECTIONS .fw_metadata (COPY) : ALIGN(1024) { - KEEP (*(.fw_metadata)) + KEEP (*(.fw_metadata)); + KEEP (*(.fw_metadata.align)); } >fw_metadata_seg :metadata_entries_phdr .fw_ready : ALIGN(4) diff --git a/src/platform/baytrail/platform.c b/src/platform/baytrail/platform.c index b881eaf56d8e..aea8c1d0d59d 100644 --- a/src/platform/baytrail/platform.c +++ b/src/platform/baytrail/platform.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -41,6 +42,16 @@ #include #include +/* + * following element is created to assure proper section size alignment, besides + * of build tools limitation - removing `READONLY` flag when updated `.` value + * with `ALIGN(.)` in linker script. + */ +const struct { + char elem[0]; +} ext_manifest_align_element + __aligned(EXT_MAN_ALIGN) __section(".fw_metadata.align") = {}; + static const struct sof_ipc_fw_ready ready __section(".fw_ready") = { .hdr = {