From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 192E7CAC592 for ; Tue, 16 Sep 2025 03:51:11 +0000 (UTC) Subject: Re: [PATCH v2 2/8] distro/include: Add debug_build.inc when DEBUG_BUILD is enabled To: openembedded-core@lists.openembedded.org From: "hongxu" X-Originating-Location: US (128.224.246.2) X-Originating-Platform: Linux Chrome 140 User-Agent: GROUPS.IO Web Poster MIME-Version: 1.0 Date: Mon, 15 Sep 2025 20:51:05 -0700 References: In-Reply-To: Message-ID: <20091.1757994665184735903@lists.openembedded.org> Content-Type: multipart/alternative; boundary="RfhdeKYSbmdzRIQGQlUc" List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 16 Sep 2025 03:51:11 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/223514 --RfhdeKYSbmdzRIQGQlUc Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Mon, Sep 15, 2025 at 05:25 PM, Peter Kjellerstedt wrote: >=20 >=20 >> -----Original Message----- >> From: openembedded-core@... On Behalf Of hongxu >> via >> lists.openembedded.org >> Sent: den 15 september 2025 08:17 >> To: openembedded-core@... >> Cc: randy.macleod@...; Peter Kjellerstedt >> Subject: [OE-core] [PATCH v2 2/8] distro/include: Add debug_build.inc wh= en >> DEBUG_BUILD is enabled >>=20 >> Add a new include file debug_build.inc to override SELECTED_OPTIMIZATION >> and BUILD_OPTIMIZATION when DEBUG_BUILD is enabled >>=20 >> Add separate variables FULL_OPTLEVEL, DEBUG_OPTLEVEL and BUILD_OPTLEVEL >> for the optimization level, and override it for specific recipe other >> than original remove and append DEBUG_OPTIMIZATION and BUILD_OPTIMIZATIO= N >>=20 >> Update the documentation for FULL_OPTIMIZATION and DEBUG_OPTIMIZATION >>=20 >> Require the include file when DEBUG_BUILD is enabled >>=20 >> Suggested-by: Peter Kjellerstedt >> Signed-off-by: Hongxu Jia >> --- >> meta/conf/bitbake.conf | 15 +++++++++------ >> meta/conf/distro/include/debug_build.inc | 8 ++++++++ >> meta/conf/documentation.conf | 8 +++++--- >> 3 files changed, 22 insertions(+), 9 deletions(-) >> create mode 100644 meta/conf/distro/include/debug_build.inc >>=20 >> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf >> index 8e90c7bbc85..91dc51cd61d 100644 >> --- a/meta/conf/bitbake.conf >> +++ b/meta/conf/bitbake.conf >> @@ -658,13 +658,14 @@ DEBUG_PREFIX_MAP ?=3D "\ >> " >> DEBUG_LEVELFLAG ?=3D "-g" >>=20 >> -FULL_OPTIMIZATION =3D "-O2 ${DEBUG_LEVELFLAG}" >> -DEBUG_OPTIMIZATION =3D "-Og ${DEBUG_LEVELFLAG}" >> -SELECTED_OPTIMIZATION =3D "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD', >> 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}" >> -SELECTED_OPTIMIZATION[vardeps] +=3D "FULL_OPTIMIZATION DEBUG_OPTIMIZATI= ON >> DEBUG_BUILD" >> +FULL_OPTLEVEL ?=3D "-O2" >> +FULL_OPTIMIZATION =3D "${FULL_OPTLEVEL} ${DEBUG_LEVELFLAG}" >> +SELECTED_OPTIMIZATION =3D "${FULL_OPTIMIZATION}" >> +SELECTED_OPTIMIZATION[vardeps] +=3D "FULL_OPTIMIZATION DEBUG_LEVELFLAG >> FULL_OPTLEVEL" >=20 > The vardeps is no longer needed. Copy >=20 >=20 >> # compiler flags for native/nativesdk >> -BUILD_OPTIMIZATION =3D "${@oe.utils.vartrue('DEBUG_BUILD', '-Og -g', '-= O2', >> d)}" >> -BUILD_OPTIMIZATION[vardeps] +=3D "DEBUG_BUILD" >> +BUILD_OPTLEVEL ?=3D "-O2" >> +BUILD_OPTIMIZATION =3D "${BUILD_OPTLEVEL}" >> +BUILD_OPTIMIZATION[vardeps] +=3D "BUILD_OPTLEVEL" >=20 > The vardeps is no longer needed. Copy >=20 >=20 >> ################################################################## >> # Reproducibility >> @@ -831,6 +832,8 @@ include conf/licenses.conf >> require conf/sanity.conf >> include conf/bblock.conf >>=20 >> +require ${@oe.utils.vartrue('DEBUG_BUILD', >> 'conf/distro/include/debug_build.inc', '', d)} >> + >> ################################################################## >> # Weak variables (usually to retain backwards compatibility) >> ################################################################## >> diff --git a/meta/conf/distro/include/debug_build.inc >> b/meta/conf/distro/include/debug_build.inc >> new file mode 100644 >> index 00000000000..af947a80e8b >> --- /dev/null >> +++ b/meta/conf/distro/include/debug_build.inc >> @@ -0,0 +1,8 @@ >> +# Override SELECTED_OPTIMIZATION and BUILD_OPTIMIZATION when DEBUG_BUIL= D >> is enabled. >> +DEBUG_OPTLEVEL ?=3D "-Og" >> +DEBUG_OPTIMIZATION =3D "${DEBUG_OPTLEVEL} ${DEBUG_LEVELFLAG}" >> +SELECTED_OPTIMIZATION =3D "${DEBUG_OPTIMIZATION}" >> +SELECTED_OPTIMIZATION[vardeps] +=3D "DEBUG_OPTIMIZATION DEBUG_OPTLEVEL" >=20 > The vardeps is no longer needed. Copy >=20 >=20 >> +# compiler flags for native/nativesdk >> +BUILD_OPTLEVEL =3D "-Og" >> +BUILD_OPTIMIZATION =3D "${BUILD_OPTLEVEL} -g" >> diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf >> index 741130a3921..824c4fb3801 100644 >> --- a/meta/conf/documentation.conf >> +++ b/meta/conf/documentation.conf >> @@ -129,8 +129,9 @@ CVE_CHECK_LAYER_INCLUDELIST[doc] =3D "Defines which >> layers to include during cve-c >> D[doc] =3D "The destination directory." >> DATE[doc] =3D "The date the build was started using YMD format." >> DATETIME[doc] =3D "The date and time the build was started." >> -DEBUG_BUILD[doc] =3D "Specifies to build packages with debugging >> information. This influences the value of the SELECTED_OPTIMIZATION >> variable." >> -DEBUG_OPTIMIZATION[doc] =3D "The options to pass in TARGET_CFLAGS and >> CFLAGS when compiling a system for debugging. This variable defaults to >> '-Og ${DEBUG_LEVELFLAG}'." >> +DEBUG_BUILD[doc] =3D "Specifies to build packages with debugging >> information. This influences the value of the SELECTED_OPTIMIZATION >> variable and add include file conf/distro/include/debug_build.inc" >=20 > Change "add include file" to "includes". Copy V3 incoming //Hongxu >=20 >=20 >=20 >> +DEBUG_OPTLEVEL[doc] =3D "The toolchain optimization level flags for >> debugging. This variable defaults to '-Og'" >> +DEBUG_OPTIMIZATION[doc] =3D "The options to pass in TARGET_CFLAGS and >> CFLAGS when compiling a system for debugging. This variable defaults to >> '${DEBUG_OPTLEVEL} ${DEBUG_LEVELFLAG}'." >> DEFAULT_PREFERENCE[doc] =3D "Specifies a weak bias for recipe selection >> priority." >> DEPENDS[doc] =3D "Lists a recipe's build-time dependencies (i.e. other >> recipe files)." >> DEPLOY_DIR[doc] =3D "Points to the general area that the OpenEmbedded bu= ild >> system uses to place images, packages, SDKs and other output files that >> are ready to be used outside of the build system." >> @@ -178,7 +179,8 @@ FILESPATH[doc] =3D "The default set of directories t= he >> OpenEmbedded build system u >> FILESYSTEM_PERMS_TABLES[doc] =3D "Allows you to define your own file >> permissions settings table as part of your configuration for the packagi= ng >> process." >> FONT_EXTRA_RDEPENDS[doc] =3D "When a recipe inherits the fontcache class= , >> this variable specifies runtime dependencies for font packages. This >> variable defaults to 'fontconfig-utils'." >> FONT_PACKAGES[doc] =3D "When a recipe inherits the fontcache class, this >> variable identifies packages containing font files that need to be cache= d >> by Fontconfig." >> -FULL_OPTIMIZATION[doc] =3D "The options to pass in TARGET_CFLAGS and CF= LAGS >> when compiling an optimized system. This variable defaults to '-O2 >> ${DEBUG_LEVELFLAG}'." >> +FULL_OPTLEVEL[doc] =3D "The toolchain optimization level flags. This >> variable defaults to '-O2'" >> +FULL_OPTIMIZATION[doc] =3D "The options to pass in TARGET_CFLAGS and CF= LAGS >> when compiling an optimized system. This variable defaults to >> '${FULL_OPTLEVEL} ${DEBUG_LEVELFLAG}'." >>=20 >> #G >>=20 >> -- >> 2.34.1 >=20 > --RfhdeKYSbmdzRIQGQlUc Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
On Mon, Sep 15, 2025 at 05:25 PM, Peter Kjellerstedt wrote:
-----Original Message-----
From: openembedded-core@... <= ;openembedded-core@...> On Behalf Of hongxu via
lists.openembedded.= org
Sent: den 15 september 2025 08:17
To: openembedded-core@...Cc: randy.macleod@...; Peter Kjellerstedt <peter.kjellerstedt@...>= ;
Subject: [OE-core] [PATCH v2 2/8] distro/include: Add debug_build.in= c when DEBUG_BUILD is enabled

Add a new include file debug_build= .inc to override SELECTED_OPTIMIZATION
and BUILD_OPTIMIZATION when DEB= UG_BUILD is enabled

Add separate variables FULL_OPTLEVEL, DEBUG_= OPTLEVEL and BUILD_OPTLEVEL
for the optimization level, and override i= t for specific recipe other
than original remove and append DEBUG_OPTI= MIZATION and BUILD_OPTIMIZATION

Update the documentation for FUL= L_OPTIMIZATION and DEBUG_OPTIMIZATION

Require the include file w= hen DEBUG_BUILD is enabled

Suggested-by: Peter Kjellerstedt <= peter.kjellerstedt@...>
Signed-off-by: Hongxu Jia <hongxu.jia@..= .>
---
meta/conf/bitbake.conf | 15 +++++++++------
meta/c= onf/distro/include/debug_build.inc | 8 ++++++++
meta/conf/documentatio= n.conf | 8 +++++---
3 files changed, 22 insertions(+), 9 deletions(-)<= br />create mode 100644 meta/conf/distro/include/debug_build.inc

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 8e= 90c7bbc85..91dc51cd61d 100644
--- a/meta/conf/bitbake.conf
+++ b/= meta/conf/bitbake.conf
@@ -658,13 +658,14 @@ DEBUG_PREFIX_MAP ?=3D "\<= br />"
DEBUG_LEVELFLAG ?=3D "-g"

-FULL_OPTIMIZATION =3D "-O= 2 ${DEBUG_LEVELFLAG}"
-DEBUG_OPTIMIZATION =3D "-Og ${DEBUG_LEVELFLAG}"=
-SELECTED_OPTIMIZATION =3D "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD= ', 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}" -SELECTED_OPTIMIZATION[= vardeps] +=3D "FULL_OPTIMIZATION DEBUG_OPTIMIZATION DEBUG_BUILD"
+FULL= _OPTLEVEL ?=3D "-O2"
+FULL_OPTIMIZATION =3D "${FULL_OPTLEVEL} ${DEBUG_= LEVELFLAG}"
+SELECTED_OPTIMIZATION =3D "${FULL_OPTIMIZATION}"
+SE= LECTED_OPTIMIZATION[vardeps] +=3D "FULL_OPTIMIZATION DEBUG_LEVELFLAG FULL_O= PTLEVEL"
The vardeps is no longer needed.
Copy
# compiler flags for native/nativesdk
-BUILD_OPTIMIZATION = =3D "${@oe.utils.vartrue('DEBUG_BUILD', '-Og -g', '-O2', d)}"
-BUILD_O= PTIMIZATION[vardeps] +=3D "DEBUG_BUILD"
+BUILD_OPTLEVEL ?=3D "-O2"
+BUILD_OPTIMIZATION =3D "${BUILD_OPTLEVEL}"
+BUILD_OPTIMIZATION[vard= eps] +=3D "BUILD_OPTLEVEL"
The vardeps is no longer needed.
Copy
###############################################################= ###
# Reproducibility
@@ -831,6 +832,8 @@ include conf/licenses.c= onf
require conf/sanity.conf
include conf/bblock.conf

= +require ${@oe.utils.vartrue('DEBUG_BUILD', 'conf/distro/include/debug_buil= d.inc', '', d)}
+
###############################################= ###################
# Weak variables (usually to retain backwards comp= atibility)
###########################################################= #######
diff --git a/meta/conf/distro/include/debug_build.inc b/meta/c= onf/distro/include/debug_build.inc
new file mode 100644
index 000= 00000000..af947a80e8b
--- /dev/null
+++ b/meta/conf/distro/includ= e/debug_build.inc
@@ -0,0 +1,8 @@
+# Override SELECTED_OPTIMIZATI= ON and BUILD_OPTIMIZATION when DEBUG_BUILD is enabled.
+DEBUG_OPTLEVEL= ?=3D "-Og"
+DEBUG_OPTIMIZATION =3D "${DEBUG_OPTLEVEL} ${DEBUG_LEVELFL= AG}"
+SELECTED_OPTIMIZATION =3D "${DEBUG_OPTIMIZATION}"
+SELECTED= _OPTIMIZATION[vardeps] +=3D "DEBUG_OPTIMIZATION DEBUG_OPTLEVEL" The vardeps is no longer needed.
Copy
+# compiler flags for native/nativesdk
+BUILD_OPTLEVEL =3D= "-Og"
+BUILD_OPTIMIZATION =3D "${BUILD_OPTLEVEL} -g"
diff --git = a/meta/conf/documentation.conf b/meta/conf/documentation.conf
index 74= 1130a3921..824c4fb3801 100644
--- a/meta/conf/documentation.conf
= +++ b/meta/conf/documentation.conf
@@ -129,8 +129,9 @@ CVE_CHECK_LAYER= _INCLUDELIST[doc] =3D "Defines which layers to include during cve-c
D[= doc] =3D "The destination directory."
DATE[doc] =3D "The date the buil= d was started using YMD format."
DATETIME[doc] =3D "The date and time = the build was started."
-DEBUG_BUILD[doc] =3D "Specifies to build pack= ages with debugging information. This influences the value of the SELECTED_= OPTIMIZATION variable."
-DEBUG_OPTIMIZATION[doc] =3D "The options to p= ass in TARGET_CFLAGS and CFLAGS when compiling a system for debugging. This= variable defaults to '-Og ${DEBUG_LEVELFLAG}'."
+DEBUG_BUILD[doc] =3D= "Specifies to build packages with debugging information. This influences t= he value of the SELECTED_OPTIMIZATION variable and add include file conf/di= stro/include/debug_build.inc"
Change "add include file" to "includes".
Copy
 
V3 incoming
 
//Hongxu

+DEBUG_OPTLEVEL[doc] =3D "The toolchain optimization level flag= s for debugging. This variable defaults to '-Og'"
+DEBUG_OPTIMIZATION[= doc] =3D "The options to pass in TARGET_CFLAGS and CFLAGS when compiling a = system for debugging. This variable defaults to '${DEBUG_OPTLEVEL} ${DEBUG_= LEVELFLAG}'."
DEFAULT_PREFERENCE[doc] =3D "Specifies a weak bias for r= ecipe selection priority."
DEPENDS[doc] =3D "Lists a recipe's build-ti= me dependencies (i.e. other recipe files)."
DEPLOY_DIR[doc] =3D "Point= s to the general area that the OpenEmbedded build system uses to place imag= es, packages, SDKs and other output files that are ready to be used outside= of the build system."
@@ -178,7 +179,8 @@ FILESPATH[doc] =3D "The def= ault set of directories the OpenEmbedded build system u
FILESYSTEM_PER= MS_TABLES[doc] =3D "Allows you to define your own file permissions settings= table as part of your configuration for the packaging process."
FONT_= EXTRA_RDEPENDS[doc] =3D "When a recipe inherits the fontcache class, this v= ariable specifies runtime dependencies for font packages. This variable def= aults to 'fontconfig-utils'."
FONT_PACKAGES[doc] =3D "When a recipe in= herits the fontcache class, this variable identifies packages containing fo= nt files that need to be cached by Fontconfig."
-FULL_OPTIMIZATION[doc= ] =3D "The options to pass in TARGET_CFLAGS and CFLAGS when compiling an op= timized system. This variable defaults to '-O2 ${DEBUG_LEVELFLAG}'."
+= FULL_OPTLEVEL[doc] =3D "The toolchain optimization level flags. This variab= le defaults to '-O2'"
+FULL_OPTIMIZATION[doc] =3D "The options to pass= in TARGET_CFLAGS and CFLAGS when compiling an optimized system. This varia= ble defaults to '${FULL_OPTLEVEL} ${DEBUG_LEVELFLAG}'."

#G
=
--
2.34.1
--RfhdeKYSbmdzRIQGQlUc--