Mailing List Archive

[PATCH 3/3] kernel-build.eclass: fix KERNEL_EFI_ZBOOT not being probed on partially supported arches
The several partially-supported arches (those relying on
USE=savedconfig) directly return in src_prepare(), hence previously the
CONFIG_EFI_ZBOOT probing didn't have a chance to run when building for
those arches, leading to wrong kernel artifact path and failed
src_install().

Move the probing to near the end of eclass src_configure(), so the flag
correctly reflects the reality in all circumstances.

Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
---
eclass/kernel-build.eclass | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
index 6b692dc4f9a0..7a041a8aacdf 100644
--- a/eclass/kernel-build.eclass
+++ b/eclass/kernel-build.eclass
@@ -203,6 +203,12 @@ kernel-build_src_configure() {
.config)
fi

+ # If this is set by USE=secureboot or user config this will have an effect
+ # on the name of the output image. Set this variable to track this setting.
+ if grep -q "CONFIG_EFI_ZBOOT=y" .config; then
+ KERNEL_EFI_ZBOOT=1
+ fi
+
mkdir -p "${WORKDIR}"/modprep || die
mv .config "${WORKDIR}"/modprep/ || die
emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" olddefconfig
@@ -456,12 +462,6 @@ kernel-build_merge_configs() {

./scripts/kconfig/merge_config.sh -m -r \
.config "${merge_configs[@]}" || die
-
- # If this is set by USE=secureboot or user config this will have an effect
- # on the name of the output image. Set this variable to track this setting.
- if grep -q "CONFIG_EFI_ZBOOT=y" .config; then
- KERNEL_EFI_ZBOOT=1
- fi
}

fi
--
2.43.0
Re: [PATCH 3/3] kernel-build.eclass: fix KERNEL_EFI_ZBOOT not being probed on partially supported arches [ In reply to ]
On Sun, 2023-12-17 at 20:09 +0800, WANG Xuerui wrote:
> The several partially-supported arches (those relying on
> USE=savedconfig) directly return in src_prepare(), hence previously the
> CONFIG_EFI_ZBOOT probing didn't have a chance to run when building for
> those arches, leading to wrong kernel artifact path and failed
> src_install().
>
> Move the probing to near the end of eclass src_configure(), so the flag
> correctly reflects the reality in all circumstances.
>
> Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
> ---
> eclass/kernel-build.eclass | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
> index 6b692dc4f9a0..7a041a8aacdf 100644
> --- a/eclass/kernel-build.eclass
> +++ b/eclass/kernel-build.eclass
> @@ -203,6 +203,12 @@ kernel-build_src_configure() {
> .config)
> fi
>
> + # If this is set by USE=secureboot or user config this will have an effect
> + # on the name of the output image. Set this variable to track this setting.
> + if grep -q "CONFIG_EFI_ZBOOT=y" .config; then
> + KERNEL_EFI_ZBOOT=1
> + fi
> +
> mkdir -p "${WORKDIR}"/modprep || die
> mv .config "${WORKDIR}"/modprep/ || die
> emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" olddefconfig
> @@ -456,12 +462,6 @@ kernel-build_merge_configs() {
>
> ./scripts/kconfig/merge_config.sh -m -r \
> .config "${merge_configs[@]}" || die
> -
> - # If this is set by USE=secureboot or user config this will have an effect
> - # on the name of the output image. Set this variable to track this setting.
> - if grep -q "CONFIG_EFI_ZBOOT=y" .config; then
> - KERNEL_EFI_ZBOOT=1
> - fi
> }
>
> fi

This doesn't seem correct. It won't work if KERNEL_EFI_ZBOOT is set by
one of the merged configs.

--
Best regards,
Micha? Górny
Re: [PATCH 3/3] kernel-build.eclass: fix KERNEL_EFI_ZBOOT not being probed on partially supported arches [ In reply to ]
On 12/17/23 21:11, Micha? Górny wrote:
> On Sun, 2023-12-17 at 20:09 +0800, WANG Xuerui wrote:
>> The several partially-supported arches (those relying on
>> USE=savedconfig) directly return in src_prepare(), hence previously the
>> CONFIG_EFI_ZBOOT probing didn't have a chance to run when building for
>> those arches, leading to wrong kernel artifact path and failed
>> src_install().
>>
>> Move the probing to near the end of eclass src_configure(), so the flag
>> correctly reflects the reality in all circumstances.
>>
>> Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
>> ---
>> eclass/kernel-build.eclass | 12 ++++++------
>> 1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
>> index 6b692dc4f9a0..7a041a8aacdf 100644
>> --- a/eclass/kernel-build.eclass
>> +++ b/eclass/kernel-build.eclass
>> @@ -203,6 +203,12 @@ kernel-build_src_configure() {
>> .config)
>> fi
>>
>> + # If this is set by USE=secureboot or user config this will have an effect
>> + # on the name of the output image. Set this variable to track this setting.
>> + if grep -q "CONFIG_EFI_ZBOOT=y" .config; then
>> + KERNEL_EFI_ZBOOT=1
>> + fi
>> +
>> mkdir -p "${WORKDIR}"/modprep || die
>> mv .config "${WORKDIR}"/modprep/ || die
>> emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" olddefconfig
>> @@ -456,12 +462,6 @@ kernel-build_merge_configs() {
>>
>> ./scripts/kconfig/merge_config.sh -m -r \
>> .config "${merge_configs[@]}" || die
>> -
>> - # If this is set by USE=secureboot or user config this will have an effect
>> - # on the name of the output image. Set this variable to track this setting.
>> - if grep -q "CONFIG_EFI_ZBOOT=y" .config; then
>> - KERNEL_EFI_ZBOOT=1
>> - fi
>> }
>>
>> fi
> This doesn't seem correct. It won't work if KERNEL_EFI_ZBOOT is set by
> one of the merged configs.
But isn't the src_configure phase building upon the config already
merged in src_prepare? The alternative would be keeping the
kernel-build_merge_configs logic intact, but then it has to be
duplicated for every early return branch in each ebuild's src_prepare,
which I think is too excessive...

--
WANG Xuerui
xen0n@gentoo.org
Gentoo Linux developer
PGP: 7C52 19E3 26A0 7311 3EA3 8806 C01F 7214 BC93 1414
Re: [PATCH 3/3] kernel-build.eclass: fix KERNEL_EFI_ZBOOT not being probed on partially supported arches [ In reply to ]
On Mon, 2023-12-18 at 00:02 +0800, WANG Xuerui wrote:
> On 12/17/23 21:11, Micha? Górny wrote:
> > On Sun, 2023-12-17 at 20:09 +0800, WANG Xuerui wrote:
> > > The several partially-supported arches (those relying on
> > > USE=savedconfig) directly return in src_prepare(), hence previously the
> > > CONFIG_EFI_ZBOOT probing didn't have a chance to run when building for
> > > those arches, leading to wrong kernel artifact path and failed
> > > src_install().
> > >
> > > Move the probing to near the end of eclass src_configure(), so the flag
> > > correctly reflects the reality in all circumstances.
> > >
> > > Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
> > > ---
> > > eclass/kernel-build.eclass | 12 ++++++------
> > > 1 file changed, 6 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
> > > index 6b692dc4f9a0..7a041a8aacdf 100644
> > > --- a/eclass/kernel-build.eclass
> > > +++ b/eclass/kernel-build.eclass
> > > @@ -203,6 +203,12 @@ kernel-build_src_configure() {
> > > .config)
> > > fi
> > >
> > > + # If this is set by USE=secureboot or user config this will have an effect
> > > + # on the name of the output image. Set this variable to track this setting.
> > > + if grep -q "CONFIG_EFI_ZBOOT=y" .config; then
> > > + KERNEL_EFI_ZBOOT=1
> > > + fi
> > > +
> > > mkdir -p "${WORKDIR}"/modprep || die
> > > mv .config "${WORKDIR}"/modprep/ || die
> > > emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" olddefconfig
> > > @@ -456,12 +462,6 @@ kernel-build_merge_configs() {
> > >
> > > ./scripts/kconfig/merge_config.sh -m -r \
> > > .config "${merge_configs[@]}" || die
> > > -
> > > - # If this is set by USE=secureboot or user config this will have an effect
> > > - # on the name of the output image. Set this variable to track this setting.
> > > - if grep -q "CONFIG_EFI_ZBOOT=y" .config; then
> > > - KERNEL_EFI_ZBOOT=1
> > > - fi
> > > }
> > >
> > > fi
> > This doesn't seem correct. It won't work if KERNEL_EFI_ZBOOT is set by
> > one of the merged configs.
> But isn't the src_configure phase building upon the config already
> merged in src_prepare? The alternative would be keeping the
> kernel-build_merge_configs logic intact, but then it has to be
> duplicated for every early return branch in each ebuild's src_prepare,
> which I think is too excessive...
>

Ah, sorry, you're right. I didn't notice these were two different
functions!

--
Best regards,
Micha? Górny