diff mbox series

[meta-swupdate,master,scarthgap] swupdate: set extra_cflags

Message ID 20240626120108.170630-1-andrej.kozemcak@siemens.com
State New
Delegated to: Stefano Babic
Headers show
Series [meta-swupdate,master,scarthgap] swupdate: set extra_cflags | expand

Commit Message

Andrej Kozemcak June 26, 2024, 12:01 p.m. UTC
Swupdate recipe adds CONFIG_EXTRA_CFLAGS and CONFIG_EXTRA_LDFLAGS to the
beginning of the .config. Most generated defconfig already contains
(empty) CFLAGS, which overwrite those added by the recipe (last
definition wins). This behaviour is not mentioned in documentation and
causes unexpected problems. In this commit, we remove preddefined CFLAGS
from defconfig, which are invalid because they don't contain correct
build paths, and we add the CFLAGS from bitbake to the end of the .config file.

Signed-off-by: Andrej Kozemcak <andrej.kozemcak@siemens.com>
---
 recipes-support/swupdate/swupdate.inc | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/recipes-support/swupdate/swupdate.inc b/recipes-support/swupdate/swupdate.inc
index 188c25c..8a740ad 100644
--- a/recipes-support/swupdate/swupdate.inc
+++ b/recipes-support/swupdate/swupdate.inc
@@ -245,11 +245,13 @@  python () {
 }
 
 do_configure () {
-    cat > ${WORKDIR}/.config <<HEREDOC
-CONFIG_EXTRA_CFLAGS="${CFLAGS}"
-CONFIG_EXTRA_LDFLAGS="${LDFLAGS}"
-HEREDOC
-    cat ${WORKDIR}/defconfig >> ${WORKDIR}/.config
+    cp ${WORKDIR}/defconfig ${WORKDIR}/.config
+
+    sed -i "s/^CONFIG_EXTRA_CFLAGS.*$//" ${WORKDIR}/.config
+    echo "CONFIG_EXTRA_CFLAGS=\"${CFLAGS}\"" >> ${WORKDIR}/.config
+
+    sed -i "s/^CONFIG_EXTRA_LDFLAGS.*$//" ${WORKDIR}/.config
+    echo "CONFIG_EXTRA_LDFLAGS=\"${LDFLAGS}\"" >> ${WORKDIR}/.config
 
     merge_config.sh -O ${B} -m ${WORKDIR}/.config ${@" ".join(find_cfgs(d))}
     (cd ${S} && cml1_do_configure)