From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D8A6F158083 for ; Tue, 17 Sep 2024 11:57:45 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8A71BE29A7; Tue, 17 Sep 2024 11:57:40 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4BC71E29A4 for ; Tue, 17 Sep 2024 11:57:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 76C31342FA5; Tue, 17 Sep 2024 11:57:39 +0000 (UTC) X-Virus-Scanned: by amavisd-new using ClamAV at gentoo.org X-Spam-Flag: NO X-Spam-Score: -0.92 X-Spam-Level: X-Spam-Status: No, score=-0.92 tagged_above=-9999 required=3.5 tests=[AWL=-0.199, BAYES_00=-1.9, KHOP_HELO_FCRDNS=0.399, SPF_HELO_FAIL=0.001, SPF_NEUTRAL=0.779] autolearn=no autolearn_force=no Received: from smtp.gentoo.org ([127.0.0.1]) by localhost (smtp.gentoo.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id E7T24PbdWsTK; Tue, 17 Sep 2024 11:57:34 +0000 (UTC) Received: from nowa-gentoo-laptop.science.ru.nl (n036122.science.ru.nl [131.174.36.122]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 51904342FA3; Tue, 17 Sep 2024 11:57:33 +0000 (UTC) From: Andrew Ammerlaan To: gentoo-dev@lists.gentoo.org Cc: Andrew Ammerlaan Subject: [gentoo-dev] [PATCH] kernel-install.eclass: fix gentoo-kernel-bin with llvm-objcopy Date: Tue, 17 Sep 2024 13:57:30 +0200 Message-ID: <20240917115730.55495-1-andrewammerlaan@gentoo.org> X-Mailer: git-send-email 2.46.0 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: 76bbb5b8-1d38-477d-a3c9-3b24c37389bd X-Archives-Hash: 50f8ae75351a967ce9f7897adc3c7621 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 Closes: https://github.com/gentoo/gentoo/pull/38643 Signed-off-by: Andrew Ammerlaan --- 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