Message ID | 20250307084821.451112-1-pavel@zhukoff.net |
---|---|
State | New |
Headers | show |
Series | [v2] ovmf: Add OVMF_BUILD_TYPE to support debug builds | expand |
There is a standard mechanism for such tweaks: PACKAGECONFIG. Can you rework the patch to use that please? You can still use this variable but it becomes an intermediate one, and set from what is in PACKAGECONFIG. Alex On Fri, 7 Mar 2025 at 09:48, Pavel Zhukov via lists.openembedded.org <pavel=zhukoff.net@lists.openembedded.org> wrote: > > In release mode, OVMF does not output any debug information to the QEMU port, making it extremely difficult to debug boot issues. > This commit introduces the OVMF_BUILD_TYPE variable (RELEASE|DEBUG) to enable debug mode. > > Usage: > OVMF_BUILD_TYPE="DEBUG" > runqemu qemuparams="-debugcon file:debug.log -global isa-debugcon.iobase=0x402" > > The OVMF debug console output will be written to debug.log. > > Signed-off-by: Pavel Zhukov <pavel@zhukoff.net> > --- > meta/recipes-core/ovmf/ovmf_git.bb | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/meta/recipes-core/ovmf/ovmf_git.bb b/meta/recipes-core/ovmf/ovmf_git.bb > index 559c86b546..920944b713 100644 > --- a/meta/recipes-core/ovmf/ovmf_git.bb > +++ b/meta/recipes-core/ovmf/ovmf_git.bb > @@ -67,6 +67,10 @@ OVMF_SECURE_BOOT_FLAGS = "-DSECURE_BOOT_ENABLE=TRUE ${OVMF_SECURE_BOOT_EXTRA_FLA > > export PYTHON_COMMAND = "${HOSTTOOLS_DIR}/python3" > > +# Build type (RELEASE|DEBUG) > +# in RELEASE mode debug console is disabled. Switch to DEBUG to enable it. > +OVMF_BUILD_TYPE ?= "RELEASE" > + > do_patch[postfuncs] += "fix_basetools_location" > fix_basetools_location () { > } > @@ -200,11 +204,11 @@ do_compile:class-target() { > fi > FIXED_GCCVER=$(fixup_target_tools ${GCC_VER}) > bbnote FIXED_GCCVER is ${FIXED_GCCVER} > - build_dir="${S}/Build/Ovmf$OVMF_DIR_SUFFIX/RELEASE_${FIXED_GCCVER}" > + build_dir="${S}/Build/Ovmf$OVMF_DIR_SUFFIX/${OVMF_BUILD_TYPE}_${FIXED_GCCVER}" > > bbnote "Building without Secure Boot." > rm -rf ${S}/Build/Ovmf$OVMF_DIR_SUFFIX > - ${S}/OvmfPkg/build.sh $PARALLEL_JOBS -a $OVMF_ARCH -b RELEASE -t ${FIXED_GCCVER} ${PACKAGECONFIG_CONFARGS} > + ${S}/OvmfPkg/build.sh $PARALLEL_JOBS -a $OVMF_ARCH -b ${OVMF_BUILD_TYPE} -t ${FIXED_GCCVER} ${PACKAGECONFIG_CONFARGS} > ln ${build_dir}/FV/OVMF.fd ${WORKDIR}/ovmf/ovmf.fd > ln ${build_dir}/FV/OVMF_CODE.fd ${WORKDIR}/ovmf/ovmf.code.fd > ln ${build_dir}/FV/OVMF_VARS.fd ${WORKDIR}/ovmf/ovmf.vars.fd > @@ -214,7 +218,7 @@ do_compile:class-target() { > # Repeat build with the Secure Boot flags. > bbnote "Building with Secure Boot." > rm -rf ${S}/Build/Ovmf$OVMF_DIR_SUFFIX > - ${S}/OvmfPkg/build.sh $PARALLEL_JOBS -a $OVMF_ARCH -b RELEASE -t ${FIXED_GCCVER} ${PACKAGECONFIG_CONFARGS} ${OVMF_SECURE_BOOT_FLAGS} > + ${S}/OvmfPkg/build.sh $PARALLEL_JOBS -a $OVMF_ARCH -b ${OVMF_BUILD_TYPE} -t ${FIXED_GCCVER} ${PACKAGECONFIG_CONFARGS} ${OVMF_SECURE_BOOT_FLAGS} > ln ${build_dir}/FV/OVMF.fd ${WORKDIR}/ovmf/ovmf.secboot.fd > ln ${build_dir}/FV/OVMF_CODE.fd ${WORKDIR}/ovmf/ovmf.secboot.code.fd > ln ${build_dir}/${OVMF_ARCH}/EnrollDefaultKeys.efi ${WORKDIR}/ovmf/ > -- > 2.48.1 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#212417): https://lists.openembedded.org/g/openembedded-core/message/212417 > Mute This Topic: https://lists.openembedded.org/mt/111564662/1686489 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
diff --git a/meta/recipes-core/ovmf/ovmf_git.bb b/meta/recipes-core/ovmf/ovmf_git.bb index 559c86b546..920944b713 100644 --- a/meta/recipes-core/ovmf/ovmf_git.bb +++ b/meta/recipes-core/ovmf/ovmf_git.bb @@ -67,6 +67,10 @@ OVMF_SECURE_BOOT_FLAGS = "-DSECURE_BOOT_ENABLE=TRUE ${OVMF_SECURE_BOOT_EXTRA_FLA export PYTHON_COMMAND = "${HOSTTOOLS_DIR}/python3" +# Build type (RELEASE|DEBUG) +# in RELEASE mode debug console is disabled. Switch to DEBUG to enable it. +OVMF_BUILD_TYPE ?= "RELEASE" + do_patch[postfuncs] += "fix_basetools_location" fix_basetools_location () { } @@ -200,11 +204,11 @@ do_compile:class-target() { fi FIXED_GCCVER=$(fixup_target_tools ${GCC_VER}) bbnote FIXED_GCCVER is ${FIXED_GCCVER} - build_dir="${S}/Build/Ovmf$OVMF_DIR_SUFFIX/RELEASE_${FIXED_GCCVER}" + build_dir="${S}/Build/Ovmf$OVMF_DIR_SUFFIX/${OVMF_BUILD_TYPE}_${FIXED_GCCVER}" bbnote "Building without Secure Boot." rm -rf ${S}/Build/Ovmf$OVMF_DIR_SUFFIX - ${S}/OvmfPkg/build.sh $PARALLEL_JOBS -a $OVMF_ARCH -b RELEASE -t ${FIXED_GCCVER} ${PACKAGECONFIG_CONFARGS} + ${S}/OvmfPkg/build.sh $PARALLEL_JOBS -a $OVMF_ARCH -b ${OVMF_BUILD_TYPE} -t ${FIXED_GCCVER} ${PACKAGECONFIG_CONFARGS} ln ${build_dir}/FV/OVMF.fd ${WORKDIR}/ovmf/ovmf.fd ln ${build_dir}/FV/OVMF_CODE.fd ${WORKDIR}/ovmf/ovmf.code.fd ln ${build_dir}/FV/OVMF_VARS.fd ${WORKDIR}/ovmf/ovmf.vars.fd @@ -214,7 +218,7 @@ do_compile:class-target() { # Repeat build with the Secure Boot flags. bbnote "Building with Secure Boot." rm -rf ${S}/Build/Ovmf$OVMF_DIR_SUFFIX - ${S}/OvmfPkg/build.sh $PARALLEL_JOBS -a $OVMF_ARCH -b RELEASE -t ${FIXED_GCCVER} ${PACKAGECONFIG_CONFARGS} ${OVMF_SECURE_BOOT_FLAGS} + ${S}/OvmfPkg/build.sh $PARALLEL_JOBS -a $OVMF_ARCH -b ${OVMF_BUILD_TYPE} -t ${FIXED_GCCVER} ${PACKAGECONFIG_CONFARGS} ${OVMF_SECURE_BOOT_FLAGS} ln ${build_dir}/FV/OVMF.fd ${WORKDIR}/ovmf/ovmf.secboot.fd ln ${build_dir}/FV/OVMF_CODE.fd ${WORKDIR}/ovmf/ovmf.secboot.code.fd ln ${build_dir}/${OVMF_ARCH}/EnrollDefaultKeys.efi ${WORKDIR}/ovmf/
In release mode, OVMF does not output any debug information to the QEMU port, making it extremely difficult to debug boot issues. This commit introduces the OVMF_BUILD_TYPE variable (RELEASE|DEBUG) to enable debug mode. Usage: OVMF_BUILD_TYPE="DEBUG" runqemu qemuparams="-debugcon file:debug.log -global isa-debugcon.iobase=0x402" The OVMF debug console output will be written to debug.log. Signed-off-by: Pavel Zhukov <pavel@zhukoff.net> --- meta/recipes-core/ovmf/ovmf_git.bb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)