• [gentoo-dev] [PATCH] kernel-install.eclass: fix gentoo-kernel-bin with

    From Andrew Ammerlaan@21:1/5 to All on Tue Sep 17 14:00:03 2024
    We ship the kernel in gentoo-kernel-bin in the form of an UKI, using
    objcopy we extract from this the kernel image (and if desired the
    generic initramfs).

    However, llvm-objcopy does not properly handle the -O argument and as a
    result the extracted kernel image is of the same file type as the UKI
    (i.e. a PE32+ executable) instead of a regular kernel image. This causes
    issues in bootloader such as grub which differentiate between loading
    a normal kernel image and loading an EFI executable (such as an UKI).
    And also causes the signature verification to fail since the kernel
    image is bigger then it should be due to the additional headers.

    Using the --dump-section argument instead resolves this problem.

    See-also: https://github.com/llvm/llvm-project/issues/108946
    Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
    Closes: https://github.com/gentoo/gentoo/pull/38643
    Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
    ---
    eclass/kernel-install.eclass | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass
    index 930640188c26..dc337c7862fd 100644
    --- a/eclass/kernel-install.eclass
    +++ b/eclass/kernel-install.eclass
    @@ -650,7 +650,7 @@ kernel-install_extract_from_uki() {
    local uki=${2}
    local out=${3}

    - $(tc-getOBJCOPY) -O binary "-j.${extract_type}" "${uki}" "${out}" ||
    + $(tc-getOBJCOPY) "${uki}" --dump-section ".${extract_type}=${out}" ||
    die "Failed to extract ${extract_type}"
    chmod 644 "${out}" || die
    }
    --
    2.46.0

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)