| Message ID | 20250831181612.421579-2-steffen.kothe@skothe.net |
|---|---|
| State | Changes Requested |
| Delegated to: | Stefano Babic |
| Headers | show |
| Series | Fix EXTRA_CFLAGS/EXTRA_LDFLAGS config | expand |
On Sun, 2025-08-31 at 18:16 +0000, steffen.kothe via swupdate wrote: > > From: Steffen Kothe <steffen.kothe@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 <steffen.kothe@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 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)"
On Mon, Sep 01, 2025 at 09:21:30AM +0000, Joakim Tjernlund (Nokia) wrote: > On Sun, 2025-08-31 at 18:16 +0000, steffen.kothe via swupdate wrote: > > > > From: Steffen Kothe <steffen.kothe@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 <steffen.kothe@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 > > I don't think this is the right way to fix CFLAGS/LDFLAGS. Instead swupdate should respect these flags. > Possibly something like(untested): 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. > > 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)" >
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)