From patchwork Sun Aug 4 20:31:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 66711 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 2281A27BBE9; Sun, 4 Aug 2024 21:36:09 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E2E9C27BBE2 for ; Sun, 4 Aug 2024 21:36:06 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sahwG-0002JM-GH; Sun, 04 Aug 2024 16:34:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sahwE-0002Hr-Cf for guix-patches@gnu.org; Sun, 04 Aug 2024 16:34:46 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sahwE-0008L4-3P for guix-patches@gnu.org; Sun, 04 Aug 2024 16:34:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=UZ0AofGGSRBvSGZT7PcQcvZAkripp1k6r4K1SENLjlQ=; b=p0/VrM+s0GK9WSN6fvzdhZl6y+tgLWeKrHge+r8GRclBaxWkgbHotIOkYi75qw1WhaQkP5nvIsF+13LxBCzD8LWQlux2yEj/rJLIObzJittruLXxp0YYZCqzJCO5ZIhMq25Gca8OsbmOq8FwF9Ckl59laK7QOQVbzUiaoH4eEdZ11zVJE3WADhnFKcHJ3wyRaKsnb7ucJZj8KmHx0AxD8F3JrfhoefgFvorP3iiMH5iSAMc9qA5Pu6gqztkGhHw2ttT0S2oYA7RoarBO8KMsmU67UPOhvPM1XjYeZlxzNHPrQt8C5jwO5hQ2P9VoeqyE0/MAyGL1G9trb84GdMjstQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sahwY-0006P9-CH; Sun, 04 Aug 2024 16:35:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#72457] [PATCH v3 10/15] gnu: packages: Add systemd-stub. Resent-From: Lilah Tascheter Original-Sender: "Debbugs-submit" Resent-CC: efraim@flashner.co.il, lilah@lunabee.space, vagrant@debian.org, guix-patches@gnu.org Resent-Date: Sun, 04 Aug 2024 20:35:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72457 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 72457@debbugs.gnu.org Cc: Lilah Tascheter , Sergey Trofimov , Efraim Flashner , Lilah Tascheter , Vagrant Cascadian X-Debbugs-Original-Xcc: Efraim Flashner , Lilah Tascheter , Vagrant Cascadian Received: via spool by 72457-submit@debbugs.gnu.org id=B72457.172280366724328 (code B ref 72457); Sun, 04 Aug 2024 20:35:06 +0000 Received: (at 72457) by debbugs.gnu.org; 4 Aug 2024 20:34:27 +0000 Received: from localhost ([127.0.0.1]:57363 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sahvv-0006KG-2r for submit@debbugs.gnu.org; Sun, 04 Aug 2024 16:34:27 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:56778) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sahvs-0006J2-Cw for 72457@debbugs.gnu.org; Sun, 04 Aug 2024 16:34:25 -0400 Authentication-Results: purelymail.com; auth=pass DKIM-Signature: a=rsa-sha256; b=DpSoSxw4WZo/KxZvkrjhC2hP3IZSXAmG8wS2Yj/p1Toqpvac8QYJJNdaxYfOCYTEkhZfcqLbJC5hef7hJjTzN2lI6jqwHLSTYzIxlrDty4aEwHpOBjF7K5BBI0dAGWyAks88s37AJ0tion4cm/PT9rfsGOmdO7A/TpaZxJoLnNZkuZu5aqsFpWQ15ydmTqlSSPJHzjGVLHLLArYG0TvAqzR0Zb63eopXX06VCM8SFv+7YlkS3dbnOb9DfiSxsEnozG1jkB5J+Gm8A2WJaJyR9uj7nGB0vPylW55YI5SHw2uxsph3gKZ3mTtzvfBkqsGXbxw/DuKBRSZ1xd3CJJj8BA==; s=purelymail2; d=lunabee.space; v=1; bh=Ic6xShpNZpP3V6qeBaL/8+Kb853rtDBiJaIhQxHdHhU=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=U57z+fLF1MRTfkH3eQIxqx4uYFHiM0CuoAe2mjXOmk+PvvaogWEAoLp+kkoW5ycjsAqpQGXN2gaW5FfcUROeswJp4b4aDiV8kuNFSyrKNgoZuszBdlXaBUJXFkYMwGmaOTnhqGgxhcZ2pr2DjuFUJH5f7KQi5CKKJqLu/RCUEVpeFX6AowOL6yxOUM/2QyXV/MZyekdBU8JXahEZe6S5a+wnj9xeqqv3LeblqSA5R3dA0VkLp98GZvaCrEqeq2bM8SOM5CVkT0qAq7j9GJUdBaoKuRlFYska6KO34k7oVv5hzrHxUQfla/1rTFvQQEJkSj5l/kR3DqyWi/zAWCajgw==; s=purelymail2; d=purelymail.com; v=1; bh=Ic6xShpNZpP3V6qeBaL/8+Kb853rtDBiJaIhQxHdHhU=; h=Feedback-ID:Received:From:To:Subject:Date; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 72457@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -1317130453; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 04 Aug 2024 20:33:42 +0000 (UTC) Date: Sun, 4 Aug 2024 15:31:56 -0500 Message-ID: <101a8d7e648c767fffec3c9d00849847dcaaf206.1722803521.git.lilah@lunabee.space> In-Reply-To: References: MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Lilah Tascheter via Guix-patches From: Lilah Tascheter Reply-To: Lilah Tascheter Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/bootloader.scm (%efi-supported-systems, lazy-efibootmgr): New variable. (install-efi): Use lazy-efibootmgr. * gnu/packages/bootloaders.scm (systemd-stub): New variable. Change-Id: I974bad9ff7a52f736286d05de53f7c5ccb60b9d6 --- gnu/bootloader.scm | 13 +++++++++-- gnu/packages/bootloaders.scm | 43 ++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index f855671e82..6d1ecd9f00 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -28,7 +28,6 @@ (define-module (gnu bootloader) #:autoload (gnu build file-systems) (read-partition-label read-partition-uuid find-partition-by-label find-partition-by-uuid) - #:use-module (gnu packages linux) #:use-module (gnu system file-systems) #:use-module (gnu system uuid) #:autoload (guix build syscalls) @@ -115,6 +114,7 @@ (define-module (gnu bootloader) bootloader-configuration->gexp bootloader-configurations->gexp + %efi-supported-systems efi-arch install-efi)) @@ -647,6 +647,11 @@ (define (bootloader-configurations->gexp bootloader-configs . rest) ;;; EFI shit ;;; +;; systems currently supported by efi-arch. should be used for packages relying +;; on it. +(define %efi-supported-systems + '("i686-linux" "x86_64-linux" "armhf-linux" "aarch64-linux" "riscv64-linux")) + (define* (efi-arch #:key (target (or (%current-target-system) (%current-system))) (32? #f)) "Returns the UEFI architecture name for the current target, in lowercase." @@ -658,6 +663,10 @@ (define* (efi-arch #:key (target (or (%current-target-system) (%current-system)) (else (raise (formatted-message (G_ "no UEFI standard arch for ~a!") target))))) +(define (lazy-efibootmgr) + "Lazy-loaded efibootmgr package, in order to prevent circular refs." + (module-ref (resolve-interface '(gnu packages linux)) 'efibootmgr)) + (define (install-efi bootloader-config plan) "Returns a gexp installing PLAN to the ESP, as denoted by the 'vendir target. PLAN is a gexp of a list of '(BUILDER DEST-BASENAME . LABEL) triples, that @@ -680,5 +689,5 @@ (define (install-efi bootloader-config plan) ;; normal install when not doing a removable config (with-targets targets (('vendir => (vendir :path) (loader :devpath) (disk :device)) - #~(install-efi #+(file-append efibootmgr "/sbin/efibootmgr") + #~(install-efi #+(file-append (lazy-efibootmgr) "/sbin/efibootmgr") #$vendir #$loader #$disk #$plan)))))) diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm index 04bb1b06f0..2bc04059d2 100644 --- a/gnu/packages/bootloaders.scm +++ b/gnu/packages/bootloaders.scm @@ -38,6 +38,7 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu packages bootloaders) + #:use-module (gnu bootloader) #:use-module (gnu packages) #:use-module (gnu packages assembly) #:use-module (gnu packages base) @@ -54,6 +55,7 @@ (define-module (gnu packages bootloaders) #:use-module (gnu packages fontutils) #:use-module (gnu packages gcc) #:use-module (gnu packages gettext) + #:use-module (gnu packages gperf) #:use-module (gnu packages linux) #:use-module (gnu packages llvm) #:use-module (gnu packages man) @@ -592,6 +594,47 @@ (define systemd-source (base32 "1qdyw9g3jgvsbc1aryr11gpc3075w5pg00mqv4pyf3hwixxkwaq6")))) +(define-public systemd-stub + (package + (name "systemd-stub") + (version systemd-version) + (source systemd-source) + (build-system meson-build-system) + (arguments + (list #:configure-flags + #~(list "-Dmode=release" "-Defi=true" "-Dsbat-distro=guix" + "-Dsbat-distro-generation=1" ; package revision! + "-Dsbat-distro-summary=Guix System" + "-Dsbat-distro-url=https://guix.gnu.org" + #$(string-append "-Dsbat-distro-pkgname=" + (package-name this-package)) + #$(string-append "-Dsbat-distro-version=" + (package-version this-package))) + #:phases + ;; TODO: 32bit support + (let* ((stub (string-append + "src/boot/efi/linux" (efi-arch) ".efi.stub"))) + #~(modify-phases %standard-phases + (replace 'build + (lambda* (#:key parallel-build? #:allow-other-keys) + (invoke "ninja" #$stub + "-j" (if parallel-build? + (number->string (parallel-job-count)) "1")))) + (replace 'install + (lambda _ + (let ((libexec (string-append #$output "/libexec"))) + (install-file #$stub libexec)))) + (delete 'check))))) + (supported-systems %efi-supported-systems) + (inputs (list libcap python-pyelftools `(,util-linux "lib"))) + (native-inputs (list gperf pkg-config python-3 python-jinja2)) + (home-page "https://systemd.io/") + (synopsis "Unified kernel image UEFI stub") + (description "Simple UEFI boot stub that loads a conjoined kernel image and +supporting data to their proper locations, before chainloading to the kernel. +Supports measured and/or verified boot environments.") + (license license:lgpl2.1+))) + (define-public ukify (package (name "ukify")