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 4KtAH7lKImcMbgEAqHPOHw:P1 (envelope-from ) for ; Wed, 30 Oct 2024 15:03:21 +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 4KtAH7lKImcMbgEAqHPOHw (envelope-from ) for ; Wed, 30 Oct 2024 16:03:21 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=BFLgGGWS; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=bKtFUOP9; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1730300601; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=hjV/Wav+KbPMyyHm3SqJdWbUPxbTJrR3Ml2xTATln2M=; b=rZLJ0N1fYhjYj8O013Nlci9WSUJiXJvdwqAG8AJ5MLy6zn45TyDOnPQnFVBksiYZDaCx9c uKchs7AT6sz5W+r7lRomL5VByi/9d86tUjn/f4T5rF4fdFjuZQwCt8GmWcI9Ylv/NsWnGc Do5FAHYJ/JvmwGuMW+qXKSF42SgUcH32ykSba0OtvjKEsEYioXNvKFY6GIxJXGGoGV08MA XaNQoJ5R5s53NYactK8aw8jbIQGcdXDymsMw3RTBB0x2A5/WofC8i+c6WdpiwtYEtIPZls 6qyIMHKp2cH71EUnvOUeQt/3OubNPk2t+nVeneoTypNHR6Zj23M/3XhPjG+JMQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=BFLgGGWS; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=bKtFUOP9; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1730300601; a=rsa-sha256; cv=none; b=MRktFmQtl6XuN6HUWi8MHZZO0ZkTbuE1dItPk4X1xI1LDEuqIyj7fext17KgnTxBSfkso3 TFWvBs3w3JbVQZG3jaDenEGIRfG5r+wkfOl/iBEhrZEtEuYzgV0FAp0pDKJn8+VGmhxaap tYerfdPU4xqy5vOLuauCa+vqCuHCdd28j1THkv3IjfVOeSGTsNYcqE+VM7wHDsk7RAYMCh U6XpTkIw5jbOEDXi2KLKYB9ccFLQVBOJffZ5KIP/DRm5hXv9C/AYfs8+lZrsWN5dUxZHIi L45W70aDoA1lw3DnuUy1sP4A1wgc0dsYpqQ/kRsdTuJKRW4n/nu5E+/UsMkqGA== 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 D6A2A79C7D for ; Wed, 30 Oct 2024 16:03:20 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6ADw-0000XF-WD; Wed, 30 Oct 2024 11:03:05 -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 1t6ADu-0000Wq-OU for guix-patches@gnu.org; Wed, 30 Oct 2024 11:03:02 -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 1t6ADu-0007ND-El for guix-patches@gnu.org; Wed, 30 Oct 2024 11:03:02 -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:Date:From:To:Subject; bh=csqvVs+3VmLAxsRkYi5Z9DAg31KF8J89PnJ6bDQWHWw=; b=BFLgGGWSWJHQFgXEtcxENYX0rzu+9Zi8sjWV//Z4z90bD210Iar21/Sm9IvrnY3/BIRcQnlbNnZzFY8OnoI8fJQ9ros0fB5yddtjQ+7GptY01UWj0j3xBZJ5nJhB0P5caXfSrvackOLOF0xwV/r91hI14gkQbLORAM4GWeb054zgdpP2ZGMHlWwmGCy6jHjaroC4smiIlizzsCP/AZ/ad9K25JHuuHeLX/rYnrguy27le45YEKbXOdSA/3r4V7Acbmf9kXi6Uvn5pwOid9vNtgSckBjNFLzqUNQqYQm6TsPZzUogYq4euOqRpLZdIwN94X+sqHq92bwiIzK8PdGJeg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t6ADu-00050r-9P for guix-patches@gnu.org; Wed, 30 Oct 2024 11:03:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#74109] [PATCH] gnu: bootloader: grub: Add procedure to share EFI installer code. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 30 Oct 2024 15:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74109 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74109@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.173030053019227 (code B ref -1); Wed, 30 Oct 2024 15:03:02 +0000 Received: (at submit) by debbugs.gnu.org; 30 Oct 2024 15:02:10 +0000 Received: from localhost ([127.0.0.1]:35528 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6AD3-000503-Ur for submit@debbugs.gnu.org; Wed, 30 Oct 2024 11:02:10 -0400 Received: from lists.gnu.org ([209.51.188.17]:40462) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6AD2-0004zu-QP for submit@debbugs.gnu.org; Wed, 30 Oct 2024 11:02:09 -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 1t6AD1-0000UF-9f for guix-patches@gnu.org; Wed, 30 Oct 2024 11:02:08 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117] helo=email.rimm.ee) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1t6ACz-0007Iv-6v for guix-patches@gnu.org; Wed, 30 Oct 2024 11:02:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1730300512; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=hjV/Wav+KbPMyyHm3SqJdWbUPxbTJrR3Ml2xTATln2M=; b=bKtFUOP9WKamK8qUe/Ot+cJOElv6VZwZ6TbxZAMvC4B0lg78Xs0ielSRbLJEOEkMkCELtk sdzxUMdHbsKqfFpdcnxSbX7h/G1R6Id2F//Q3i7pwdIVITb3hvcRTYGTsO6iMJBKVueko6 elHtlY+Hy5Al8tXMxG1qj4wukItVXTgrl0L741MNwmgMwxrJQpdzU9d9JDdg6sKNV/jWzw r94X4ydrOhYa3vk0TNSPpAaNUZtn8Ohvxl1aPKj61QzPZxGoRkiHgeKuwOpW34ET7d3g1y eGvQfmjMpeyBBm7rPKEIr6V0iBU9LBgRLeK8l7zAONo8XC982s3an40jIM6blA== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 74133844 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO) for ; Wed, 30 Oct 2024 15:01:51 +0000 (UTC) Date: Wed, 30 Oct 2024 16:01:11 +0100 Message-ID: <0d64318889bc98bd9b59d72676641a3914ffed3e.1730300346.git.herman@rimm.ee> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=81.205.150.117; envelope-from=herman@rimm.ee; helo=email.rimm.ee X-Spam_score_int: 16 X-Spam_score: 1.6 X-Spam_bar: + X-Spam_report: (1.6 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_PBL=3.335, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, TVD_RCVD_IP=0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches From: Herman Rimm via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx11.migadu.com X-Migadu-Spam-Score: 0.54 X-Spam-Score: 0.54 X-Migadu-Queue-Id: D6A2A79C7D X-TUID: Tl9BFlq8N61T * gnu/bootloader/grub.scm (make-grub-efi-bootloader): Add procedure. (install-grub-efi, install-grub-efi32): Remove variables. (install-grub-efi-removable): Deprecate variable. Change-Id: Ie10b506bb1088179d459ddafe3229fd730ac45aa --- gnu/bootloader/grub.scm | 82 ++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 55 deletions(-) diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index 2723eda5f4..4933bdcff0 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -28,6 +28,7 @@ (define-module (gnu bootloader grub) #:use-module (guix build union) + #:use-module (guix deprecation) #:use-module (guix records) #:use-module (guix store) #:use-module (guix utils) @@ -54,6 +55,7 @@ (define-module (gnu bootloader grub) grub-theme-gfxmode install-grub-efi-removable + make-grub-efi-installer make-grub-efi-netboot-installer grub-bootloader @@ -621,7 +623,16 @@ (define install-grub-disk-image "-d" "." image)))) -(define install-grub-efi +(define* (make-grub-efi-installer #:key efi32? removable?) + "Return a G-expression of a procedure for installing GRUB on a UEFI +system. If EFI32? is #t, then a 32-bit target will be used. If +REMOVABLE? is #t, GRUB will be installed for Removable Media Boot." + (define extra-args + (list (and efi32? + #~(cond ((target-x86?) "--target=i386-efi") + ((target-arm?) "--target=arm-efi"))) + ;; This does not update UEFI boot entries, like --no-nvram. + (and removable? "--removable"))) #~(lambda (bootloader efi-dir mount-point) ;; There is nothing useful to do when called in the context of a disk ;; image generation. @@ -638,57 +649,10 @@ (define install-grub-efi ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or ;; root partition. (setenv "GRUB_ENABLE_CRYPTODISK" "y") - (invoke/quiet grub-install "--boot-directory" install-dir - "--bootloader-id=Guix" - "--efi-directory" target-esp))))) - -(define install-grub-efi-removable - #~(lambda (bootloader efi-dir mount-point) - ;; NOTE: mount-point is /mnt in guix system init /etc/config.scm /mnt/point - ;; NOTE: efi-dir comes from target list of booloader configuration - ;; There is nothing useful to do when called in the context of a disk - ;; image generation. - (when efi-dir - ;; Install GRUB onto the EFI partition mounted at EFI-DIR, for the - ;; system whose root is mounted at MOUNT-POINT. - (let ((grub-install (string-append bootloader "/sbin/grub-install")) - (install-dir (string-append mount-point "/boot")) - ;; When installing Guix, it's common to mount EFI-DIR below - ;; MOUNT-POINT rather than /boot/efi on the live image. - (target-esp (if (file-exists? (string-append mount-point efi-dir)) - (string-append mount-point efi-dir) - efi-dir))) - ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or - ;; root partition. - (setenv "GRUB_ENABLE_CRYPTODISK" "y") - (invoke/quiet grub-install "--boot-directory" install-dir - "--removable" - ;; "--no-nvram" - "--bootloader-id=Guix" - "--efi-directory" target-esp))))) - -(define install-grub-efi32 - #~(lambda (bootloader efi-dir mount-point) - ;; There is nothing useful to do when called in the context of a disk - ;; image generation. - (when efi-dir - ;; Install GRUB onto the EFI partition mounted at EFI-DIR, for the - ;; system whose root is mounted at MOUNT-POINT. - (let ((grub-install (string-append bootloader "/sbin/grub-install")) - (install-dir (string-append mount-point "/boot")) - ;; When installing Guix, it's common to mount EFI-DIR below - ;; MOUNT-POINT rather than /boot/efi on the live image. - (target-esp (if (file-exists? (string-append mount-point efi-dir)) - (string-append mount-point efi-dir) - efi-dir))) - ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or - ;; root partition. - (setenv "GRUB_ENABLE_CRYPTODISK" "y") - (invoke/quiet grub-install "--boot-directory" install-dir - "--bootloader-id=Guix" - (cond ((target-x86?) "--target=i386-efi") - ((target-arm?) "--target=arm-efi")) - "--efi-directory" target-esp))))) + (invoke/quiet grub-install "--bootloader-id=Guix" + "--boot-directory" install-dir + "--efi-directory" target-esp + #$@(filter identity extra-args)))))) (define* (make-grub-efi-netboot-installer grub-efi grub-cfg subdir) "Make a bootloader-installer for a grub-efi-netboot bootloader, which expects @@ -849,7 +813,7 @@ (define grub-efi-bootloader (bootloader (name 'grub-efi) (package grub-efi) - (installer install-grub-efi) + (installer (make-grub-efi-installer)) (disk-image-installer #f) (configuration-file grub-cfg) (configuration-file-generator grub-configuration-file))) @@ -858,12 +822,12 @@ (define grub-efi-removable-bootloader (bootloader (inherit grub-efi-bootloader) (name 'grub-efi-removable-bootloader) - (installer install-grub-efi-removable))) + (installer (make-grub-efi-installer #:removable? #t)))) (define grub-efi32-bootloader (bootloader (inherit grub-efi-bootloader) - (installer install-grub-efi32) + (installer (make-grub-efi-installer #:efi32? #t)) (name 'grub-efi32) (package grub-efi32))) @@ -909,4 +873,12 @@ (define-syntax grub-configuration (bootloader grub-bootloader) fields ...)))) + +;;; +;;; Deprecated bootloader and installer variables. +;;; + +(define-deprecated/alias install-grub-efi-removable + (make-grub-efi-installer #:removable? #t)) + ;;; grub.scm ends here base-commit: d6f775c30c6f47e174f6110d1089edc6315600e4 -- 2.45.2