From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id uDU4NAe6rF9aPQAA0tVLHw (envelope-from ) for ; Thu, 12 Nov 2020 04:28:55 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 8MXxLwe6rF+JEgAAbx9fmQ (envelope-from ) for ; Thu, 12 Nov 2020 04:28:55 +0000 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 761F89403A7 for ; Thu, 12 Nov 2020 04:28:55 +0000 (UTC) Received: from localhost ([::1]:44158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kd3kX-0000LN-Qf for larch@yhetil.org; Wed, 11 Nov 2020 22:58:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45342) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kd3kJ-00008D-0J for bug-guix@gnu.org; Wed, 11 Nov 2020 22:58:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:60053) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kd3kI-0004WG-Mu for bug-guix@gnu.org; Wed, 11 Nov 2020 22:58:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kd3kI-0005PB-Lq for bug-guix@gnu.org; Wed, 11 Nov 2020 22:58:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#44353: [PATCH version-1.2.0 v2 2/3] bootloader: grub: Skip install-grub-efi when producing a disk image. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 12 Nov 2020 03:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44353 X-GNU-PR-Package: guix X-GNU-PR-Keywords: patch To: 44353@debbugs.gnu.org Received: via spool by 44353-submit@debbugs.gnu.org id=B44353.160515346220734 (code B ref 44353); Thu, 12 Nov 2020 03:58:02 +0000 Received: (at 44353) by debbugs.gnu.org; 12 Nov 2020 03:57:42 +0000 Received: from localhost ([127.0.0.1]:43364 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kd3jx-0005OM-Q4 for submit@debbugs.gnu.org; Wed, 11 Nov 2020 22:57:42 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:39775) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kd3jq-0005Nd-OX for 44353@debbugs.gnu.org; Wed, 11 Nov 2020 22:57:38 -0500 Received: by mail-qk1-f195.google.com with SMTP id q22so4160279qkq.6 for <44353@debbugs.gnu.org>; Wed, 11 Nov 2020 19:57:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wR265Tv7yjbBa+mGNjF1+reij/HZYvoloEleE5/bPi0=; b=Y8rSylqqyOBPujnYB0oDofh8FEtKqCi3aWNDocEzrKutMsGipt4bRybP4IN4qNpQbV pr5k6FgKrE8YpMspkgx6tEY7V0ShsBcJW4796r2Tg+qhDe4gkjxc71Mtpru02kZZA6vL 15zlj5SggvPoKwXOTBEtU7sSt7c33eaTes9N4x+9gOpn82d5P6I1Tkv7AxOa7umvvmI6 ptjCNkMjorjPnDzX1TPo/mMXCOem+7gvndIoqLC+p4TX4JU1ow63UYO5EYLMyuWjequK lJAQy/P99KvcMSGiwQc2/F/ryjjVWf4ahLixiMcpuhHBTvbOl94DqJ2pND635EXC8LrY BSEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wR265Tv7yjbBa+mGNjF1+reij/HZYvoloEleE5/bPi0=; b=WFebl7eISglgCX08NS+UXkh3kjYCeCrvQCMWx4G+eRBuNDeaOdAOufFqGzK+q902d/ D3D+Scj8XiLIng4F6aFLGkjxnSPpJ3LRt/tVfi1e73gt9vPJDU/NuosFt+uacRFFNG4R 3Y2uTiETnxTB8h9Zu9Y7fWsc1JSEJ0bOoHubzpTkzl6jxAhmsXfZV0hgXc8qXQC4AKfR gQgP8PfkLOxZbQNlrzzqgNC9DPJ7x1pBil+ZLaOQoflltU5CBNqf5p7HJUB2S69H3NFC 330Q5FY4IEBM7u+RpuFHOVqP+4w58Dd+IEOKGFS6RgJV13kOVqcrDQ2Gaf9MmIVtMSc+ Z/Kg== X-Gm-Message-State: AOAM532GSrYUaeIByfzSp6KX+k5iam/y7sdXIVeK/of6pOVGSQorskNZ YOvKnaN5LnyK1WXGytA3TkBq/hFNkig= X-Google-Smtp-Source: ABdhPJwzsJFn+iYkJT+czS0e86hi8Xc9BYKHVQeKHEx0tzkUWzkZmeJMA9zRwbm0Qa7Lti/rOmGhMQ== X-Received: by 2002:a37:614b:: with SMTP id v72mr20575376qkb.355.1605153449109; Wed, 11 Nov 2020 19:57:29 -0800 (PST) Received: from localhost.localdomain (dsl-10-133-153.b2b2c.ca. [72.10.133.153]) by smtp.gmail.com with ESMTPSA id m15sm4630009qtc.90.2020.11.11.19.57.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 19:57:28 -0800 (PST) From: Maxim Cournoyer Date: Wed, 11 Nov 2020 22:57:12 -0500 Message-Id: <20201112035713.3789-2-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201112035713.3789-1-maxim.cournoyer@gmail.com> References: <87h7q0cdns.fsf@gnu.org> <20201112035713.3789-1-maxim.cournoyer@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mathieu Othacehe , Jesse Gibbons , Maxim Cournoyer Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=fail (headers rsa verify failed) header.d=gmail.com header.s=20161025 header.b=Y8rSylqq; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: 5.59 X-TUID: 2pSxLNgrC9lc Fixes . Every bootloader should try their best to install themselves using only the MOUNT-POINT and otherwise do nothing. This requirement comes from the necessity to call INSTALL-GRUB when installing the (non-EFI) GRUB bootloader, which needs to populate the root file system with extra modules that cannot be fit in the core.img file, limited in size to 491520 bytes (by the i386-pc format required for legacy BIOS compatibility). As introducing bootloader knowledge at the level of the image code is undesirable, every bootloader should be adapted to support this fall-back for their installation procedure (TODO). * gnu/bootloader/grub.scm (install-grub-efi)[efi-dir]: Skip when the EFI-DIR argument is set to #f. --- gnu/bootloader/grub.scm | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index 0899fab61f..af7b7561ff 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -573,21 +573,24 @@ fi~%")))) (define install-grub-efi #~(lambda (bootloader efi-dir mount-point) - ;; 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" - "--efi-directory" target-esp)))) + ;; 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" + "--efi-directory" target-esp))))) (define (install-grub-efi-netboot subdir) "Define a grub-efi-netboot bootloader installer for installation in SUBDIR, -- 2.28.0