unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Lilah Tascheter via Guix-patches <guix-patches@gnu.org>
To: 72457@debbugs.gnu.org
Cc: Lilah Tascheter <lilah@lunabee.space>, Tomas Volf <~@wolfsden.cz>,
	Sergey Trofimov <sarg@sarg.org.ru>,
	Efraim Flashner <efraim@flashner.co.il>,
	Lilah Tascheter <lilah@lunabee.space>,
	Vagrant Cascadian <vagrant@debian.org>
Subject: [bug#72457] [PATCH v2 10/15] gnu: packages: Add systemd-stub.
Date: Sun,  4 Aug 2024 13:06:09 -0500	[thread overview]
Message-ID: <d393d581e40a2d3ca3c92e6baacac64f1f84a7cb.1722794774.git.lilah@lunabee.space> (raw)
In-Reply-To: <cover.1722794774.git.lilah@lunabee.space>

* 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 cb96b076ae..bc1eb74ae9 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))
 
@@ -645,6 +645,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."
@@ -656,6 +661,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
@@ -678,5 +687,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 <http://www.gnu.org/licenses/>.
 
 (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")
-- 
2.45.2





  parent reply	other threads:[~2024-08-04 18:35 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-04  3:50 [bug#72457] [PATCH 00/15] Rewrite bootloader subsystem Lilah Tascheter via Guix-patches
2024-08-04  3:55 ` [bug#72457] [PATCH 01/15] guix: scripts: Rewrite reinstall-bootloader to use provenance data Lilah Tascheter via Guix-patches
2024-08-04  3:55 ` [bug#72457] [PATCH 02/15] gnu: Add bootloader target infastructure Lilah Tascheter via Guix-patches
2024-08-04  3:55 ` [bug#72457] [PATCH 03/15] guix: scripts: Remove unused code Lilah Tascheter via Guix-patches
2024-08-04  3:55 ` [bug#72457] [PATCH 04/15] gnu: Core bootloader changes Lilah Tascheter via Guix-patches
2024-08-04  3:55 ` [bug#72457] [PATCH 05/15] gnu: system: Remove useless boot parameters Lilah Tascheter via Guix-patches
2024-08-04  3:55 ` [bug#72457] [PATCH 06/15] gnu: bootloader: Add raspberry pi bootloader Lilah Tascheter via Guix-patches
2024-08-04  3:55 ` [bug#72457] [PATCH 07/15] gnu: system: Fix bootloader crypto device recognition Lilah Tascheter via Guix-patches
2024-08-04  9:22   ` Tomas Volf
2024-08-04  3:55 ` [bug#72457] [PATCH 08/15] gnu: packages: Add pesign Lilah Tascheter via Guix-patches
2024-08-04  3:55 ` [bug#72457] [PATCH 09/15] gnu: packages: Add ukify Lilah Tascheter via Guix-patches
2024-08-04  3:55 ` [bug#72457] [PATCH 10/15] gnu: packages: Add systemd-stub Lilah Tascheter via Guix-patches
2024-08-04  3:55 ` [bug#72457] [PATCH 11/15] gnu: bootloaders: Add uki-efi-bootloader Lilah Tascheter via Guix-patches
2024-08-04  3:55 ` [bug#72457] [PATCH 12/15] gnu: system: Update examples Lilah Tascheter via Guix-patches
2024-08-04  3:55 ` [bug#72457] [PATCH 13/15] doc: Update bootloader documentation Lilah Tascheter via Guix-patches
2024-08-04  3:55 ` [bug#72457] [PATCH 14/15] gnu: tests: Update tests to new targets system Lilah Tascheter via Guix-patches
2024-08-04  3:55 ` [bug#72457] [PATCH 15/15] teams: Add bootloading team Lilah Tascheter via Guix-patches
2024-08-04  8:53 ` [bug#72457] [PATCH 00/15] Rewrite bootloader subsystem Sergey Trofimov
2024-08-04  9:19   ` Sergey Trofimov
2024-08-04 18:05 ` [bug#72457] [PATCH v2 " Lilah Tascheter via Guix-patches
2024-08-04 18:06   ` [bug#72457] [PATCH v2 01/15] guix: scripts: Rewrite reinstall-bootloader to use provenance data Lilah Tascheter via Guix-patches
2024-08-04 18:06   ` [bug#72457] [PATCH v2 02/15] gnu: Add bootloader target infastructure Lilah Tascheter via Guix-patches
2024-08-04 18:06   ` [bug#72457] [PATCH v2 03/15] guix: scripts: Remove unused code Lilah Tascheter via Guix-patches
2024-08-04 18:06   ` [bug#72457] [PATCH v2 04/15] gnu: Core bootloader changes Lilah Tascheter via Guix-patches
2024-08-04 18:06   ` [bug#72457] [PATCH v2 05/15] gnu: system: Remove useless boot parameters Lilah Tascheter via Guix-patches
2024-08-04 18:06   ` [bug#72457] [PATCH v2 06/15] gnu: bootloader: Add raspberry pi bootloader Lilah Tascheter via Guix-patches
2024-08-04 18:06   ` [bug#72457] [PATCH v2 07/15] gnu: system: Fix bootloader crypto device recognition Lilah Tascheter via Guix-patches
2024-08-04 18:06   ` [bug#72457] [PATCH v2 08/15] gnu: packages: Add pesign Lilah Tascheter via Guix-patches
2024-08-04 18:06   ` [bug#72457] [PATCH v2 09/15] gnu: packages: Add ukify Lilah Tascheter via Guix-patches
2024-08-04 18:06   ` Lilah Tascheter via Guix-patches [this message]
2024-08-04 18:06   ` [bug#72457] [PATCH v2 11/15] gnu: bootloaders: Add uki-efi-bootloader Lilah Tascheter via Guix-patches
2024-08-04 18:06   ` [bug#72457] [PATCH v2 12/15] gnu: system: Update examples Lilah Tascheter via Guix-patches
2024-08-04 18:06   ` [bug#72457] [PATCH v2 13/15] doc: Update bootloader documentation Lilah Tascheter via Guix-patches
2024-08-04 18:06   ` [bug#72457] [PATCH v2 14/15] gnu: tests: Update tests to new targets system Lilah Tascheter via Guix-patches
2024-08-04 18:06   ` [bug#72457] [PATCH v2 15/15] teams: Add bootloading team Lilah Tascheter via Guix-patches
2024-08-04 19:52   ` [bug#72457] [PATCH v2 00/15] Rewrite bootloader subsystem Sergey Trofimov
2024-08-04 20:31 ` [bug#72457] [PATCH v3 " Lilah Tascheter via Guix-patches
2024-08-04 20:31   ` [bug#72457] [PATCH v3 01/15] guix: scripts: Rewrite reinstall-bootloader to use provenance data Lilah Tascheter via Guix-patches
2024-08-04 20:31   ` [bug#72457] [PATCH v3 02/15] gnu: Add bootloader target infastructure Lilah Tascheter via Guix-patches
2024-08-04 20:31   ` [bug#72457] [PATCH v3 03/15] guix: scripts: Remove unused code Lilah Tascheter via Guix-patches
2024-08-04 20:31   ` [bug#72457] [PATCH v3 04/15] gnu: Core bootloader changes Lilah Tascheter via Guix-patches
2024-08-04 20:31   ` [bug#72457] [PATCH v3 05/15] gnu: system: Remove useless boot parameters Lilah Tascheter via Guix-patches
2024-08-04 20:31   ` [bug#72457] [PATCH v3 06/15] gnu: bootloader: Add raspberry pi bootloader Lilah Tascheter via Guix-patches
2024-08-04 20:31   ` [bug#72457] [PATCH v3 07/15] gnu: system: Fix bootloader crypto device recognition Lilah Tascheter via Guix-patches
2024-08-04 20:31   ` [bug#72457] [PATCH v3 08/15] gnu: packages: Add pesign Lilah Tascheter via Guix-patches
2024-08-04 20:31   ` [bug#72457] [PATCH v3 09/15] gnu: packages: Add ukify Lilah Tascheter via Guix-patches
2024-08-04 20:31   ` [bug#72457] [PATCH v3 10/15] gnu: packages: Add systemd-stub Lilah Tascheter via Guix-patches
2024-08-04 20:31   ` [bug#72457] [PATCH v3 11/15] gnu: bootloaders: Add uki-efi-bootloader Lilah Tascheter via Guix-patches
2024-08-04 20:31   ` [bug#72457] [PATCH v3 12/15] gnu: system: Update examples Lilah Tascheter via Guix-patches
2024-08-04 20:31   ` [bug#72457] [PATCH v3 13/15] doc: Update bootloader documentation Lilah Tascheter via Guix-patches
2024-08-04 20:32   ` [bug#72457] [PATCH v3 14/15] gnu: tests: Update tests to new targets system Lilah Tascheter via Guix-patches
2024-08-04 20:32   ` [bug#72457] [PATCH v3 15/15] teams: Add bootloading team Lilah Tascheter via Guix-patches
2024-08-05  7:00   ` [bug#72457] [PATCH v3 00/15] Rewrite bootloader subsystem Sergey Trofimov
2024-08-06  2:44 ` [bug#72457] [PATCH v4 " Lilah Tascheter via Guix-patches
2024-08-06  2:44   ` [bug#72457] [PATCH v4 01/15] guix: scripts: Rewrite reinstall-bootloader to use provenance data Lilah Tascheter via Guix-patches
2024-08-06  2:44   ` [bug#72457] [PATCH v4 02/15] gnu: Add bootloader target infastructure Lilah Tascheter via Guix-patches
2024-08-06  2:44   ` [bug#72457] [PATCH v4 03/15] guix: scripts: Remove unused code Lilah Tascheter via Guix-patches
2024-08-06  2:44   ` [bug#72457] [PATCH v4 04/15] gnu: Core bootloader changes Lilah Tascheter via Guix-patches
2024-08-06  2:44   ` [bug#72457] [PATCH v4 05/15] gnu: system: Remove useless boot parameters Lilah Tascheter via Guix-patches
2024-08-06  2:44   ` [bug#72457] [PATCH v4 06/15] gnu: bootloader: Add raspberry pi bootloader Lilah Tascheter via Guix-patches
2024-08-06  2:44   ` [bug#72457] [PATCH v4 07/15] gnu: system: Fix bootloader crypto device recognition Lilah Tascheter via Guix-patches
2024-08-06  2:44   ` [bug#72457] [PATCH v4 08/15] gnu: packages: Add pesign Lilah Tascheter via Guix-patches
2024-08-06  2:44   ` [bug#72457] [PATCH v4 09/15] gnu: packages: Add ukify Lilah Tascheter via Guix-patches
2024-08-06  2:44   ` [bug#72457] [PATCH v4 10/15] gnu: packages: Add systemd-stub Lilah Tascheter via Guix-patches
2024-08-06  2:44   ` [bug#72457] [PATCH v4 11/15] gnu: bootloaders: Add uki-efi-bootloader Lilah Tascheter via Guix-patches
2024-08-06  2:44   ` [bug#72457] [PATCH v4 12/15] gnu: system: Update examples Lilah Tascheter via Guix-patches
2024-08-06  2:44   ` [bug#72457] [PATCH v4 13/15] doc: Update bootloader documentation Lilah Tascheter via Guix-patches
2024-08-06  2:44   ` [bug#72457] [PATCH v4 14/15] gnu: tests: Update tests to new targets system Lilah Tascheter via Guix-patches
2024-08-06  2:44   ` [bug#72457] [PATCH v4 15/15] teams: Add bootloading team Lilah Tascheter via Guix-patches
2024-08-06  6:13   ` [bug#72457] [PATCH v4 00/15] Rewrite bootloader subsystem Sergey Trofimov
2024-08-07  0:11 ` [bug#72457] [PATCH v5 " Lilah Tascheter via Guix-patches
2024-08-07  0:11   ` [bug#72457] [PATCH v5 01/15] guix: scripts: Rewrite reinstall-bootloader to use provenance data Lilah Tascheter via Guix-patches
2024-08-07  0:11   ` [bug#72457] [PATCH v5 02/15] gnu: Add bootloader target infastructure Lilah Tascheter via Guix-patches
2024-08-07  0:11   ` [bug#72457] [PATCH v5 03/15] guix: scripts: Remove unused code Lilah Tascheter via Guix-patches
2024-08-07  0:11   ` [bug#72457] [PATCH v5 04/15] gnu: Core bootloader changes Lilah Tascheter via Guix-patches
2024-08-07  0:11   ` [bug#72457] [PATCH v5 05/15] gnu: system: Remove useless boot parameters Lilah Tascheter via Guix-patches
2024-08-07  0:11   ` [bug#72457] [PATCH v5 06/15] gnu: bootloader: Add raspberry pi bootloader Lilah Tascheter via Guix-patches
2024-08-07  0:11   ` [bug#72457] [PATCH v5 07/15] gnu: system: Fix bootloader crypto device recognition Lilah Tascheter via Guix-patches
2024-08-07  0:11   ` [bug#72457] [PATCH v5 08/15] gnu: packages: Add pesign Lilah Tascheter via Guix-patches
2024-08-07  0:11   ` [bug#72457] [PATCH v5 09/15] gnu: packages: Add ukify Lilah Tascheter via Guix-patches
2024-08-07  0:11   ` [bug#72457] [PATCH v5 10/15] gnu: packages: Add systemd-stub Lilah Tascheter via Guix-patches
2024-08-07  0:11   ` [bug#72457] [PATCH v5 11/15] gnu: bootloaders: Add uki-efi-bootloader Lilah Tascheter via Guix-patches
2024-08-07  0:11   ` [bug#72457] [PATCH v5 12/15] gnu: system: Update examples Lilah Tascheter via Guix-patches
2024-08-07  0:11   ` [bug#72457] [PATCH v5 13/15] doc: Update bootloader documentation Lilah Tascheter via Guix-patches
2024-08-07  0:11   ` [bug#72457] [PATCH v5 14/15] gnu: tests: Update tests to new targets system Lilah Tascheter via Guix-patches
2024-08-07  0:11   ` [bug#72457] [PATCH v5 15/15] teams: Add bootloading team Lilah Tascheter via Guix-patches
2024-08-07  4:52   ` [bug#72457] [PATCH v5 00/15] Rewrite bootloader subsystem Sergey Trofimov
2024-09-06 22:15   ` guix-patches--- via
2024-09-07  5:48     ` Sergey Trofimov
2024-09-07  7:15       ` guix-patches--- via
2024-09-12 18:08 ` [bug#72457] [PATCH v5 01/15] guix: scripts: Rewrite reinstall-bootloader to use provenance data Herman Rimm via Guix-patches via
2024-09-13  7:56   ` Herman Rimm via Guix-patches via
2024-09-15  9:11 ` [bug#72457] [PATCH v5 00/15] Rewrite bootloader subsystem Herman Rimm via Guix-patches via
2024-09-17 22:20   ` Lilah Tascheter via Guix-patches
2024-09-19 15:35     ` Herman Rimm via Guix-patches via
2024-09-19 17:38       ` Herman Rimm via Guix-patches via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d393d581e40a2d3ca3c92e6baacac64f1f84a7cb.1722794774.git.lilah@lunabee.space \
    --to=guix-patches@gnu.org \
    --cc=72457@debbugs.gnu.org \
    --cc=efraim@flashner.co.il \
    --cc=lilah@lunabee.space \
    --cc=sarg@sarg.org.ru \
    --cc=vagrant@debian.org \
    --cc=~@wolfsden.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).