Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 897684 - dist-kernel eclasses: handle CONFIG_EFI_ZBOOT=y
Summary: dist-kernel eclasses: handle CONFIG_EFI_ZBOOT=y
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Distribution Kernel Project
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2023-02-25 13:01 UTC by Michał Górny
Modified: 2024-01-19 16:26 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2023-02-25 13:01:46 UTC
With CONFIG_EFI_ZBOOT=y enabled, we need to change the result of dist-kernel_get_image_path() from

  arch/arm64/boot/Image.gz

to

  arch/arm64/boot/vmlinuz.efi

We either need to check which file was created or how kernel was configured.  Neither fits in the API currently defined.
Comment 1 Georgy Yakovlev archtester gentoo-dev 2023-02-25 21:32:36 UTC
I also had an install.d hook that un-compresses arch/arm64/boot/Image.gz (after it's installed) - it was required for some efi implementations.

maybe if we installed arch/arm64/boot/vmlinuz.efi I could skip it and it's same problem.
Comment 2 Georgy Yakovlev archtester gentoo-dev 2023-02-25 22:09:04 UTC
after reading it, looks like we should just change path to arch/arm64/boot/vmlinuz.efi and forcibly enable CONFIG_EFI_ZBOOT for 6.1+ kernels while doing modprep via sneaky echo.

so it's still a condition, but version dependent and not config dependent.

grub should be able to still boot it in non-efi mode and decompress it.
systemd-boot (which does not do decompression) will just work.

so probably best of both worlds.

https://cateee.net/lkddb/web-lkddb/EFI_ZBOOT.html

it only pulls this
https://cateee.net/lkddb/web-lkddb/EFI_GENERIC_STUB.html

which does not add extra deps/config options.


since I have such machine I can give it a test, but I don't know when.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2023-02-26 04:15:09 UTC
For the record, I've tried a quick hack of creating `Image.gz` symlink to make the current code work, and the test phase didn't boot.  However, it might have been because some tool in the way copied it as symlink…

Perhaps I'll just hard-change it locally and ask jiji for another run.
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2023-02-26 05:00:51 UTC
So it hangs in src_test() for me — qemu is keeping CPU 100% busy and nothing appears on screen.

I've tested with the following diff:

diff --git a/eclass/dist-kernel-utils.eclass b/eclass/dist-kernel-utils.eclass
index 439bdc87695d..d6fd45c56039 100644
--- a/eclass/dist-kernel-utils.eclass
+++ b/eclass/dist-kernel-utils.eclass
@@ -61,7 +61,7 @@ dist-kernel_get_image_path() {
                        echo arch/x86/boot/bzImage
                        ;;
                arm64)
-                       echo arch/arm64/boot/Image.gz
+                       echo arch/arm64/boot/vmlinuz.efi
                        ;;
                arm)
                        echo arch/arm/boot/zImage
diff --git a/sys-kernel/gentoo-kernel/gentoo-kernel-6.2.1.ebuild b/sys-kernel/gentoo-kernel/gentoo-kernel-6.2.1.ebuild
index 249d61f02168..1371d07b3538 100644
--- a/sys-kernel/gentoo-kernel/gentoo-kernel-6.2.1.ebuild
+++ b/sys-kernel/gentoo-kernel/gentoo-kernel-6.2.1.ebuild
@@ -10,7 +10,7 @@ GENPATCHES_P=genpatches-${PV%.*}-$(( ${PV##*.} + 1 ))
 # https://koji.fedoraproject.org/koji/packageinfo?packageID=8
 # forked to https://github.com/projg2/fedora-kernel-config-for-gentoo
 CONFIG_VER=6.2.0-gentoo
-GENTOO_CONFIG_VER=g7
+GENTOO_CONFIG_VER=g6
 
 DESCRIPTION="Linux kernel built with Gentoo patches"
 HOMEPAGE="
Comment 5 Andrew Nowa Ammerlaan gentoo-dev 2023-08-31 08:55:58 UTC
This might be worth another try, qemu 8.0 mentions some work on this in their changelog so maybe it works now.

https://wiki.qemu.org/ChangeLog/8.0
Comment 6 Larry the Git Cow gentoo-dev 2023-09-02 17:34:54 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=661829cb3563d6fde27ac540fc1b42d64ef02541

commit 661829cb3563d6fde27ac540fc1b42d64ef02541
Author:     Andrew Ammerlaan <andrewammerlaan@gentoo.org>
AuthorDate: 2023-08-31 09:03:03 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2023-09-02 17:34:35 +0000

    dist-kernel-utils.eclass: support CONFIG_EFI_ZBOOT with USE=secureboot
    
    This config options changes the name of the final image
    
    Closes: https://bugs.gentoo.org/897684
    Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
    Closes: https://github.com/gentoo/gentoo/pull/32532
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 eclass/dist-kernel-utils.eclass | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-09-03 07:08:48 UTC
Reopening per https://bugs.gentoo.org/913542#c5.
Comment 8 Larry the Git Cow gentoo-dev 2023-09-04 13:14:36 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f51bb35a3d1ea823b04d92c0c4492a38225eb75d

commit f51bb35a3d1ea823b04d92c0c4492a38225eb75d
Author:     Andrew Ammerlaan <andrewammerlaan@gentoo.org>
AuthorDate: 2023-09-03 18:19:37 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2023-09-04 13:14:16 +0000

    kernel-build.eclass: set KERNEL_EFI_ZBOOT if enabled in .config
    
    With this changes we now also support enabling CONFIG_EFI_ZBOOT
    in user /etc/kernel/config.d settings.
    
    Closes: https://bugs.gentoo.org/897684
    Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 eclass/kernel-build.eclass | 6 ++++++
 1 file changed, 6 insertions(+)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d9d7c8c96d867b6f8ea49e849160e8836d385814

commit d9d7c8c96d867b6f8ea49e849160e8836d385814
Author:     Andrew Ammerlaan <andrewammerlaan@gentoo.org>
AuthorDate: 2023-09-03 18:18:27 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2023-09-04 13:14:15 +0000

    dist-kernel-utils.eclass: introduce KERNEL_EFI_ZBOOT
    
    This new variable will track if CONFIG_EFI_ZBOOT is enabled or not
    
    Closes: https://bugs.gentoo.org/897684
    Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 eclass/dist-kernel-utils.eclass | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)