| Message ID | 20250916040927.103722-2-hongxu.jia@windriver.com |
|---|---|
| State | New |
| Headers | show |
| Series | [1/8] yocto-space-optimize.inc: move space optimize from recipe webkitgtk | expand |
On Mon, Sep 15, 2025 at 9:09 PM hongxu via lists.openembedded.org <hongxu.jia=eng.windriver.com@lists.openembedded.org> wrote: > > Add a new include file debug_build.inc to override SELECTED_OPTIMIZATION > and BUILD_OPTIMIZATION when DEBUG_BUILD is enabled > > 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_OPTIMIZATION > > Update the documentation for FULL_OPTIMIZATION and DEBUG_OPTIMIZATION > > Require the include file when DEBUG_BUILD is enabled > I was hoping that adding DEBUG_BUILD would reduce number of global variables to manage but it seems to introduce another one in form of DEBUG_OPTLEVEL, this makes the logic a bit complicated I think it will be good to explore a bit more and see if we do not have to do it. > Suggested-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> > Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> > --- > meta/conf/bitbake.conf | 13 +++++++------ > meta/conf/distro/include/debug_build.inc | 7 +++++++ > meta/conf/documentation.conf | 8 +++++--- > 3 files changed, 19 insertions(+), 9 deletions(-) > create mode 100644 meta/conf/distro/include/debug_build.inc > > diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf > index 8e90c7bbc8..0e614c6b21 100644 > --- a/meta/conf/bitbake.conf > +++ b/meta/conf/bitbake.conf > @@ -658,13 +658,12 @@ DEBUG_PREFIX_MAP ?= "\ > " > DEBUG_LEVELFLAG ?= "-g" > > -FULL_OPTIMIZATION = "-O2 ${DEBUG_LEVELFLAG}" > -DEBUG_OPTIMIZATION = "-Og ${DEBUG_LEVELFLAG}" > -SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD', 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}" > -SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION DEBUG_BUILD" > +FULL_OPTLEVEL ?= "-O2" > +FULL_OPTIMIZATION = "${FULL_OPTLEVEL} ${DEBUG_LEVELFLAG}" > +SELECTED_OPTIMIZATION = "${FULL_OPTIMIZATION}" > # compiler flags for native/nativesdk > -BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-Og -g', '-O2', d)}" > -BUILD_OPTIMIZATION[vardeps] += "DEBUG_BUILD" > +BUILD_OPTLEVEL ?= "-O2" > +BUILD_OPTIMIZATION = "${BUILD_OPTLEVEL}" > > ################################################################## > # Reproducibility > @@ -831,6 +830,8 @@ include conf/licenses.conf > require conf/sanity.conf > include conf/bblock.conf > > +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 0000000000..a9222a442a > --- /dev/null > +++ b/meta/conf/distro/include/debug_build.inc > @@ -0,0 +1,7 @@ > +# Override SELECTED_OPTIMIZATION and BUILD_OPTIMIZATION when DEBUG_BUILD is enabled. > +DEBUG_OPTLEVEL ?= "-Og" > +DEBUG_OPTIMIZATION = "${DEBUG_OPTLEVEL} ${DEBUG_LEVELFLAG}" > +SELECTED_OPTIMIZATION = "${DEBUG_OPTIMIZATION}" > +# compiler flags for native/nativesdk > +BUILD_OPTLEVEL = "-Og" > +BUILD_OPTIMIZATION = "${BUILD_OPTLEVEL} -g" > diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf > index 741130a392..b643724e27 100644 > --- a/meta/conf/documentation.conf > +++ b/meta/conf/documentation.conf > @@ -129,8 +129,9 @@ CVE_CHECK_LAYER_INCLUDELIST[doc] = "Defines which layers to include during cve-c > D[doc] = "The destination directory." > DATE[doc] = "The date the build was started using YMD format." > DATETIME[doc] = "The date and time the build was started." > -DEBUG_BUILD[doc] = "Specifies to build packages with debugging information. This influences the value of the SELECTED_OPTIMIZATION variable." > -DEBUG_OPTIMIZATION[doc] = "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] = "Specifies to build packages with debugging information. This influences the value of the SELECTED_OPTIMIZATION variable and includes file conf/distro/include/debug_build.inc" > +DEBUG_OPTLEVEL[doc] = "The toolchain optimization level flags for debugging. This variable defaults to '-Og'" > +DEBUG_OPTIMIZATION[doc] = "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] = "Specifies a weak bias for recipe selection priority." > DEPENDS[doc] = "Lists a recipe's build-time dependencies (i.e. other recipe files)." > DEPLOY_DIR[doc] = "Points to the general area that the OpenEmbedded build 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] = "The default set of directories the OpenEmbedded build system u > FILESYSTEM_PERMS_TABLES[doc] = "Allows you to define your own file permissions settings table as part of your configuration for the packaging process." > FONT_EXTRA_RDEPENDS[doc] = "When a recipe inherits the fontcache class, this variable specifies runtime dependencies for font packages. This variable defaults to 'fontconfig-utils'." > FONT_PACKAGES[doc] = "When a recipe inherits the fontcache class, this variable identifies packages containing font files that need to be cached by Fontconfig." > -FULL_OPTIMIZATION[doc] = "The options to pass in TARGET_CFLAGS and CFLAGS when compiling an optimized system. This variable defaults to '-O2 ${DEBUG_LEVELFLAG}'." > +FULL_OPTLEVEL[doc] = "The toolchain optimization level flags. This variable defaults to '-O2'" > +FULL_OPTIMIZATION[doc] = "The options to pass in TARGET_CFLAGS and CFLAGS when compiling an optimized system. This variable defaults to '${FULL_OPTLEVEL} ${DEBUG_LEVELFLAG}'." > > #G > > -- > 2.34.1 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#223516): https://lists.openembedded.org/g/openembedded-core/message/223516 > Mute This Topic: https://lists.openembedded.org/mt/115268057/1997914 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
> -----Original Message----- > From: Khem Raj <raj.khem@gmail.com> > Sent: den 29 september 2025 20:49 > To: hongxu.jia@eng.windriver.com > Cc: openembedded-core@lists.openembedded.org; randy.macleod@windriver.com; Peter Kjellerstedt <peter.kjellerstedt@axis.com> > Subject: Re: [OE-core] [PATCH v3 2/8] distro/include: Add debug_build.inc when DEBUG_BUILD is enabled > > On Mon, Sep 15, 2025 at 9:09 PM hongxu via lists.openembedded.org <hongxu.jia=eng.windriver.com@lists.openembedded.org> wrote: > > > > Add a new include file debug_build.inc to override SELECTED_OPTIMIZATION > > and BUILD_OPTIMIZATION when DEBUG_BUILD is enabled > > > > 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_OPTIMIZATION > > > > Update the documentation for FULL_OPTIMIZATION and DEBUG_OPTIMIZATION > > > > Require the include file when DEBUG_BUILD is enabled > > > > I was hoping that adding DEBUG_BUILD would reduce number of global > variables to manage > but it seems to introduce another one in form of DEBUG_OPTLEVEL, this > makes the logic a bit complicated > I think it will be good to explore a bit more and see if we do not > have to do it. Well, adding the *_OPTLEVEL variables simplified the recipe specific overrides a lot in the debug_build.inc file. > > > Suggested-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> > > Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> > > --- > > meta/conf/bitbake.conf | 13 +++++++------ > > meta/conf/distro/include/debug_build.inc | 7 +++++++ > > meta/conf/documentation.conf | 8 +++++--- > > 3 files changed, 19 insertions(+), 9 deletions(-) > > create mode 100644 meta/conf/distro/include/debug_build.inc > > > > diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf > > index 8e90c7bbc8..0e614c6b21 100644 > > --- a/meta/conf/bitbake.conf > > +++ b/meta/conf/bitbake.conf > > @@ -658,13 +658,12 @@ DEBUG_PREFIX_MAP ?= "\ > > " > > DEBUG_LEVELFLAG ?= "-g" > > > > -FULL_OPTIMIZATION = "-O2 ${DEBUG_LEVELFLAG}" > > -DEBUG_OPTIMIZATION = "-Og ${DEBUG_LEVELFLAG}" > > -SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD', 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}" > > -SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION DEBUG_BUILD" > > +FULL_OPTLEVEL ?= "-O2" > > +FULL_OPTIMIZATION = "${FULL_OPTLEVEL} ${DEBUG_LEVELFLAG}" > > +SELECTED_OPTIMIZATION = "${FULL_OPTIMIZATION}" > > # compiler flags for native/nativesdk > > -BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-Og -g', '-O2', d)}" > > -BUILD_OPTIMIZATION[vardeps] += "DEBUG_BUILD" > > +BUILD_OPTLEVEL ?= "-O2" > > +BUILD_OPTIMIZATION = "${BUILD_OPTLEVEL}" > > > > ################################################################## > > # Reproducibility > > @@ -831,6 +830,8 @@ include conf/licenses.conf > > require conf/sanity.conf > > include conf/bblock.conf > > > > +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 0000000000..a9222a442a > > --- /dev/null > > +++ b/meta/conf/distro/include/debug_build.inc > > @@ -0,0 +1,7 @@ > > +# Override SELECTED_OPTIMIZATION and BUILD_OPTIMIZATION when DEBUG_BUILD is enabled. > > +DEBUG_OPTLEVEL ?= "-Og" > > +DEBUG_OPTIMIZATION = "${DEBUG_OPTLEVEL} ${DEBUG_LEVELFLAG}" > > +SELECTED_OPTIMIZATION = "${DEBUG_OPTIMIZATION}" > > +# compiler flags for native/nativesdk > > +BUILD_OPTLEVEL = "-Og" > > +BUILD_OPTIMIZATION = "${BUILD_OPTLEVEL} -g" > > diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf > > index 741130a392..b643724e27 100644 > > --- a/meta/conf/documentation.conf > > +++ b/meta/conf/documentation.conf > > @@ -129,8 +129,9 @@ CVE_CHECK_LAYER_INCLUDELIST[doc] = "Defines which > layers to include during cve-c > > D[doc] = "The destination directory." > > DATE[doc] = "The date the build was started using YMD format." > > DATETIME[doc] = "The date and time the build was started." > > -DEBUG_BUILD[doc] = "Specifies to build packages with debugging information. This influences the value of the SELECTED_OPTIMIZATION variable." > > -DEBUG_OPTIMIZATION[doc] = "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] = "Specifies to build packages with debugging information. This influences the value of the SELECTED_OPTIMIZATION variable and includes file conf/distro/include/debug_build.inc" > > +DEBUG_OPTLEVEL[doc] = "The toolchain optimization level flags for debugging. This variable defaults to '-Og'" > > +DEBUG_OPTIMIZATION[doc] = "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] = "Specifies a weak bias for recipe selection priority." > > DEPENDS[doc] = "Lists a recipe's build-time dependencies (i.e. other recipe files)." > > DEPLOY_DIR[doc] = "Points to the general area that the OpenEmbedded build 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] = "The default set of directories the OpenEmbedded build system u > > FILESYSTEM_PERMS_TABLES[doc] = "Allows you to define your own file permissions settings table as part of your configuration for the packaging process." > > FONT_EXTRA_RDEPENDS[doc] = "When a recipe inherits the fontcache class, this variable specifies runtime dependencies for font packages. This variable defaults to 'fontconfig-utils'." > > FONT_PACKAGES[doc] = "When a recipe inherits the fontcache class, this variable identifies packages containing font files that need to be cached by Fontconfig." > > -FULL_OPTIMIZATION[doc] = "The options to pass in TARGET_CFLAGS and CFLAGS when compiling an optimized system. This variable defaults to '-O2 ${DEBUG_LEVELFLAG}'." > > +FULL_OPTLEVEL[doc] = "The toolchain optimization level flags. This variable defaults to '-O2'" > > +FULL_OPTIMIZATION[doc] = "The options to pass in TARGET_CFLAGS and CFLAGS when compiling an optimized system. This variable defaults to '${FULL_OPTLEVEL} ${DEBUG_LEVELFLAG}'." > > > > #G > > > > -- > > 2.34.1 //Peter
On 9/30/25 06:52, Peter Kjellerstedt via lists.openembedded.org wrote: > CAUTION: This email comes from a non Wind River email account! > Do not click links or open attachments unless you recognize the sender and know the content is safe. > >> -----Original Message----- >> From: Khem Raj <raj.khem@gmail.com> >> Sent: den 29 september 2025 20:49 >> To: hongxu.jia@eng.windriver.com >> Cc: openembedded-core@lists.openembedded.org; randy.macleod@windriver.com; Peter Kjellerstedt <peter.kjellerstedt@axis.com> >> Subject: Re: [OE-core] [PATCH v3 2/8] distro/include: Add debug_build.inc when DEBUG_BUILD is enabled >> >> On Mon, Sep 15, 2025 at 9:09 PM hongxu via lists.openembedded.org <hongxu.jia=eng.windriver.com@lists.openembedded.org> wrote: >>> Add a new include file debug_build.inc to override SELECTED_OPTIMIZATION >>> and BUILD_OPTIMIZATION when DEBUG_BUILD is enabled >>> >>> 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_OPTIMIZATION >>> >>> Update the documentation for FULL_OPTIMIZATION and DEBUG_OPTIMIZATION >>> >>> Require the include file when DEBUG_BUILD is enabled >>> >> I was hoping that adding DEBUG_BUILD would reduce number of global >> variables to manage >> but it seems to introduce another one in form of DEBUG_OPTLEVEL, this >> makes the logic a bit complicated >> I think it will be good to explore a bit more and see if we do not >> have to do it. > Well, adding the *_OPTLEVEL variables simplified the recipe specific > overrides a lot in the debug_build.inc file. > I will try to not introduce any new global variables for DEBUG_BUILD, by overriding existed variables more precisely I will resend the series for discussing, v4 incoming //Hongxu >>> Suggested-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> >>> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> >>> --- >>> meta/conf/bitbake.conf | 13 +++++++------ >>> meta/conf/distro/include/debug_build.inc | 7 +++++++ >>> meta/conf/documentation.conf | 8 +++++--- >>> 3 files changed, 19 insertions(+), 9 deletions(-) >>> create mode 100644 meta/conf/distro/include/debug_build.inc >>> >>> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf >>> index 8e90c7bbc8..0e614c6b21 100644 >>> --- a/meta/conf/bitbake.conf >>> +++ b/meta/conf/bitbake.conf >>> @@ -658,13 +658,12 @@ DEBUG_PREFIX_MAP ?= "\ >>> " >>> DEBUG_LEVELFLAG ?= "-g" >>> >>> -FULL_OPTIMIZATION = "-O2 ${DEBUG_LEVELFLAG}" >>> -DEBUG_OPTIMIZATION = "-Og ${DEBUG_LEVELFLAG}" >>> -SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD', 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}" >>> -SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION DEBUG_BUILD" >>> +FULL_OPTLEVEL ?= "-O2" >>> +FULL_OPTIMIZATION = "${FULL_OPTLEVEL} ${DEBUG_LEVELFLAG}" >>> +SELECTED_OPTIMIZATION = "${FULL_OPTIMIZATION}" >>> # compiler flags for native/nativesdk >>> -BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-Og -g', '-O2', d)}" >>> -BUILD_OPTIMIZATION[vardeps] += "DEBUG_BUILD" >>> +BUILD_OPTLEVEL ?= "-O2" >>> +BUILD_OPTIMIZATION = "${BUILD_OPTLEVEL}" >>> >>> ################################################################## >>> # Reproducibility >>> @@ -831,6 +830,8 @@ include conf/licenses.conf >>> require conf/sanity.conf >>> include conf/bblock.conf >>> >>> +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 0000000000..a9222a442a >>> --- /dev/null >>> +++ b/meta/conf/distro/include/debug_build.inc >>> @@ -0,0 +1,7 @@ >>> +# Override SELECTED_OPTIMIZATION and BUILD_OPTIMIZATION when DEBUG_BUILD is enabled. >>> +DEBUG_OPTLEVEL ?= "-Og" >>> +DEBUG_OPTIMIZATION = "${DEBUG_OPTLEVEL} ${DEBUG_LEVELFLAG}" >>> +SELECTED_OPTIMIZATION = "${DEBUG_OPTIMIZATION}" >>> +# compiler flags for native/nativesdk >>> +BUILD_OPTLEVEL = "-Og" >>> +BUILD_OPTIMIZATION = "${BUILD_OPTLEVEL} -g" >>> diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf >>> index 741130a392..b643724e27 100644 >>> --- a/meta/conf/documentation.conf >>> +++ b/meta/conf/documentation.conf >>> @@ -129,8 +129,9 @@ CVE_CHECK_LAYER_INCLUDELIST[doc] = "Defines which >> layers to include during cve-c >>> D[doc] = "The destination directory." >>> DATE[doc] = "The date the build was started using YMD format." >>> DATETIME[doc] = "The date and time the build was started." >>> -DEBUG_BUILD[doc] = "Specifies to build packages with debugging information. This influences the value of the SELECTED_OPTIMIZATION variable." >>> -DEBUG_OPTIMIZATION[doc] = "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] = "Specifies to build packages with debugging information. This influences the value of the SELECTED_OPTIMIZATION variable and includes file conf/distro/include/debug_build.inc" >>> +DEBUG_OPTLEVEL[doc] = "The toolchain optimization level flags for debugging. This variable defaults to '-Og'" >>> +DEBUG_OPTIMIZATION[doc] = "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] = "Specifies a weak bias for recipe selection priority." >>> DEPENDS[doc] = "Lists a recipe's build-time dependencies (i.e. other recipe files)." >>> DEPLOY_DIR[doc] = "Points to the general area that the OpenEmbedded build 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] = "The default set of directories the OpenEmbedded build system u >>> FILESYSTEM_PERMS_TABLES[doc] = "Allows you to define your own file permissions settings table as part of your configuration for the packaging process." >>> FONT_EXTRA_RDEPENDS[doc] = "When a recipe inherits the fontcache class, this variable specifies runtime dependencies for font packages. This variable defaults to 'fontconfig-utils'." >>> FONT_PACKAGES[doc] = "When a recipe inherits the fontcache class, this variable identifies packages containing font files that need to be cached by Fontconfig." >>> -FULL_OPTIMIZATION[doc] = "The options to pass in TARGET_CFLAGS and CFLAGS when compiling an optimized system. This variable defaults to '-O2 ${DEBUG_LEVELFLAG}'." >>> +FULL_OPTLEVEL[doc] = "The toolchain optimization level flags. This variable defaults to '-O2'" >>> +FULL_OPTIMIZATION[doc] = "The options to pass in TARGET_CFLAGS and CFLAGS when compiling an optimized system. This variable defaults to '${FULL_OPTLEVEL} ${DEBUG_LEVELFLAG}'." >>> >>> #G >>> >>> -- >>> 2.34.1 > //Peter > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#224170): https://lists.openembedded.org/g/openembedded-core/message/224170 > Mute This Topic: https://lists.openembedded.org/mt/115268057/3617049 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [hongxu.jia@eng.windriver.com] > -=-=-=-=-=-=-=-=-=-=-=- >
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf index 8e90c7bbc8..0e614c6b21 100644 --- a/meta/conf/bitbake.conf +++ b/meta/conf/bitbake.conf @@ -658,13 +658,12 @@ DEBUG_PREFIX_MAP ?= "\ " DEBUG_LEVELFLAG ?= "-g" -FULL_OPTIMIZATION = "-O2 ${DEBUG_LEVELFLAG}" -DEBUG_OPTIMIZATION = "-Og ${DEBUG_LEVELFLAG}" -SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD', 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}" -SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION DEBUG_BUILD" +FULL_OPTLEVEL ?= "-O2" +FULL_OPTIMIZATION = "${FULL_OPTLEVEL} ${DEBUG_LEVELFLAG}" +SELECTED_OPTIMIZATION = "${FULL_OPTIMIZATION}" # compiler flags for native/nativesdk -BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-Og -g', '-O2', d)}" -BUILD_OPTIMIZATION[vardeps] += "DEBUG_BUILD" +BUILD_OPTLEVEL ?= "-O2" +BUILD_OPTIMIZATION = "${BUILD_OPTLEVEL}" ################################################################## # Reproducibility @@ -831,6 +830,8 @@ include conf/licenses.conf require conf/sanity.conf include conf/bblock.conf +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 0000000000..a9222a442a --- /dev/null +++ b/meta/conf/distro/include/debug_build.inc @@ -0,0 +1,7 @@ +# Override SELECTED_OPTIMIZATION and BUILD_OPTIMIZATION when DEBUG_BUILD is enabled. +DEBUG_OPTLEVEL ?= "-Og" +DEBUG_OPTIMIZATION = "${DEBUG_OPTLEVEL} ${DEBUG_LEVELFLAG}" +SELECTED_OPTIMIZATION = "${DEBUG_OPTIMIZATION}" +# compiler flags for native/nativesdk +BUILD_OPTLEVEL = "-Og" +BUILD_OPTIMIZATION = "${BUILD_OPTLEVEL} -g" diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf index 741130a392..b643724e27 100644 --- a/meta/conf/documentation.conf +++ b/meta/conf/documentation.conf @@ -129,8 +129,9 @@ CVE_CHECK_LAYER_INCLUDELIST[doc] = "Defines which layers to include during cve-c D[doc] = "The destination directory." DATE[doc] = "The date the build was started using YMD format." DATETIME[doc] = "The date and time the build was started." -DEBUG_BUILD[doc] = "Specifies to build packages with debugging information. This influences the value of the SELECTED_OPTIMIZATION variable." -DEBUG_OPTIMIZATION[doc] = "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] = "Specifies to build packages with debugging information. This influences the value of the SELECTED_OPTIMIZATION variable and includes file conf/distro/include/debug_build.inc" +DEBUG_OPTLEVEL[doc] = "The toolchain optimization level flags for debugging. This variable defaults to '-Og'" +DEBUG_OPTIMIZATION[doc] = "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] = "Specifies a weak bias for recipe selection priority." DEPENDS[doc] = "Lists a recipe's build-time dependencies (i.e. other recipe files)." DEPLOY_DIR[doc] = "Points to the general area that the OpenEmbedded build 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] = "The default set of directories the OpenEmbedded build system u FILESYSTEM_PERMS_TABLES[doc] = "Allows you to define your own file permissions settings table as part of your configuration for the packaging process." FONT_EXTRA_RDEPENDS[doc] = "When a recipe inherits the fontcache class, this variable specifies runtime dependencies for font packages. This variable defaults to 'fontconfig-utils'." FONT_PACKAGES[doc] = "When a recipe inherits the fontcache class, this variable identifies packages containing font files that need to be cached by Fontconfig." -FULL_OPTIMIZATION[doc] = "The options to pass in TARGET_CFLAGS and CFLAGS when compiling an optimized system. This variable defaults to '-O2 ${DEBUG_LEVELFLAG}'." +FULL_OPTLEVEL[doc] = "The toolchain optimization level flags. This variable defaults to '-O2'" +FULL_OPTIMIZATION[doc] = "The options to pass in TARGET_CFLAGS and CFLAGS when compiling an optimized system. This variable defaults to '${FULL_OPTLEVEL} ${DEBUG_LEVELFLAG}'." #G
Add a new include file debug_build.inc to override SELECTED_OPTIMIZATION and BUILD_OPTIMIZATION when DEBUG_BUILD is enabled 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_OPTIMIZATION Update the documentation for FULL_OPTIMIZATION and DEBUG_OPTIMIZATION Require the include file when DEBUG_BUILD is enabled Suggested-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> --- meta/conf/bitbake.conf | 13 +++++++------ meta/conf/distro/include/debug_build.inc | 7 +++++++ meta/conf/documentation.conf | 8 +++++--- 3 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 meta/conf/distro/include/debug_build.inc