[meta-swupdate 1/1] fix(swupdate.inc): Reorder do_configure due to config ignorance

18 views
Skip to first unread message

steffe...@skothe.net

unread,
Aug 31, 2025, 2:18:28 PM (11 days ago) Aug 31
to swup...@googlegroups.com, Steffen Kothe
From: Steffen Kothe <steffe...@skothe.net>

EXTRA_CFLAGS and EXTRA_LDFLAGS are part of the build process of swupdate
added as additional config entries to the .config.

Parameters which are written to top of the file getting ignored by
merge_config.sh with an outcome that neither the C nor the LD flags are
containing the default flags from the Yocto build environment.

Hence change the order of adding additional flags and write defconfig
first into .config before flags are appended.

The issue was covered by QA warnings for buildpaths which are usually
not happening when compiler flags like fdebug-prefix-map and
fmacro-prefix-map are configured correctly.

Signed-off-by: Steffen Kothe <steffe...@skothe.net>
---
recipes-support/swupdate/swupdate.inc | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/recipes-support/swupdate/swupdate.inc b/recipes-support/swupdate/swupdate.inc
index 091bbc2..45fcf3c 100644
--- a/recipes-support/swupdate/swupdate.inc
+++ b/recipes-support/swupdate/swupdate.inc
@@ -259,11 +259,15 @@ python () {
}

do_configure () {
- cat > ${WORKDIR}/.config <<HEREDOC
+
+ # Write defconfig first to ensure that additional CONFIG_ entries
+ # getting respected by merge_config.sh
+ cat ${UNPACKDIR}/defconfig > ${WORKDIR}/.config
+
+ cat >> ${WORKDIR}/.config <<HEREDOC
CONFIG_EXTRA_CFLAGS="${CFLAGS}"
CONFIG_EXTRA_LDFLAGS="${LDFLAGS}"
HEREDOC
- cat ${UNPACKDIR}/defconfig >> ${WORKDIR}/.config

merge_config.sh -O ${B} -m ${WORKDIR}/.config ${@" ".join(find_cfgs(d))}
(cd ${S} && cml1_do_configure)
--
2.51.0

Joakim Tjernlund (Nokia)

unread,
Sep 1, 2025, 5:21:36 AM (11 days ago) Sep 1
to steffe...@skothe.net, swup...@googlegroups.com

I don't think this is the right way to fix CFLAGS/LDFLAGS. Instead swupdate should respect these flags.
Possibly something like(untested):

diff --git a/Makefile b/Makefile
index 3421b24b..7d9577a8 100644
--- a/Makefile
+++ b/Makefile
@@ -411,8 +411,8 @@ quiet_cmd_swupdate = LD $@
cmd_swupdate = $(srctree)/scripts/trylink \
"$@" \
"$(CC)" \
- "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
- "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
+ "$(KBUILD_CFLAGS) $(CFLAGS_swupdate) $(CFLAGS)" \
+ "$(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) $(LDFLAGS)" \
"$(swupdate-objs) $(ipc-lib)" \
"$(swupdate-libs)" \
"$(LDLIBS)"
@@ -424,8 +424,8 @@ quiet_cmd_addon = LD $@
cmd_addon = $(srctree)/scripts/trylink \
"$@" \
"$(CC)" \
- "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
- "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(objtree)" \
+ "$(KBUILD_CFLAGS) $(CFLAGS_swupdate) $(CFLAGS)" \
+ "$(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) $(LDFLAGS) -L$(objtree)" \
"$(2)" \
"$(swupdate-libs)" \
"$(LDLIBS) :${swupdate-ipc-lib}"
@@ -435,8 +435,8 @@ quiet_cmd_shared = LD $@
"$@" \
"$(CC)" \
"-shared -Wl,-soname,$@" \
- "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
- "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(objtree)" \
+ "$(KBUILD_CFLAGS) $(CFLAGS_swupdate) $(CFLAGS)" \
+ "$(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) $(LDFLAGS) -L$(objtree)" \
"$(2)" \
"$(LDLIBS)"

Steffen Kothe

unread,
Sep 1, 2025, 5:56:19 AM (11 days ago) Sep 1
to Joakim Tjernlund (Nokia), swup...@googlegroups.com
The EXTRA_ flags get respected by swupdate but adding them in the
.config file seems to be relevant.

EXTRA_ configs written on top of the .config file are overwritten by the same
EXTRA_ configs later occuring in the file even when they are empty.

I pretty much assume that the ordering matters for merge-config.sh and
swupdate itself isn't the root cause here.

But let me give your patch a test to verify, if it resolves the isuse.
Reply all
Reply to author
Forward
0 new messages