From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id YN5UHHe8smabUAEAqHPOHw:P1 (envelope-from ) for ; Wed, 07 Aug 2024 00:14:47 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id YN5UHHe8smabUAEAqHPOHw (envelope-from ) for ; Wed, 07 Aug 2024 02:14:47 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=AX+K2t4E; dkim=fail ("headers rsa verify failed") header.d=lunabee.space header.s=purelymail3 header.b=jvjv+tXS; dkim=fail ("headers rsa verify failed") header.d=purelymail.com header.s=purelymail3 header.b=ORaZVFjM; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1722989687; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=5QSG0wTzV5k2fScwkPebXVRyL9pDW0ssis/ezNWz6BM=; b=Nufh3ZzMcQ3rY5vwJJTY+exgRyPeBe48z2izrV4RNvDYzn2mbsjWTTnzu2p98rNNUZZtUR fQMyFr8pHUe3lPPAlKKE4qNw4ByMk4OfhfLbw9lT+lBqHIPFyd9Ii3SZfn0xIS6WN1uFgl XHwToJMVyqLm0k3xPBXBqiLU8pE5ECN7NCVoAPhKZjj70ZUUJYR3oTM2Z//qL3/kjrYyVz TdHz4TmGNu2nkXhJmMtmoI1jwXLK1dIjuJkdIN1uNIrsy4iTMqs/BbDNBLbVNVFgtW/mkA z6jtrdkjaucQGCqA+2d5j1EC/YvjkKNdC5H9S6B/EUk5c+hIG5DafWdumGuywA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1722989687; a=rsa-sha256; cv=none; b=IlgbfxoJCF8H5CAZzt/cwArsyGeNp4RYlfk57fIc0/57i8pRHCzVBfMc+r19Jku3KiDVKf oQbdeUnADKYCYDhhcBaAi2nQYqmKiG+RX7lkw8oIrJ9TFI0Ys7gmPv26Q2zzuEErPxV5OJ QuBjWrOVnjw2D5Ca1NYRLJL7fvhmEWTbw1umrk4iHgPmojjZWbniVF9xbMLl5nD4QjdVGz fRZgLG6rYGZFrp/3h6/6I8HZWS+qVnCUh+JlpqSIYXMxPRT690aoh06w+94FZmIIdDAAgj gLQfebImWb7211K3MO33wExWKhWFaW6UeOJkH6VfS65YFhifeutt6N9bvbHqjA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=AX+K2t4E; dkim=fail ("headers rsa verify failed") header.d=lunabee.space header.s=purelymail3 header.b=jvjv+tXS; dkim=fail ("headers rsa verify failed") header.d=purelymail.com header.s=purelymail3 header.b=ORaZVFjM; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3A67F651B1 for ; Wed, 07 Aug 2024 02:14:46 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sbUK7-0008Kx-S6; Tue, 06 Aug 2024 20:14:39 -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 1sbUK6-0008EF-7E for guix-patches@gnu.org; Tue, 06 Aug 2024 20:14:38 -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 1sbUK5-0002ch-UW for guix-patches@gnu.org; Tue, 06 Aug 2024 20:14:37 -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=5QSG0wTzV5k2fScwkPebXVRyL9pDW0ssis/ezNWz6BM=; b=AX+K2t4EJbMtsMPq6WdUDPjDACy9lQUqn1x5sdmsSFAosLeRwxrKa+Sxe56zIn7WclFFhza2NxqayUGiO3yl37JsQnORuJRdk5lJwtfGBeIwrANSO09GJxIra/F91oXdQHNn65GQIFTP4QNvesoKmWDYjugX8i8docuE9j2jm0/6j1RoPKKRtflSBoEqUTVHlbV0P8C9cE4FS1ntVdpv9PhIhcTx3tHJ5Q/yEnTPS9yC+qRr/EE6Isn3YJD76S3b+zGirrxkTPBEqTVlh0XEwbt9uwOh4fW0HtIbXlY5wUcJZUxSb/8nYHirAl6d66s9WJtPn9e8dXMCoYQqoRHcoA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sbUKU-00071c-AT; Tue, 06 Aug 2024 20:15:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#72457] [PATCH v5 11/15] gnu: bootloaders: Add uki-efi-bootloader. Resent-From: Lilah Tascheter Original-Sender: "Debbugs-submit" Resent-CC: lilah@lunabee.space, guix-patches@gnu.org Resent-Date: Wed, 07 Aug 2024 00:15:02 +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 , Lilah Tascheter X-Debbugs-Original-Xcc: Lilah Tascheter Received: via spool by 72457-submit@debbugs.gnu.org id=B72457.172298964926872 (code B ref 72457); Wed, 07 Aug 2024 00:15:02 +0000 Received: (at 72457) by debbugs.gnu.org; 7 Aug 2024 00:14:09 +0000 Received: from localhost ([127.0.0.1]:33299 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sbUJc-0006z1-9h for submit@debbugs.gnu.org; Tue, 06 Aug 2024 20:14:09 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:55808) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sbUJa-0006wY-8H for 72457@debbugs.gnu.org; Tue, 06 Aug 2024 20:14:07 -0400 DKIM-Signature: a=rsa-sha256; b=jvjv+tXSzbtWw2KMMwN31AADQ1OUon7dDAKYwWqLGdbvffQDfp1M4eERVdAPkaLfF337srDF7vIXxCgEG0Qygb07kp3p70dmiGHaSorK/QbwsXPqlptAEh9E960b5j+LRR+CDaUAIca/sK9uciDNygBQQz3vKkeCX3GXeRAt4ylx6VzTNDUYA4vDDnIdwwzRT0EGjCBBH4UtqmGjMynMPVQeROkbWBNpwlq12+n49E08FbKy65WrCrOTrJiTDTOuXCRBhdYdYhBKfvUqcmal50kpLkfVQg6WWncKJ28UhmsdU0N63p8f//oBddiB8rd5VFoLrOlBqjBuA3TIJ1pbsQ==; s=purelymail3; d=lunabee.space; v=1; bh=T+AZEhftm/YK31w3f01NzZQvQVYNGoGNL1a4N9i1Lko=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=ORaZVFjMu5RiRmeR6AVv8EjlWdEyJ2ebsOfwUP6VV9MAr7G/uerfM9tszNHSfjMGY3tvClyifrP5gHNhrEM0PGVr0tkeXQR1K7Et9LtC+GkTdYgQa6SzEJpeGqQEzjFqffTMtizMc60H8ufSznI5VlXIn7R6I1IlHW7q6j6alz+y9+vp+4m/PD1Ekf8tqPv+ASrHSd0ge9XpdV49wdEEbP96hJ2fgalCddxr5wIfmBe1rxnVMmLQwX1ecteRr7iuofzTSIskOO9Nn3mxe+uvpo+UPpGF9fiS4XXOblshNa6AJbDQgmnBcO1AIzn8mzgMlZxAfmxpzpoIYQ7bQvl6dQ==; s=purelymail3; d=purelymail.com; v=1; bh=T+AZEhftm/YK31w3f01NzZQvQVYNGoGNL1a4N9i1Lko=; 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 -1661201426; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Wed, 07 Aug 2024 00:13:16 +0000 (UTC) Date: Tue, 6 Aug 2024 19:11:24 -0500 Message-ID: <5c9d358dcc797b9cf3370ec96d656a994ed10b4a.1722989488.git.lilah@lunabee.space> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: , From: Lilah Tascheter via Guix-patches Reply-To: Lilah Tascheter Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -3.94 X-Spam-Score: -3.94 X-Migadu-Queue-Id: 3A67F651B1 X-Migadu-Scanner: mx11.migadu.com X-TUID: jsTbKGV6dYp0 * gnu/bootloader.scm (): New keypair field. * gnu/bootloader/uki.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add bootloader/uki.scm. Change-Id: I2097da9f3dd35137b3419f6d0545de26d53cb6da --- gnu/bootloader.scm | 3 ++ gnu/bootloader/uki.scm | 96 ++++++++++++++++++++++++++++++++++++++++++ gnu/local.mk | 1 + 3 files changed, 100 insertions(+) create mode 100644 gnu/bootloader/uki.scm diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index 3a58d74a47..cb0919940f 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -101,6 +101,7 @@ (define-module (gnu bootloader) bootloader-configuration-default-entry bootloader-configuration-efi-removable? bootloader-configuration-32bit? + bootloader-configuration-keypair bootloader-configuration-timeout bootloader-configuration-keyboard-layout bootloader-configuration-theme @@ -527,6 +528,8 @@ (define-record-type* (default #f)) ;bool (32bit? bootloader-configuration-32bit? (default #f)) ;bool + (keypair bootloader-configuration-keypair + (default #f)) ;(cert . priv) pair (timeout bootloader-configuration-timeout (default 5)) ;seconds as integer (keyboard-layout bootloader-configuration-keyboard-layout diff --git a/gnu/bootloader/uki.scm b/gnu/bootloader/uki.scm new file mode 100644 index 0000000000..4871dbe037 --- /dev/null +++ b/gnu/bootloader/uki.scm @@ -0,0 +1,96 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2024 Lilah Tascheter +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu bootloader uki) + #:use-module (gnu bootloader) + #:use-module (gnu packages bootloaders) + #:use-module (gnu packages efi) + #:use-module (gnu packages linux) + #:use-module (gnu system boot) + #:use-module (guix gexp) + #:use-module (guix diagnostics) + #:use-module (guix i18n) + #:use-module (guix records) + #:export (uki-efi-bootloader)) + +;; TODO: support 32bit/mixed-mode UEFI. +;; https://github.com/systemd/systemd/issues/17056 may be relevant +(define bootcfg->menu-entry->builder + (match-record-lambda (32bit? theme keypair) + (match-record-lambda + (label linux linux-arguments initrd chain-loader) + ;; support chainloader in order to allow arbitrary signed EFI binari= es + (cond + ((and chain-loader keypair) + #~(lambda (dest) + (invoke/quiet #+(sbsigntools "/bin/sbsign") + "--cert" #$(car keypair) "--key" #$(cdr keypair) + "--output" dest #$chain-loader) + (invoke/quiet #+(sbsigntools "/bin/sbverify") + "--cert" #$(car keypair) dest))) + (chain-loader #~(lambda (dest) (copy-file #$chain-loader dest))) + (linux + (let* ((arch (efi-arch #:32? 32bit?)) + (stub (file-append systemd-stub + "/libexec/linux" arch ".efi.stub"))) + #~(lambda (dest) + (invoke/quiet #+(file-append ukify "/bin/ukify") + "build" "--output" dest + "--linux" #$linux "--initrd" #$initrd + "--cmdline" (string-join (list #$@linux-arguments)) + "--os-release" #$label "--stub" #$stub "--efi-arch" #$ar= ch + #$@(if theme #~("--splash" #$theme) '()) + #$@(if keypair #~("--secureboot-certificate" #$(car keyp= air) + "--secureboot-private-key" #$(cdr keyp= air)) + '()))))) + (else (leave (G_ "uki-efi-bootloader doesn't support multiboot")))= )))) + +;; we cannot use guix's build system to make UKI images for two reasons: +;; 1. signing is necessarily non-reproducable, especially since keys shoul= d not +;; be in the store, or else risk being publically accessible. +;; 2. menu-entries may reference files which do not exist in the store. +(define* (install-uki #:key bootloader-config + current-boot-alternative + old-boot-alternatives + #:allow-other-keys) + (define* (menu-entry->plan entry num #:optional (prefix "menu-entry")) + #~(cons* #$((bootcfg->menu-entry->builder bootloader-config) entry) + #$(string-append prefix "-" (number->string num) ".efi") + #$(menu-entry-label entry))) + + (define (boot-alternative->plan alt) + (menu-entry->plan (boot-alternative->menu-entry alt) + (boot-alternative-generation alt) + "generation")) + + (install-efi bootloader-config + (let ((entries (bootloader-configuration-menu-entries bootloader-confi= g))) + #~(list #$(boot-alternative->plan current-boot-alternative) + #$@(map menu-entry->plan entries (iota (length entries))) + #$@(map boot-alternative->plan old-boot-alternatives))))) + + + +(define uki-efi-bootloader + (bootloader + (name 'uki-efi) + (default-targets (list (bootloader-target + (type 'vendir) + (offset 'esp) + (path "EFI/Guix")))) + (installer install-uki))) diff --git a/gnu/local.mk b/gnu/local.mk index 8375e13709..32ed753ee2 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -93,6 +93,7 @@ GNU_SYSTEM_MODULES =3D=09=09=09=09\ %D%/bootloader/extlinux.scm \ %D%/bootloader/u-boot.scm \ %D%/bootloader/depthcharge.scm \ + %D%/bootloader/uki.scm \ %D%/ci.scm=09=09=09=09=09\ %D%/compression.scm=09=09=09=09\ %D%/home.scm=09=09=09=09=09\ --=20 2.45.2