From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id EPaZAOfzI2eQZgEAqHPOHw:P1 (envelope-from ) for ; Thu, 31 Oct 2024 21:17:27 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id EPaZAOfzI2eQZgEAqHPOHw (envelope-from ) for ; Thu, 31 Oct 2024 22:17:27 +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=Hti5NLwj; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=fCOGNcRe; 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-Seal: i=1; s=key1; d=yhetil.org; t=1730409446; a=rsa-sha256; cv=none; b=WZkxBNFBmxoykVmyFmK2LPSQFcaMqga1G1+2ECSGhsndynKHuTNGoRClRys6s+6l2mPlyo uLOcHjMMLsmtsEt+p+hEyu2eWs9YJvdUzMw97hqYWfojCp2mjHX9DkZk8hoDGIln8QYASR fAlCF7x4YSHVy6XY474gVhs0VyqFnyhoEL7qmoOkiRKMmmUMQf5d7FOFtNzPGkySFs5RpY sr+gEPCivnSqz9rFrbd4D86Q905ikCWGg1diBtO4/asDaeNPUQ3soIIeK0cPTSV7EAETSq NVvaa7b+WZGxndnhKF1d09g0/u2y/T7RGRcp+T5lwo+yaIcdoE3fikOtfNlirQ== 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=Hti5NLwj; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=fCOGNcRe; 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=1730409446; 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-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=F07iECtxj+QLyYfw7XbWDwKwgq+iJdg/iJpNuF1IXp4=; b=JzTbdTQ09LZAD//lVnkXtZNcbyUU29tV8eg9B19dYRykZk4Yu0hP7UjT4PxGtCW4QH4z4n 39oJ15+kt/8fOrVK7ysg54saymR4Xe7Lr2kEqbgz/dlNgj47q/oPVVUy0BdtwHx+xGdI3P d+J4G6UbfWqcA5E9XVpoXokuJ6XcQ6N4ZjD/k+GmDrbKDIh3G4RgGee70i/5ta8m8VXmxc UkXw81PxZA5TkHEso6FrS2gXOnjzmtlNk5wPc3eLj9wuUhuRK9XgaOhYW1OZ3L/x+Y9/OH CKuLuCuGhrs1eH39LsqIEBr3I8AIgppgAOuxUDiZFkNGNxhr/CZfi0Gn4bG5XA== 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 BA60118768 for ; Thu, 31 Oct 2024 22:17:26 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6cXU-0005Hd-9g; Thu, 31 Oct 2024 17:17:08 -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 1t6cXP-0005HA-LS for guix-patches@gnu.org; Thu, 31 Oct 2024 17:17:03 -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 1t6cXP-0006OZ-D1 for guix-patches@gnu.org; Thu, 31 Oct 2024 17:17:03 -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=zCCRAJucOJvNVxoBexJZtBKSVI+lZAKCgggQbZi3iDI=; b=Hti5NLwjKrjJURefH3Y8y/zYLVMpzAmO+oVRGYLRCeeDEG6CjM3Y3geaMGPsRkMXYgIGA5T3Vg6aw6od8J4YJNxHwzUMiHGUX8/2XPQ7+F8VSE4CgCvOMagw7y5hRRXsglqGolsEiBAn9upPR+lUFfPaPuHyOXUXNdHKaPefA5CVa1NTkjJ5Pj4awyLSLQ/dOSFoKtFLKaKu7OSiqScA1XurMCZAKc2WYW/IShEGV281A2RebadEyfxbxOnQKbofuq6tz/PxuE/qREDegft9uP15clvxsUGs3/IM42MHo8z8gBiz5MMqA+AvTnz28FdOpln/IX1x1wINr2CmRnod4Q==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t6cXO-0000xR-TA for guix-patches@gnu.org; Thu, 31 Oct 2024 17:17:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#74109] [PATCH v2 1/2] 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: Thu, 31 Oct 2024 21:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74109 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74109@debbugs.gnu.org Received: via spool by 74109-submit@debbugs.gnu.org id=B74109.17304094083645 (code B ref 74109); Thu, 31 Oct 2024 21:17:02 +0000 Received: (at 74109) by debbugs.gnu.org; 31 Oct 2024 21:16:48 +0000 Received: from localhost ([127.0.0.1]:44366 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6cX9-0000wi-Mg for submit@debbugs.gnu.org; Thu, 31 Oct 2024 17:16:48 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:43653 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6cX4-0000w4-1u for 74109@debbugs.gnu.org; Thu, 31 Oct 2024 17:16:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1730409393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F07iECtxj+QLyYfw7XbWDwKwgq+iJdg/iJpNuF1IXp4=; b=fCOGNcReMH2ooE4MqkSjTQA7hq2qwxxb83MvO0rIfaZE5/oUH9U4akvUZc/61wMhM4fq9A 9QgxibOG/Q5JtCcImr/McKI2qWWxn1vz/8CHERoS4bE+H4jEw4f7q2T0Hpt9//ZDDs63Xp w1FWq/rmPy9R44ZxI31M24hmg0jcqOHYUWM/6bCUIfqMwY/WAFVU5l3S5dkoj5AepcJBWc XgCorlGzzswPpLhIOI9uKyXvwcotk/y+Di7yf1yeQPwsk7hGyQouBr+XGQkfBIWdNEe5Jz ezqvY0mBo27asetSv6nYhuXqIBSDDl32C2qYkOh2hvxQCD2KoDTwQCJmHkBUpA== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id c3772a9a (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO) for <74109@debbugs.gnu.org>; Thu, 31 Oct 2024 21:16:33 +0000 (UTC) Date: Thu, 31 Oct 2024 22:15:49 +0100 Message-ID: <7eaba6235cafeccce847e9e0e3ed523bafb23930.1730408855.git.herman@rimm.ee> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: 0.54 X-Spam-Score: 0.54 X-Migadu-Queue-Id: BA60118768 X-Migadu-Scanner: mx12.migadu.com X-TUID: n4YcttHUvFwY * 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 | 83 ++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 55 deletions(-) diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index 2723eda5f4..f4a197567e 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -10,6 +10,7 @@ ;;; Copyright © 2022 Karl Hallsby ;;; Copyright © 2022 Denis 'GNUtoo' Carikli ;;; Copyright © 2024 Tomas Volf <~@wolfsden.cz> +;;; Copyright © 2024 Herman Rimm ;;; ;;; This file is part of GNU Guix. ;;; @@ -28,6 +29,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 +56,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 +624,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 +650,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 +814,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 +823,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 +874,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 -- 2.45.2