From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 01 May 2020 20:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 41011@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.158836517823775 (code B ref -1); Fri, 01 May 2020 20:33:02 +0000 Received: (at submit) by debbugs.gnu.org; 1 May 2020 20:32:58 +0000 Received: from localhost ([127.0.0.1]:50758 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jUcLC-0006BO-Aa for submit@debbugs.gnu.org; Fri, 01 May 2020 16:32:58 -0400 Received: from lists.gnu.org ([209.51.188.17]:55530) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jUcLA-0006BG-WD for submit@debbugs.gnu.org; Fri, 01 May 2020 16:32:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jUcLA-0006mW-1U for guix-patches@gnu.org; Fri, 01 May 2020 16:32:56 -0400 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUcL8-0002oR-5E for guix-patches@gnu.org; Fri, 01 May 2020 16:32:55 -0400 Received: from vsmx012.vodafonemail.xion.oxcs.net ([153.92.174.90]:14985) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jUcL7-0002bE-EL for guix-patches@gnu.org; Fri, 01 May 2020 16:32:53 -0400 Received: from vsmx004.vodafonemail.xion.oxcs.net (unknown [192.168.75.198]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTP id 288B9F35070 for ; Fri, 1 May 2020 20:32:47 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [90.186.146.133]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTPA id F072D19AE34 for ; Fri, 1 May 2020 20:32:44 +0000 (UTC) From: Stefan Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> Date: Fri, 1 May 2020 22:32:44 +0200 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-VADE-SCORE: 0 X-VADE-REASON: gggruggvucftvghtrhhoucdtuddrgeduhedrieejgddugeekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuvegfuffvqffogfftpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhtgfguffkfffvggfosehtqhhmtdhhtddvnecuhfhrohhmpefuthgvfhgrnhcuoehsthgvfhgrnhdqghhuihigsehvohgurghfohhnvghmrghilhdruggvqeenucggtffrrghtthgvrhhnpeeutdeliefgfedvheejhfekvedtgfegiefhgeehheffgfffhfdvjeejhfelgfevffenucfkphepledtrddukeeirddugeeirddufeefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehmrggtsghoohhkqdhprhhordhkuhhhqdifihgvshgvrdhmhidqrhhouhhtvghrrdguvgdpihhnvghtpeeltddrudekiedrudegiedrudeffedpmhgrihhlfhhrohhmpehsthgvfhgrnhdqghhuihigsehvohgurghfohhnvghmrghilhdruggvpdhrtghpthhtohepghhuihigqdhprghttghhvghssehgnhhurdhorhhg Received-SPF: pass client-ip=153.92.174.90; envelope-from=stefan-guix@vodafonemail.de; helo=vsmx012.vodafonemail.xion.oxcs.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/01 16:32:47 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 153.92.174.90 X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) * gnu/bootloader/grub.scm (grub-efi-net-bootloader): New efi bootloader = for network booting via tftp/nfs and possibly images, prepared for chain = loading. (install-grub-efi-net): New bootloader installer for tftp and possibly = images, does not need root rights. (grub-root-search): Adding support for tftp root. (eye-candy): Enable gfxterm support for all systems. * gnu/system.scm (read-boot-parameters): Prevent devices with ":/" from = being treated as a file system label. --- gnu/bootloader/grub.scm | 107 +++++++++++++++++++++++++++++++--------- gnu/system.scm | 3 +- 2 files changed, 86 insertions(+), 24 deletions(-) diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index 190b717163..9ca4f016f6 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -23,7 +23,7 @@ =20 (define-module (gnu bootloader grub) #:use-module (guix records) - #:use-module ((guix utils) #:select (%current-system)) + #:use-module ((guix utils) #:select (%current-system = %current-target-system)) #:use-module (guix gexp) #:use-module (gnu artwork) #:use-module (gnu bootloader) @@ -53,6 +53,7 @@ =20 grub-bootloader grub-efi-bootloader + grub-efi-net-bootloader grub-mkrescue-bootloader =20 grub-configuration)) @@ -142,34 +143,20 @@ WIDTH/HEIGHT, or #f if none was found." #:width width #:height height)))) =20 (define* (eye-candy config store-device store-mount-point - #:key system port) + #:key port) "Return a gexp that writes to PORT (a port-valued gexp) the 'grub.cfg' part concerned with graphics mode, background images, = colors, and all that. STORE-DEVICE designates the device holding the store, and STORE-MOUNT-POINT is its mount point; these are used to determine where = the -background image and fonts must be searched for. SYSTEM must be the = target -system string---e.g., \"x86_64-linux\"." +background image and fonts must be searched for." (define setup-gfxterm-body - (let ((gfxmode - (or (and-let* ((theme (bootloader-configuration-theme = config)) - (gfxmode (grub-gfxmode theme))) - (string-join gfxmode ";")) - "auto"))) - - ;; Intel and EFI systems need to be switched into graphics mode, = whereas - ;; most other modern architectures have no other mode and = therefore - ;; don't need to be switched. - - ;; XXX: Do we really need to restrict to x86 systems? We could = imitate - ;; what the GRUB default configuration does and decide based on = whether - ;; a user provided 'gfxterm' in the terminal-outputs field of = their - ;; bootloader-configuration record. - (if (string-match "^(x86_64|i[3-6]86)-" system) - (format #f " + (format #f " set gfxmode=3D~a insmod all_video - insmod gfxterm~%" gfxmode) - ""))) + insmod gfxterm~%" + (string-join + (grub-gfxmode (bootloader-theme config)) + ";"))) =20 (define (setup-gfxterm config font-file) (if (memq 'gfxterm (bootloader-configuration-terminal-outputs = config)) @@ -316,6 +303,9 @@ code." ((? file-system-label? label) (format #f "search --label --set ~a" (file-system-label->string label))) + ((? (lambda (device) + (and (string? device) (string-contains device ":/"))) = nfs-uri) + "set root=3D(tftp)") ((or #f (? string?)) #~(format #f "search --file --set ~a" #$file))))) =20 @@ -355,7 +345,6 @@ entries corresponding to old generations of the = system." (eye-candy config (menu-entry-device (first all-entries)) (menu-entry-device-mount-point (first all-entries)) - #:system system #:port #~port)) =20 (define keyboard-layout-config @@ -443,6 +432,68 @@ fi~%")))) "--bootloader-id=3DGuix" "--efi-directory" target-esp)))) =20 +(define (install-grub-efi-net efi-subdir) + "Define a grub-efi bootloader installer for installation in = EFI-SUBDIR, +which is usually \"efi/guix\" or \"efi/boot\"." + (let* ((arch (car (string-split (or (%current-target-system) + (%current-system)) + #\-))) + (efi-bootloader-link (string-append "boot" + (match arch + ("i686" "ia32") + ("x86_64" "x64") + ("armhf" "arm") + ("aarch64" "aa64") + ("riscv" "riscv32") + ("riscv64" "riscv64")) + ".efi")) + (efi-bootloader (string-append (match arch + ("i686" "i386") + ("x86_64" "x86_64") + ("armhf" "arm") + ("aarch64" "arm64") + ("riscv" "riscv32") + ("riscv64" "riscv64")) + "-efi/core.efi"))) + #~(lambda (bootloader target mount-point) + "Install GRUB as e.g. \"bootx64.efi\" or \"bootarm64.efi\" = \"into +EFI-SUBDIR, which is usually \"efi/guix\" or \"efi/boot\" below the = directory +TARGET for the system whose root is mounted at MOUNT-POINT." + (let* ((mount-point-list (delete "" (string-split mount-point = #\/))) + (target-list (delete "" (string-split target #\/))) + (net-dir + (string-append "/" (string-join (append + mount-point-list + target-list) + "/"))) + (subdir #$efi-subdir) + (efi-bootloader-link + (string-append net-dir "/" subdir "/" = #$efi-bootloader-link)) + (store-name (car (delete "" (string-split bootloader = #\/)))) + (store + ;; Use target-list to construct a "../gnu" link with a = correct + ;; number of "../" to the store. + (string-join (append (make-list (length target-list) = "..") + (list store-name)) + "/")) + (store-link (string-append net-dir "/" store-name))) + ;; Tell 'grub-install' that there might be a LUKS-encrypted = /boot or + ;; root partition. + (setenv "GRUB_ENABLE_CRYPTODISK" "y") + (invoke/quiet (string-append bootloader "/bin/grub-mknetdir") + (string-append "--net-directory=3D" net-dir) + (string-append "--subdir=3D" subdir)) + (catch 'system-error + (lambda () (delete-file efi-bootloader-link)) + (lambda _ #f)) + (symlink #$efi-bootloader + efi-bootloader-link) + (catch 'system-error + (lambda () (delete-file store-link)) + (lambda _ #f)) + (symlink store + store-link))))) + ^L =20 ;;; @@ -464,6 +515,16 @@ fi~%")))) (name 'grub-efi) (package grub-efi))) =20 +(define* (grub-efi-net-bootloader #:key (target #f) (efi-subdir #f)) + (let ((target (or target "boot")) + (efi-subdir (or efi-subdir "efi/boot"))) + (bootloader + (inherit grub-bootloader) + (name 'grub-efi-net-bootloader) + (package grub-efi) + (installer (install-grub-efi-net efi-subdir)) + (configuration-file (string-append target "/" efi-subdir = "/grub.cfg"))))) + (define* grub-mkrescue-bootloader (bootloader (inherit grub-efi-bootloader) diff --git a/gnu/system.scm b/gnu/system.scm index 29e622872d..540f0e4a9e 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -297,7 +297,8 @@ file system labels." ((? string? device) ;; It used to be that we would not distinguish between labels = and ;; device names. Try to infer the right thing here. - (if (string-prefix? "/dev/" device) + (if (or (string-prefix? "/dev/" device) + (string-contains device ":/")) ; nfs device (file-system-label device))))) =20 --=20 2.26.0 From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 10 May 2020 08:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Stefan Cc: 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.15890988379685 (code B ref 41011); Sun, 10 May 2020 08:21:01 +0000 Received: (at 41011) by debbugs.gnu.org; 10 May 2020 08:20:37 +0000 Received: from localhost ([127.0.0.1]:48891 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jXhCP-0002W8-7t for submit@debbugs.gnu.org; Sun, 10 May 2020 04:20:37 -0400 Received: from mail-wr1-f54.google.com ([209.85.221.54]:43549) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jXhCO-0002Vw-3q for 41011@debbugs.gnu.org; Sun, 10 May 2020 04:20:36 -0400 Received: by mail-wr1-f54.google.com with SMTP id i15so6890568wrx.10 for <41011@debbugs.gnu.org>; Sun, 10 May 2020 01:20:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=VOIpucdgp2xG9wp8lO1HTfWkD4u7JevwrqpA8Q0i0k4=; b=PbKDwDYrFOX6ylCqQJMfKU5xwUdFENBXiXL9DgXBspPWxpokd5LWLwictsJeKIJjoe ImTwTX445UB3PxjGg3SUxhX9Iu/p6NzEmnW+rIzdxKBHJnY8onMAQjEW8ndBRnwoNe2Q JHwMyPW4gmNceGZtm8LyUFfDGcL1ZBwxxLydtSyhJdhafWEGRv0fdTqDGLdH6nLox6oO 35TrFFr6lfk5Ofc5RVUXtCNsHb9BnhaCqdD55gVuarH4vgvfGnLQDIzGdt5COegNtFRu 7qB2H8hpZ5KxX+57PoOkw79tUQlBK0KP386WPq2njnxLms0N+8xIrUBGUDwGgtdlpMLt nDFg== 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:references:date:in-reply-to :message-id:user-agent:mime-version; bh=VOIpucdgp2xG9wp8lO1HTfWkD4u7JevwrqpA8Q0i0k4=; b=h/fMBghxe94TzgPtkcXDYo6EfhWByJXrzDg7EFMn56TiPqDpXoSVD2NSDx8KOMe0/X 3eb1ur3Mz5Mh/5T8yQPqyF8TUQmFn1xtzieEO2Gu/h83XjPeQZ6VWVKR+aT1Ll+iLhAW AN8LnHh6EJ/gg1T8EiO1MIMXKxbnAWwC/HMTN0G7S2TeCaNvtpJORmndIS39PFcAc2+E YPk5TyCpadSxaEswh7kdBOfvByPG4vrd+ZL2YTjyQ8p2DS6TOnjucNAyMjc6yRDpAfnD Hy9Ub/nm16vSHli4/1F26sL+Nzc0qelLbAPaqr1sc4ety8XM+NBL7UqiRFfhv0QvuOeD Z3kw== X-Gm-Message-State: AGi0PuYkHWb0DbbRqBTJ8ds2+e8LSQww6iI5VyW4pr2+dCHC3SMZN7nc TWwbvNGeO6nBgeqGaz1MiW/aussD X-Google-Smtp-Source: APiQypKKHMI9R/7TYv2cbsM7g3kPexQWCnsEO8M7K+WvqFjjOd/0R8SuApNmHW0wmH/m+I1a3D3q8A== X-Received: by 2002:a5d:4dc9:: with SMTP id f9mr2968505wru.407.1589098830245; Sun, 10 May 2020 01:20:30 -0700 (PDT) Received: from meru ([2a01:cb18:832e:5f00:708f:4d20:5fc9:ae90]) by smtp.gmail.com with ESMTPSA id n7sm2590810wro.94.2020.05.10.01.20.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 May 2020 01:20:29 -0700 (PDT) From: Mathieu Othacehe References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> Date: Sun, 10 May 2020 10:20:28 +0200 In-Reply-To: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> (Stefan's message of "Fri, 1 May 2020 22:32:44 +0200") Message-ID: <87a72gi4kz.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello Stefan, This patch does not apply here. Could you rebase it on top of master? > - > - ;; Intel and EFI systems need to be switched into graphics mode, whereas > - ;; most other modern architectures have no other mode and therefore > - ;; don't need to be switched. > - > - ;; XXX: Do we really need to restrict to x86 systems? We could imitate > - ;; what the GRUB default configuration does and decide based on whether > - ;; a user provided 'gfxterm' in the terminal-outputs field of their > - ;; bootloader-configuration record. > - (if (string-match "^(x86_64|i[3-6]86)-" system) > - (format #f " > + (format #f " > set gfxmode=~a > insmod all_video > - insmod gfxterm~%" gfxmode) > - ""))) > + insmod gfxterm~%" > + (string-join > + (grub-gfxmode (bootloader-theme config)) > + ";"))) Why not enable graphic mode only if 'gfxterm' is provided in terminal-outputs fields, like suggested by the comment? > + (efi-bootloader-link (string-append "boot" > + (match arch > + ("i686" "ia32") > + ("x86_64" "x64") > + ("armhf" "arm") If cross-building for "arm-linux-gnueabihf", arch will be "arm" and won't match anything here. > + (catch 'system-error > + (lambda () (delete-file efi-bootloader-link)) > + (lambda _ #f)) You can use "false-if-exception" here I think. > + (symlink #$efi-bootloader > + efi-bootloader-link) > + (catch 'system-error > + (lambda () (delete-file store-link)) > + (lambda _ #f)) Same here. > +(define* (grub-efi-net-bootloader #:key (target #f) (efi-subdir #f)) #f if implicit if omitted. > + (let ((target (or target "boot")) > + (efi-subdir (or efi-subdir "efi/boot"))) It would be better to keep grub-efi-net-bootloader as a variable, like all other bootloaders. You could default configuration-file to "boot/efi/boot/grub.cfg" instead? Thanks, Mathieu From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 10 May 2020 21:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mathieu Othacehe Cc: 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.15891452144928 (code B ref 41011); Sun, 10 May 2020 21:14:02 +0000 Received: (at 41011) by debbugs.gnu.org; 10 May 2020 21:13:34 +0000 Received: from localhost ([127.0.0.1]:50598 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jXtGQ-0001HQ-EA for submit@debbugs.gnu.org; Sun, 10 May 2020 17:13:34 -0400 Received: from mx009.vodafonemail.xion.oxcs.net ([153.92.174.39]:25133) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jXtGO-0001HB-2X for 41011@debbugs.gnu.org; Sun, 10 May 2020 17:13:33 -0400 Received: from vsmx002.vodafonemail.xion.oxcs.net (unknown [192.168.75.192]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTP id AB3F360494B; Sun, 10 May 2020 21:13:25 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [90.186.146.103]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 40B59604868; Sun, 10 May 2020 21:13:21 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <87a72gi4kz.fsf@gmail.com> Date: Sun, 10 May 2020 23:13:20 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Mathieu! Thanks for your reply again! :-) > Am 10.05.2020 um 10:20 schrieb Mathieu Othacehe = : >=20 > This patch does not apply here. Could you rebase it on top of master? I=E2=80=99ll try. >> - ;; Intel and EFI systems need to be switched into graphics = mode, whereas >> - ;; most other modern architectures have no other mode and = therefore >> - ;; don't need to be switched. >> - >> - ;; XXX: Do we really need to restrict to x86 systems? We = could imitate >> - ;; what the GRUB default configuration does and decide based = on whether >> - ;; a user provided 'gfxterm' in the terminal-outputs field of = their >> - ;; bootloader-configuration record. >> - (if (string-match "^(x86_64|i[3-6]86)-" system) >> - (format #f " >> + (format #f " >> set gfxmode=3D~a >> insmod all_video >> - insmod gfxterm~%" gfxmode) >> - ""))) >> + insmod gfxterm~%" >> + (string-join >> + (grub-gfxmode (bootloader-theme config)) >> + ";"))) >=20 > Why not enable graphic mode only if 'gfxterm' is provided in > terminal-outputs fields, like suggested by the comment? Good point. Looking into this topic it seem's questionable to me that the default of = (bootloader-configuration (terminal-output =E2=80=A6)) with '(gfxterm) = is grub-specific. This doesn't make sense for other boot-loaders, e.g. = U-Boot. I expect this to be changed in future. ;-) >> + (efi-bootloader-link (string-append "boot" >> + (match arch >> + ("i686" "ia32") >> + ("x86_64" "x64") >> + ("armhf" "arm") >=20 > If cross-building for "arm-linux-gnueabihf", arch will be "arm" and > won't match anything here. Good catch! >> + (catch 'system-error >> + (lambda () (delete-file efi-bootloader-link)) >> + (lambda _ #f)) >=20 > You can use "false-if-exception" here I think. Nice trick. >> + (symlink #$efi-bootloader >> + efi-bootloader-link) >> + (catch 'system-error >> + (lambda () (delete-file store-link)) >> + (lambda _ #f)) >=20 > Same here. Sure. >> +(define* (grub-efi-net-bootloader #:key (target #f) (efi-subdir #f)) >=20 > #f if implicit if omitted. I wasn=E2=80=99t aware of this. >> + (let ((target (or target "boot")) >> + (efi-subdir (or efi-subdir "efi/boot"))) >=20 > It would be better to keep grub-efi-net-bootloader as a variable, like > all other bootloaders. You could default configuration-file to > "boot/efi/boot/grub.cfg" instead? Actually there is a problem with all this in guix: There is (bootloader = (target =E2=80=A6)), which gives the impression that one is able to = freely chose a folder for the bootloader files. However, the path = =E2=80=9C/boot/grub.cfg=E2=80=9D is kind of hard coded. Yes, it=E2=80=99s kind of possible to inherit from grub-efi-bootloader = and overwrite the (configuration-file) field. In a first step this seems = to work. But when e.g. deleting a system generation, in = guix/scripts/system.scm (reinstall-bootloader) there is this code: ;; Use the detected bootloader with default configuration. ;; It will be enough to allow the system to boot. (bootloader-config (bootloader-configuration (bootloader bootloader)))=20 It reads this information form /var/guix/profiles/system/parameters: = (bootloader-name grub-efi-bootloader). With this again the hard-coded path =E2=80=9C/boot/grub.cfg=E2=80=9D of = is used, ignoring any value overwritten in (configuration-file). Another issue is (install-dir (string-append mount-point "/boot")) in = (install-grub-efi), which ignores any (configuration-file) setting, too = =E2=80=93 well, it has no access to that setting =E2=80=93, and implies = at least =E2=80=9C/boot=E2=80=9D to be the prefix of (bootloader (target = =E2=80=A6)).=20 Beside the wish to avoid this hard-coded =E2=80=9C/boot=E2=80=9C = assumption, I made this a function with two parameters for two more = reasons.=20 One is simply to suite my needs. The folder for my tftp server is not = =E2=80=9Cboot=E2=80=9D but =E2=80=9Cboot-nfs=E2=80=9D. For my SBC I=E2=80=99= m using different operating systems from time to time, e.g. LibreELEC. = As I have bad experiences with unreliable micro SD cards and as an nfs = root file system is nice for tinkering, I copy such operating systems = onto my tftp/nfs server. This includes of corse their =E2=80=9Cboot=E2=80=9D= folder. The build-in update functionalities overwrite stuff inside = there. But I need to modify stuff for network booting. To not loose = these modifications during updates and for later comparisons I keep such = modifications in a copy as =E2=80=9Cboot-nfs=E2=80=9D. The other reason is that I=E2=80=99m not sure, if the efi-dir for = network booting should be =E2=80=9Cefi/Guix=E2=80=9D instead of = =E2=80=9Cefi/boot=E2=80=9D in other constellations. U-Boot expects = =E2=80=9Cefi/boot=E2=80=9C over tftp like for a removable media by = default. I guess this can be changed with DNS options. Also for real = UEFI firmware this might be configurable. I don=E2=80=99t know, so I = don=E2=80=99t want these paths to be hard-coded. However, digging up all this and now re-trying to delete a system = generation, I get this error with my new boot-efi-net-bootloader as a = function: stefan@guix ~/development/guix$ sudo guix system delete-generations 151 /var/guix/profiles/system-151-link wird gel=C3=B6scht guix system: error: grub-efi-net-bootloader: no such bootloader So thanks for your hint, it can=E2=80=99t be a function! (Not now =E2=80=A6= ) Bye Stefan From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 18 May 2020 21:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mathieu Othacehe Cc: 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.15898382396959 (code B ref 41011); Mon, 18 May 2020 21:44:02 +0000 Received: (at 41011) by debbugs.gnu.org; 18 May 2020 21:43:59 +0000 Received: from localhost ([127.0.0.1]:48477 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1janY0-0001nt-DN for submit@debbugs.gnu.org; Mon, 18 May 2020 17:43:59 -0400 Received: from vsmx012.vodafonemail.xion.oxcs.net ([153.92.174.90]:23615) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1janXy-0001ne-9n for 41011@debbugs.gnu.org; Mon, 18 May 2020 17:43:43 -0400 Received: from vsmx004.vodafonemail.xion.oxcs.net (unknown [192.168.75.198]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTP id DF72DF34D61; Mon, 18 May 2020 21:43:35 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [2.206.141.223]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 8943C19AEC9; Mon, 18 May 2020 21:43:31 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> Date: Mon, 18 May 2020 23:43:30 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <0CE089DD-54B6-43AD-8CE7-8EC7004768EB@vodafonemail.de> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/bootloader/grub.scm (grub-efi-net-bootloader): New efi bootloader = for network booting via tftp/nfs, prepared for chain loading. (make-grub-efi-net-bootloader): New macro to define a customized = bootloader based on 'grub-efi-net-bootloader'. (install-grub-efi-net): New bootloader installer for tftp. (grub-root-search): Adding support for tftp root. (eye-candy): Use 'gfxterm' for all systems if selected via = 'terminal-outputs'. * gnu/system.scm (read-boot-parameters): Prevent devices with ":/" from = being treated as a file system label. --- gnu/bootloader/grub.scm | 128 +++++++++++++++++++++++++++++----------- gnu/system.scm | 3 +- 2 files changed, 95 insertions(+), 36 deletions(-) diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index 3f61b4a963..6ea1b38eb7 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -23,7 +23,7 @@ =20 (define-module (gnu bootloader grub) #:use-module (guix records) - #:use-module ((guix utils) #:select (%current-system)) + #:use-module ((guix utils) #:select (%current-system = %current-target-system)) #:use-module (guix gexp) #:use-module (gnu artwork) #:use-module (gnu bootloader) @@ -53,6 +53,8 @@ =20 grub-bootloader grub-efi-bootloader + make-grub-efi-net-bootloader + grub-efi-net-bootloader grub-mkrescue-bootloader grub-minimal-bootloader =20 @@ -93,7 +95,7 @@ denoting a file name." (default '((fg . cyan) (bg . blue)))) (color-highlight grub-theme-color-highlight (default '((fg . white) (bg . blue)))) - (gfxmode grub-gfxmode + (gfxmode grub-theme-gfxmode (default '("auto")))) ;list of string =20 (define %background-image @@ -143,40 +145,24 @@ WIDTH/HEIGHT, or #f if none was found." #:width width #:height height)))) =20 (define* (eye-candy config store-device store-mount-point - #:key system port) + #:key port) "Return a gexp that writes to PORT (a port-valued gexp) the 'grub.cfg' part concerned with graphics mode, background images, = colors, and all that. STORE-DEVICE designates the device holding the store, and STORE-MOUNT-POINT is its mount point; these are used to determine where = the -background image and fonts must be searched for. SYSTEM must be the = target -system string---e.g., \"x86_64-linux\"." - (define setup-gfxterm-body - (let ((gfxmode - (or (and-let* ((theme (bootloader-configuration-theme = config)) - (gfxmode (grub-gfxmode theme))) - (string-join gfxmode ";")) - "auto"))) - - ;; Intel and EFI systems need to be switched into graphics mode, = whereas - ;; most other modern architectures have no other mode and = therefore - ;; don't need to be switched. - - ;; XXX: Do we really need to restrict to x86 systems? We could = imitate - ;; what the GRUB default configuration does and decide based on = whether - ;; a user provided 'gfxterm' in the terminal-outputs field of = their - ;; bootloader-configuration record. - (if (string-match "^(x86_64|i[3-6]86)-" system) - (format #f " - set gfxmode=3D~a - insmod all_video - insmod gfxterm~%" gfxmode) - ""))) - +background image and fonts must be searched for." (define (setup-gfxterm config font-file) (if (memq 'gfxterm (bootloader-configuration-terminal-outputs = config)) - #~(format #f "if loadfont ~a; then - setup_gfxterm -fi~%" #$font-file) + #~(format #f " +if loadfont ~a; then + set gfxmode=3D~a + insmod all_video + insmod gfxterm +fi~%" + #$font-file + #$(string-join + (grub-theme-gfxmode (bootloader-theme config)) + ";")) "")) =20 (define (theme-colors type) @@ -194,8 +180,6 @@ fi~%" #$font-file) =20 (and image #~(format #$port " -function setup_gfxterm {~a} - # Set 'root' to the partition that contains /gnu/store. ~a =20 @@ -210,7 +194,6 @@ else set menu_color_normal=3Dcyan/blue set menu_color_highlight=3Dwhite/blue fi~%" - #$setup-gfxterm-body #$(grub-root-search store-device font-file) #$(setup-gfxterm config font-file) #$(grub-setup-io config) @@ -317,6 +300,9 @@ code." ((? file-system-label? label) (format #f "search --label --set ~a" (file-system-label->string label))) + ((? (lambda (device) + (and (string? device) (string-contains device ":/"))) = nfs-uri) + "set root=3D(tftp)") ((or #f (? string?)) #~(format #f "search --file --set ~a" #$file))))) =20 @@ -356,7 +342,6 @@ entries corresponding to old generations of the = system." (eye-candy config (menu-entry-device (first all-entries)) (menu-entry-device-mount-point (first all-entries)) - #:system system #:port #~port)) =20 (define keyboard-layout-config @@ -444,6 +429,68 @@ fi~%")))) "--bootloader-id=3DGuix" "--efi-directory" target-esp)))) =20 +(define (install-grub-efi-net efi-subdir) + "Define a grub-efi bootloader installer for installation in = EFI-SUBDIR, +which is usually \"efi/guix\" or \"efi/boot\"." + (let* ((arch (car (string-split (or (%current-target-system) + (%current-system)) + #\-))) + (efi-bootloader-link (string-append "boot" + (match arch + ("i686" "ia32") + ("x86_64" "x64") + ("arm" "arm") + ("armhf" "arm") + ("aarch64" "aa64") + ("riscv" "riscv32") + ("riscv64" "riscv64")) + ".efi")) + (efi-bootloader (string-append (match arch + ("i686" "i386") + ("x86_64" "x86_64") + ("arm" "arm") + ("armhf" "arm") + ("aarch64" "arm64") + ("riscv" "riscv32") + ("riscv64" "riscv64")) + "-efi/core.efi"))) + #~(lambda (bootloader target mount-point) + "Install GRUB as e.g. \"bootx64.efi\" or \"bootarm64.efi\" = \"into +EFI-SUBDIR, which is usually \"efi/guix\" or \"efi/boot\" below the = directory +TARGET for the system whose root is mounted at MOUNT-POINT." + (let* ((mount-point-list (delete "" (string-split mount-point = #\/))) + (target-list (delete "" (string-split target #\/))) + (net-dir + (string-append "/" (string-join (append + mount-point-list + target-list) + "/"))) + (subdir #$efi-subdir) + (efi-bootloader-link + (string-append net-dir "/" subdir "/" = #$efi-bootloader-link)) + (store-name (car (delete "" (string-split bootloader = #\/)))) + (store + ;; Use target-list to construct a "../gnu" link with a = correct + ;; number of "../" to the store. + (string-join (append (make-list (length target-list) = "..") + (list store-name)) + "/")) + (store-link (string-append net-dir "/" store-name))) + ;; Tell 'grub-install' that there might be a LUKS-encrypted = /boot or + ;; root partition. + (setenv "GRUB_ENABLE_CRYPTODISK" "y") + (invoke/quiet (string-append bootloader "/bin/grub-mknetdir") + (string-append "--net-directory=3D" net-dir) + (string-append "--subdir=3D" subdir)) + (false-if-exception + (delete-file efi-bootloader-link)) + (symlink #$efi-bootloader + efi-bootloader-link) + (false-if-exception + (delete-file store-link)) + (symlink store + store-link))))) + ^L =20 ;;; @@ -473,7 +520,18 @@ fi~%")))) (name 'grub-efi) (package grub-efi))) =20 -(define* grub-mkrescue-bootloader +(define-syntax-rule (make-grub-efi-net-bootloader bootloader-name = target efi-subdir) + (define bootloader-name + (bootloader + (inherit grub-bootloader) + (name (quote bootloader-name)) + (package grub-efi) + (installer (install-grub-efi-net efi-subdir)) + (configuration-file (string-append target "/" efi-subdir = "/grub.cfg"))))) + +(make-grub-efi-net-bootloader grub-efi-net-bootloader "boot" = "efi/boot") + +(define grub-mkrescue-bootloader (bootloader (inherit grub-efi-bootloader) (package grub-hybrid))) diff --git a/gnu/system.scm b/gnu/system.scm index cd75e4d4ba..c92bf57f1e 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -300,7 +300,8 @@ file system labels." ((? string? device) ;; It used to be that we would not distinguish between labels = and ;; device names. Try to infer the right thing here. - (if (string-prefix? "/dev/" device) + (if (or (string-prefix? "/dev/" device) + (string-contains device ":/")) ; nfs device (file-system-label device))))) =20 --=20 2.26.0 From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 21 May 2020 15:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mathieu Othacehe Cc: 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.159007366319184 (code B ref 41011); Thu, 21 May 2020 15:08:02 +0000 Received: (at 41011) by debbugs.gnu.org; 21 May 2020 15:07:43 +0000 Received: from localhost ([127.0.0.1]:57101 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jbmnO-0004zM-Q3 for submit@debbugs.gnu.org; Thu, 21 May 2020 11:07:43 -0400 Received: from mx009.vodafonemail.xion.oxcs.net ([153.92.174.39]:36766) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jbmnM-0004z7-6s for 41011@debbugs.gnu.org; Thu, 21 May 2020 11:07:41 -0400 Received: from vsmx002.vodafonemail.xion.oxcs.net (unknown [192.168.75.192]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTP id 2C2A6604B3D; Thu, 21 May 2020 15:07:34 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [2.206.141.243]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 8B389604236; Thu, 21 May 2020 15:07:29 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <0CE089DD-54B6-43AD-8CE7-8EC7004768EB@vodafonemail.de> Date: Thu, 21 May 2020 17:07:28 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <0CE089DD-54B6-43AD-8CE7-8EC7004768EB@vodafonemail.de> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Mathieu! This patch has conflicts meanwhile and needs to be rebased. I=E2=80=99ll = send a new patch soon. Bye Stefan= From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 21 May 2020 18:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mathieu Othacehe Cc: 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.159008645814387 (code B ref 41011); Thu, 21 May 2020 18:41:01 +0000 Received: (at 41011) by debbugs.gnu.org; 21 May 2020 18:40:58 +0000 Received: from localhost ([127.0.0.1]:57257 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jbq7l-0003jy-Mv for submit@debbugs.gnu.org; Thu, 21 May 2020 14:40:58 -0400 Received: from vsmx011.vodafonemail.xion.oxcs.net ([153.92.174.89]:41073) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jbq7j-0003jk-MQ for 41011@debbugs.gnu.org; Thu, 21 May 2020 14:40:57 -0400 Received: from vsmx003.vodafonemail.xion.oxcs.net (unknown [192.168.75.197]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTP id 63C5A59D49B; Thu, 21 May 2020 18:40:49 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [2.206.141.243]) by mta-7-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 0E355539BB2; Thu, 21 May 2020 18:40:44 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: Date: Thu, 21 May 2020 20:40:44 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <0CE089DD-54B6-43AD-8CE7-8EC7004768EB@vodafonemail.de> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/bootloader/grub.scm (grub-efi-net-bootloader): New efi bootloader = for network booting via tftp/nfs, prepared for chain loading. (make-grub-efi-net-bootloader): New macro to define a customized = bootloader based on 'grub-efi-net-bootloader'. (install-grub-efi-net): New bootloader installer for tftp. (grub-root-search): Adding support for tftp root. (eye-candy): Use 'gfxterm' for all systems if selected via = 'terminal-outputs'. * gnu/system.scm (read-boot-parameters): Prevent devices with ":/" from = being treated as a file system label. --- gnu/bootloader/grub.scm | 125 +++++++++++++++++++++++++++++----------- gnu/system.scm | 3 +- 2 files changed, 94 insertions(+), 34 deletions(-) diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index bb40c551a7..2b0ecec279 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -23,7 +23,7 @@ =20 (define-module (gnu bootloader grub) #:use-module (guix records) - #:use-module ((guix utils) #:select (%current-system)) + #:use-module ((guix utils) #:select (%current-system = %current-target-system)) #:use-module (guix gexp) #:use-module (gnu artwork) #:use-module (gnu bootloader) @@ -47,6 +47,8 @@ =20 grub-bootloader grub-efi-bootloader + make-grub-efi-net-bootloader + grub-efi-net-bootloader grub-mkrescue-bootloader grub-minimal-bootloader =20 @@ -140,36 +142,20 @@ file with the resolution provided in CONFIG." concerned with graphics mode, background images, colors, and all that. STORE-DEVICE designates the device holding the store, and = STORE-MOUNT-POINT is its mount point; these are used to determine where the background image = and -fonts must be searched for. SYSTEM must be the target system = string---e.g., -\"x86_64-linux\". BTRFS-STORE-SUBVOLUME-FILE-NAME is the file name of = the -Btrfs subvolume, to be prepended to any store path, if any." - (define setup-gfxterm-body - (let ((gfxmode - (or (and-let* ((theme (bootloader-configuration-theme = config)) - (gfxmode (grub-theme-gfxmode theme))) - (string-join gfxmode ";")) - "auto"))) - - ;; Intel and EFI systems need to be switched into graphics mode, = whereas - ;; most other modern architectures have no other mode and = therefore - ;; don't need to be switched. - - ;; XXX: Do we really need to restrict to x86 systems? We could = imitate - ;; what the GRUB default configuration does and decide based on = whether - ;; a user provided 'gfxterm' in the terminal-outputs field of = their - ;; bootloader-configuration record. - (if (string-match "^(x86_64|i[3-6]86)-" system) - (format #f " - set gfxmode=3D~a - insmod all_video - insmod gfxterm~%" gfxmode) - ""))) - +fonts must be searched for. BTRFS-STORE-SUBVOLUME-FILE-NAME is the = file name +of the Btrfs subvolume, to be prepended to any store path, if any." (define (setup-gfxterm config font-file) (if (memq 'gfxterm (bootloader-configuration-terminal-outputs = config)) - #~(format #f "if loadfont ~a; then - setup_gfxterm -fi~%" #+font-file) + #~(format #f " +if loadfont ~a; then + set gfxmode=3D~a + insmod all_video + insmod gfxterm +fi~%" + #$font-file + #$(string-join + (grub-theme-gfxmode (bootloader-theme config)) + ";")) "")) =20 (define (theme-colors type) @@ -190,8 +176,6 @@ fi~%" #+font-file) =20 (and image #~(format #$port " -function setup_gfxterm {~a} - # Set 'root' to the partition that contains /gnu/store. ~a =20 @@ -206,7 +190,6 @@ else set menu_color_normal=3Dcyan/blue set menu_color_highlight=3Dwhite/blue fi~%" - #$setup-gfxterm-body #$(grub-root-search store-device font-file) #$(setup-gfxterm config font-file) #$(grub-setup-io config) @@ -313,6 +296,9 @@ code." ((? file-system-label? label) (format #f "search --label --set ~a" (file-system-label->string label))) + ((? (lambda (device) + (and (string? device) (string-contains device ":/"))) = nfs-uri) + "set root=3D(tftp)") ((or #f (? string?)) #~(format #f "search --file --set ~a" #$file))))) =20 @@ -454,6 +440,68 @@ fi~%")))) "--bootloader-id=3DGuix" "--efi-directory" target-esp)))) =20 +(define (install-grub-efi-net efi-subdir) + "Define a grub-efi bootloader installer for installation in = EFI-SUBDIR, +which is usually \"efi/boot\" or \"efi/Guix\"." + (let* ((arch (car (string-split (or (%current-target-system) + (%current-system)) + #\-))) + (efi-bootloader-link (string-append "boot" + (match arch + ("i686" "ia32") + ("x86_64" "x64") + ("arm" "arm") + ("armhf" "arm") + ("aarch64" "aa64") + ("riscv" "riscv32") + ("riscv64" "riscv64")) + ".efi")) + (efi-bootloader (string-append (match arch + ("i686" "i386") + ("x86_64" "x86_64") + ("arm" "arm") + ("armhf" "arm") + ("aarch64" "arm64") + ("riscv" "riscv32") + ("riscv64" "riscv64")) + "-efi/core.efi"))) + #~(lambda (bootloader target mount-point) + "Install GRUB as e.g. \"bootx64.efi\" or \"bootarm64.efi\" = \"into +EFI-SUBDIR, which is usually \"efi/boot\" or \"efi/Guix\" below the = directory +TARGET for the system whose root is mounted at MOUNT-POINT." + (let* ((mount-point-list (delete "" (string-split mount-point = #\/))) + (target-list (delete "" (string-split target #\/))) + (net-dir + (string-append "/" (string-join (append + mount-point-list + target-list) + "/"))) + (subdir #$efi-subdir) + (efi-bootloader-link + (string-append net-dir "/" subdir "/" = #$efi-bootloader-link)) + (store-name (car (delete "" (string-split bootloader = #\/)))) + (store + ;; Use target-list to construct a "../gnu" link with a = correct + ;; number of "../" to the store. + (string-join (append (make-list (length target-list) = "..") + (list store-name)) + "/")) + (store-link (string-append net-dir "/" store-name))) + ;; Tell 'grub-install' that there might be a LUKS-encrypted = /boot or + ;; root partition. + (setenv "GRUB_ENABLE_CRYPTODISK" "y") + (invoke/quiet (string-append bootloader "/bin/grub-mknetdir") + (string-append "--net-directory=3D" net-dir) + (string-append "--subdir=3D" subdir)) + (false-if-exception + (delete-file efi-bootloader-link)) + (symlink #$efi-bootloader + efi-bootloader-link) + (false-if-exception + (delete-file store-link)) + (symlink store + store-link))))) + ^L =20 ;;; @@ -483,7 +531,18 @@ fi~%")))) (name 'grub-efi) (package grub-efi))) =20 -(define* grub-mkrescue-bootloader +(define-syntax-rule (make-grub-efi-net-bootloader bootloader-name = target efi-subdir) + (define bootloader-name + (bootloader + (inherit grub-bootloader) + (name (quote bootloader-name)) + (package grub-efi) + (installer (install-grub-efi-net efi-subdir)) + (configuration-file (string-append target "/" efi-subdir = "/grub.cfg"))))) + +(make-grub-efi-net-bootloader grub-efi-net-bootloader "boot" = "efi/boot") + +(define grub-mkrescue-bootloader (bootloader (inherit grub-efi-bootloader) (package grub-hybrid))) diff --git a/gnu/system.scm b/gnu/system.scm index d929187695..2035235549 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -301,7 +301,8 @@ file system labels." ((? string? device) ;; It used to be that we would not distinguish between labels = and ;; device names. Try to infer the right thing here. - (if (string-prefix? "/dev/" device) + (if (or (string-prefix? "/dev/" device) + (string-contains device ":/")) ; nfs device (file-system-label device))))) =20 --=20 2.26.0 From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 23 May 2020 08:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Stefan Cc: 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.15902209609223 (code B ref 41011); Sat, 23 May 2020 08:03:01 +0000 Received: (at 41011) by debbugs.gnu.org; 23 May 2020 08:02:40 +0000 Received: from localhost ([127.0.0.1]:33326 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcP6v-0002OR-Cx for submit@debbugs.gnu.org; Sat, 23 May 2020 04:02:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54662) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcP6t-0002OF-JM for 41011@debbugs.gnu.org; Sat, 23 May 2020 04:02:24 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:40115) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jcP6m-0001t2-UF; Sat, 23 May 2020 04:02:16 -0400 Received: from [2a01:e0a:fa:a50:7ced:409d:b570:ed70] (port=38194 helo=meru) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jcP6m-0003iT-94; Sat, 23 May 2020 04:02:16 -0400 From: Mathieu Othacehe References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> Date: Sat, 23 May 2020 10:02:14 +0200 In-Reply-To: <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> (Stefan's message of "Sun, 10 May 2020 23:13:20 +0200") Message-ID: <87h7w7cc55.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello Stefan, > Yes, it=E2=80=99s kind of possible to inherit from grub-efi-bootloader an= d overwrite the (configuration-file) field. In a first step this seems to w= ork. But when e.g. deleting a system generation, in guix/scripts/system.scm= (reinstall-bootloader) there is this code: > > ;; Use the detected bootloader with default configuration. > ;; It will be enough to allow the system to boot. > (bootloader-config (bootloader-configuration > (bootloader bootloader)))=20 > > It reads this information form /var/guix/profiles/system/parameters: (boo= tloader-name grub-efi-bootloader). > With this again the hard-coded path =E2=80=9C/boot/grub.cfg=E2=80=9D of i= s used, ignoring any value overwritten in (configuration-file). Oh, we need to fix that! It means that we would need to add a "bootloader-configuration-file" field to record, is that correct? > Another issue is (install-dir (string-append mount-point "/boot")) in (in= stall-grub-efi), which ignores any (configuration-file) setting, too =E2=80= =93 well, it has no access to that setting =E2=80=93, and implies at least = =E2=80=9C/boot=E2=80=9D to be the prefix of (bootloader (target =E2=80=A6))= .=20 > > Beside the wish to avoid this hard-coded =E2=80=9C/boot=E2=80=9C assumpti= on, I made this a function with two parameters for two more reasons.=20 Could it be an option to infer the bootloader installation directory and the efi subdir from the install-grub-efi/install-grub-efi-net functions? If TARGET is /boot-nfs/efi/Guix", could we suppose that the boot-directory is "/boot-nfs" and the efi-subdir is "efi/Guix"? The make-grub-efi-net-bootloader macro is a nice hack, but I fear that it makes the bootloader configuration (even more) difficult. Thanks, Mathieu From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 23 May 2020 08:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Stefan Cc: 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.15902214279972 (code B ref 41011); Sat, 23 May 2020 08:11:01 +0000 Received: (at 41011) by debbugs.gnu.org; 23 May 2020 08:10:27 +0000 Received: from localhost ([127.0.0.1]:33345 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcPEg-0002am-UE for submit@debbugs.gnu.org; Sat, 23 May 2020 04:10:27 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55350) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcPEg-0002ab-3l for 41011@debbugs.gnu.org; Sat, 23 May 2020 04:10:26 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:40216) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jcPEY-0003Zs-Kd; Sat, 23 May 2020 04:10:18 -0400 Received: from [2a01:e0a:fa:a50:7ced:409d:b570:ed70] (port=38334 helo=meru) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jcPEY-0001oY-0O; Sat, 23 May 2020 04:10:18 -0400 From: Mathieu Othacehe References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <0CE089DD-54B6-43AD-8CE7-8EC7004768EB@vodafonemail.de> Date: Sat, 23 May 2020 10:10:16 +0200 In-Reply-To: (Stefan's message of "Thu, 21 May 2020 20:40:44 +0200") Message-ID: <87d06vcbrr.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hey Stefan, Thanks for rebasing! > + #~(lambda (bootloader target mount-point) > + "Install GRUB as e.g. \"bootx64.efi\" or \"bootarm64.efi\" \"into > +EFI-SUBDIR, which is usually \"efi/boot\" or \"efi/Guix\" below the directory Is that TARGET or EFI-SUBDIR? > +TARGET for the system whose root is mounted at MOUNT-POINT." > + (let* ((mount-point-list (delete "" (string-split mount-point #\/))) > + (target-list (delete "" (string-split target #\/))) > + (net-dir > + (string-append "/" (string-join (append > + mount-point-list > + target-list) > + "/"))) I think you can use something like "(in-vicinity mount-point target)" to do the same job. > + ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or > + ;; root partition. > + (setenv "GRUB_ENABLE_CRYPTODISK" "y") > + (invoke/quiet (string-append bootloader "/bin/grub-mknetdir") > + (string-append "--net-directory=" net-dir) > + (string-append "--subdir=" subdir)) > + (false-if-exception > + (delete-file efi-bootloader-link)) > + (symlink #$efi-bootloader > + efi-bootloader-link) > + (false-if-exception > + (delete-file store-link)) > + (symlink store > + store-link))))) What's the purpose of those two symlinks, isn't grub-mknetdir taking care of all this? Creating a system test for this may be a bit difficult, but if you could add a section in the documentation describing how to setup a 'grub-efi-net-bootloader, that would be great! Thanks, Mathieu From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 24 May 2020 00:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mathieu Othacehe Cc: 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.15902797826574 (code B ref 41011); Sun, 24 May 2020 00:24:01 +0000 Received: (at 41011) by debbugs.gnu.org; 24 May 2020 00:23:02 +0000 Received: from localhost ([127.0.0.1]:36075 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcePt-0001hi-7h for submit@debbugs.gnu.org; Sat, 23 May 2020 20:23:02 -0400 Received: from vsmx012.vodafonemail.xion.oxcs.net ([153.92.174.90]:19807) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcePr-0001hR-50 for 41011@debbugs.gnu.org; Sat, 23 May 2020 20:23:00 -0400 Received: from vsmx004.vodafonemail.xion.oxcs.net (unknown [192.168.75.198]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTP id 4FF84F34E11; Sun, 24 May 2020 00:22:53 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [2.206.141.243]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTPA id BA50B19AE6B; Sun, 24 May 2020 00:22:48 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <87d06vcbrr.fsf@gnu.org> Date: Sun, 24 May 2020 02:22:47 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <8A871A19-81A8-46D3-86C1-DA9FA209ED70@vodafonemail.de> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <0CE089DD-54B6-43AD-8CE7-8EC7004768EB@vodafonemail.de> <87d06vcbrr.fsf@gnu.org> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Mathieu! > Am 23.05.2020 um 10:10 schrieb Mathieu Othacehe : >=20 >> + #~(lambda (bootloader target mount-point) >> + "Install GRUB as e.g. \"bootx64.efi\" or \"bootarm64.efi\" = \"into >> +EFI-SUBDIR, which is usually \"efi/boot\" or \"efi/Guix\" below the = directory >=20 > Is that TARGET or EFI-SUBDIR? I really mean with EFI-SUBDIR the argument from the enclosing = install-grub-efi-net function, and with TARGET the argument of the = lambda function. The prototype of the lambda function is fixed by some = other guix machinery, it is not possible to pass an EFI-SUBDIR argument = directly. Take for example this path, the default: "/mnt/boot/efi/boot". Then = MOUNT-POINT is "/mnt" (like in 'guix system init config.scm /mnt'), = TARGET is "/boot" (which you also have to specify inside = (operating-system (bootloader (target "/boot") =E2=80=A6) =E2=80=A6), = and EFI-SUBDIR is the remaining "efi/boot". In my personal case I need MOUNT-POINT as "/" (well, 'guix system init = =E2=80=A6' was only necessary once), TARGET as "boot-nfs" (my special = setup), and EFI-SUBDIR as "efi/boot" (because the U-Boot is using this = path by default). For a TFFP server this TARGET with /boot (or /boot-nfs in my case) is = the directory whose content has to be served. It can=E2=80=99t be = /boot/efi (like for the normal grub-efi bootloader), as the TFTP server = needs to serve several firmware files and the U-Boot.=C2=B9 When the = U-Boot takes control, by default it tries to load /efi/boot/bootaa64.efi = via TFTP. It may be possible to configure the U-Boot to look for files below a = /efi/Guix directory or any other path, I=E2=80=99m not really sure about = this yet. At least /efi/boot is the documented last resort for UEFI = systems to look for some =E2=80=9Cremovable madia=E2=80=9D to boot over = TFTP. Next GRUB takes control and looks for its grub.cfg and all its other = files via TFTP at the path specified during 'grub-mknetdir = --subdir=3D=E2=80=A6'. As the TFTP root is /boot (where U-Boot and other = stuff may live), this now has to be efi/boot. So you get all GRUB files = like /boot/efi/boot/grub.cfg served via TFTP from the directory = /boot/efi/boot. For the usual grub-efi-bootloader this is a bit different. Here the = normal path is /mnt/boot/efi/Guix and for the 'grub-install' command = these parameters are required: '=E2=80=94-boot-directory /mnt/boot = --bootloader-id Guix --efi-directory /boot/efi'. Here the "boot" part to = '--boot-directory' is hard coded, as well as "Guix". So the only part = you are free to chose is "efi" in (operating-system (bootloader (target = "boot/efi") =E2=80=A6) =E2=80=A6). Additionally the usual = grub-efi-bootloader looks for /boot/grub.cfg which thus is not residing = inside the efi partition like all its other files. >> +TARGET for the system whose root is mounted at MOUNT-POINT." >> + (let* ((mount-point-list (delete "" (string-split = mount-point #\/))) >> + (target-list (delete "" (string-split target #\/))) >> + (net-dir >> + (string-append "/" (string-join (append >> + mount-point-list >> + target-list) >> + "/"))) >=20 > I think you can use something like "(in-vicinity mount-point target)" > to do the same job. MOUNT-POINT may be just "/", TARGET is "/boot". I=E2=80=99m avoiding = double slashes, like "//boot", also for all the other paths. In an = earlier version I had the =E2=80=9Cproblem=E2=80=9D that GRUB searched = files with the prefix "//efi/boot" via TFTP. This confused me on one = side, but on the other side I feared that another TFTP server might get = problems with this. Avoiding double slashes seems not to be something that in-vicinity is = taking care about. And TARGET with its "/boot" looks like an absolute = path, making it an improper argument to in-vicinity: =E2=80=9Cin-vicinity = should allow filename to override vicinity when filename is an absolute = pathname and vicinity is equal to the value of (user-vicinity). The = behavior of in-vicinity when filename is absolute and vicinity is not = equal to the value of (user-vicinity) is unspecified.=E2=80=9D A bit further down I need to count the directory levels up to the "/gnu" = store to construct a proper link, so I need the result of a string-split = anyway.=20 So all in all =E2=80=93 although it looks a bit complicated =E2=80=93 = I=E2=80=99d like to keep this. Hm, but I wasn=E2=80=99t that strict with the EFI-SUBDIR argument. And = potentially MOUNT-POINT may be a relative path, may it? Do you know? In = that case there is a bug in prepending the "/" to net-dir, turning a = relative into an absolute path. >=20 >> + ;; Tell 'grub-install' that there might be a = LUKS-encrypted /boot or >> + ;; root partition. >> + (setenv "GRUB_ENABLE_CRYPTODISK" "y") >> + (invoke/quiet (string-append bootloader = "/bin/grub-mknetdir") >> + (string-append "--net-directory=3D" net-dir) >> + (string-append "--subdir=3D" subdir)) >> + (false-if-exception >> + (delete-file efi-bootloader-link)) >> + (symlink #$efi-bootloader >> + efi-bootloader-link) >> + (false-if-exception >> + (delete-file store-link)) >> + (symlink store >> + store-link))))) >=20 > What's the purpose of those two symlinks, isn't grub-mknetdir taking > care of all this? No, it doesn=E2=80=99t. The final .efi file after calling = 'grub-mknetdir' is /boot/efi/boot/arm64-efi/core.efi. I guess when using = PXE there is a way to point to this efi file, so GRUB doesn=E2=80=99t = care. But without this the U-Boot looks for the standardised = /efi/boot/bootaa64.efi file via TFTP. So the first symlink fixes this = gap without removing other possibilities. The second symlink is for GRUB itself. Inside /boot/efi/boot/grub.cfg = there are commands to specify the root device, usually via a file system = label or a UUID. But in this case the root device specification is just = =E2=80=9Dset root=3D(tftp)=E2=80=9D. Following lines look up files by = e.g. /gnu/store/=E2=80=A6-grub-2.04/share/grub/unicode.pf2, which GRUB = will then try to access via TFTP. But the root for the TFTP server is = /boot from the TARGET argument, and not /. So GRUB trying to access = /gnu/store/=E2=80=A6 results in an access to /boot/gnu/store/=E2=80=A6. = Therefore the symlink from /boot/gnu to ../gnu is needed. And as TARGET = can freely be chosen the number of up-levels needs to be calculated. Where the usual grub-efi-bootloader is able to find and access the real = root device directly, the grub-efi-net-bootloader can only use TFTP. = Therefore we have to make the real =E2=80=9Croot device=E2=80=9D = accessible via TFPT. I=E2=80=99m not sure if this is wise from a = security point of view. But otherwise all files listed in the grub.cfg = would need to be copied. This would be an overhead and leads to more = complications, when deleting system generations; then obsolete copies = need determined and removed again.=20 > Creating a system test for this may be a bit difficult, but if you = could > add a section in the documentation describing how to setup a > 'grub-efi-net-bootloader, that would be great! I have some difficulties with this =E2=80=93 despite not having = knowledge with texi yet. So help is very welcome. You need to make use of an NFS server, serving your / directory.=20 You need a TFTP server set up to serve the files of our /boot directory = with access to your /gnu store via the /boot/gnu symlink as well.=20 You need to setup your DNS server to send some boot-options.=20 I use a =E2=80=9CDiskStation=E2=80=9D with its UI for all this but = needed to fiddle around with dnsmasq for the DNS. So this is nothing for = a guix documentation. However, this might be even out of scope. But = ideally there would be examples of how to achieve all this with guix = itself. I have no experience using guix for anything of this. Then I use all this to boot a Raspberry Pi 3b in aarch64 mode. This = requires a none free firmware, additional configuration files for the = firmware, the (modified) U-Boot. And there is even more. I compiled the = kernel linux (currently from the mainline) with a Raspberry specific = defconfig-package as an input for the linux package and an additional = function to modify the defconfig on the fly. There are more patches to follow for at least parts of all this. But what I actually want to say with this: Even to reproduce my setup, = still a lot other stuff is missing. And I have no other computer for = tinkering. I can=E2=80=99t try out this patch on a usual x86=E2=80=A664 = machine. I can't really tell, if this will work right out of the box for = other people on different computers. Before documenting this for the public, I would wish that at least = someone else with access to an x86_64 UEFI system gives it a try. I'm = pretty sure it will work. Besides all the server stuff with NFS, TFTP and DNS, there are only few = specialities to know: (operating-system (file-systems (cons (file-system (mount-point "/") (type "nfs") (device ":/your/servers/path/to/guix-root") (options "addr=3D10.11.12.2,vers=3D4.1")) %base-file-systems))=20 (bootloader=20 (target "/boot") (bootloader-configuration (bootloader grub-efi-net-bootloader) =E2=80=A6)) =E2=80=A6) The IP address of your server needs to be specified via an =E2=80=9Caddr=3D= =E2=80=9D option. To make use of the defaults of the new = grub-efi-net-bootloader, the target field has to be "/boot". Bye Stefan =C2=B9 Well, actually =E2=80=93 as for grub-efi-net-bootloader you are = now free to use any path for target =E2=80=93 you can use "/boot/efi". = But then you need to make this your TFTP server=E2=80=99s root, and you = need to use the make-grub-efi-net-bootloader macro with "/boot/efi" as = well, and you will end up in having double efi folders as in = /boot/efi/efi/boot/grub.cfg etc. So this doesn=E2=80=99t make sense.= From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 24 May 2020 10:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mathieu Othacehe Cc: 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.159031554429737 (code B ref 41011); Sun, 24 May 2020 10:20:02 +0000 Received: (at 41011) by debbugs.gnu.org; 24 May 2020 10:19:04 +0000 Received: from localhost ([127.0.0.1]:36532 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcnii-0007jY-Bv for submit@debbugs.gnu.org; Sun, 24 May 2020 06:19:04 -0400 Received: from vsmx009.vodafonemail.xion.oxcs.net ([153.92.174.87]:17776) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcniV-0007ir-Bm for 41011@debbugs.gnu.org; Sun, 24 May 2020 06:19:03 -0400 Received: from vsmx001.vodafonemail.xion.oxcs.net (unknown [192.168.75.191]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTP id ED4B3159DD26; Sun, 24 May 2020 10:18:45 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [2.206.141.243]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 68AEE159DD4E; Sun, 24 May 2020 10:18:39 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <87h7w7cc55.fsf@gnu.org> Date: Sun, 24 May 2020 12:18:38 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <92DB8E2B-1CA2-41AE-9265-53C4F5337686@vodafonemail.de> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <87h7w7cc55.fsf@gnu.org> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Mathieu! > Am 23.05.2020 um 10:02 schrieb Mathieu Othacehe : >=20 >> It reads this information form /var/guix/profiles/system/parameters: = (bootloader-name grub-efi-bootloader). >> With this again the hard-coded path =E2=80=9C/boot/grub.cfg=E2=80=9D = is used, ignoring any value overwritten in (configuration-file). >=20 > Oh, we need to fix that! It means that we would need to add a > "bootloader-configuration-file" field to record, is > that correct? Yes, I would guess so. But I=E2=80=99m not sure, if the field = bootloader-name can be dropped then from . But if, then = we could probably also drop the field name from the record.=20= >> Another issue is (install-dir (string-append mount-point "/boot")) in = (install-grub-efi), which ignores any (configuration-file) setting, too = =E2=80=93 well, it has no access to that setting =E2=80=93, and implies = at least =E2=80=9C/boot=E2=80=9D to be the prefix of (bootloader (target = =E2=80=A6)).=20 >>=20 >> Beside the wish to avoid this hard-coded =E2=80=9C/boot=E2=80=9C = assumption, I made this a function with two parameters for two more = reasons.=20 >=20 > Could it be an option to infer the bootloader installation directory = and > the efi subdir from the install-grub-efi/install-grub-efi-net = functions? > If TARGET is /boot-nfs/efi/Guix", could we suppose that the > boot-directory is "/boot-nfs" and the efi-subdir is "efi/Guix"? For the new install-grub-efi-net I see first of all no issue in keeping = it a function. This gives the needed flexibility. For the existing grub-efi-bootloader the assumption seems to be that = there will always be a /boot/grub.cfg. This is just not stated in the = documentation. But it gave me the impression that there is some control = about it with (bootloader (target =E2=80=A6) =E2=80=A6). But this is not = the case. For the legacy grub-bootlouder the (bootloader (target =E2=80=A6= ) =E2=80=A6) needs to be a device, and the /boot/grub.cfg is implied and = hard coded as well. Actually thinking about it again, mounting the efi partition at e.g. = /foo/efi, doesn't brake anything in the first place. Then GRUB will be = installed at the target /foo/efi, basically into the efi partition it = belongs. It will just read its configuration from /boot/grub.cfg, from a = different partition. The actual difference to the new grub-efi-net-bootloader is that it has = only TFTP access to its files and its configuration file; there is only = one place to lookup both, instead of two partitions in case of the = grub-efi-bootloader. For deleting system generations the path to the always present, not = configurable /boot/grub.cfg is looked up. This works for the existing = grub-efi-bootloader and grub-bootloader. But it does not work for the = grub-efi-net-bootloader, because its configuration file does not live at = /boot/grub.cfg, as its path is now implicitly configurable via = (bootloader (target =E2=80=A6) =E2=80=A6). In addition for my setup I = used a /boot-nfs folder instead of a /boot folder, and saw no benefit = then in keeping the /boot folder. I think there is a second possibility. It may be possible to create a = symlink from /boot-nfs/efi/boot/grub.cfg to ../../../boot/grub.cfg. Then = the assumption that there will always be a /boot/grub.cfg file stays = valid.=20 But personally I do not like this idea. In it seems =E2=80=93 but I=E2=80=99m not sure yet =E2=80= =93 that we only keep a symbol name to figure out the path to the = grub.cfg, although it is possible to just put that path directly there = instead. And using the symbol makes it hard do get a configurable = bootloader: A new bootloader has to be a variable, tricks with macros = come up. Also inheriting from a bootloader and overwriting the = configuration-file field =E2=80=93 for whatever reason =E2=80=93 is = problematic: It seems to work at the beginning, but only fails badly = when removing a system generation. It seems to have subtle bugs. It=E2=80=99= s not usable like other parts in guix. It=E2=80=99s not hackable. I=E2=80=99= d really prefer to change this. > The make-grub-efi-net-bootloader macro is a nice hack, but I fear that > it makes the bootloader configuration (even more) difficult. At least it gives me the flexibility which was missing so far. I suggest = to keep it for the moment and do a different patch once we are clear = which way to go. If we add a bootloader-configuration-file field to the = record, than the macro can be removed anyway. Bye Stefan= From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 24 May 2020 11:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Stefan Cc: Mathieu Othacehe , 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.15903180691326 (code B ref 41011); Sun, 24 May 2020 11:02:02 +0000 Received: (at 41011) by debbugs.gnu.org; 24 May 2020 11:01:09 +0000 Received: from localhost ([127.0.0.1]:36543 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcoNQ-0000LK-Se for submit@debbugs.gnu.org; Sun, 24 May 2020 07:01:09 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:43034) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcoNN-0000L9-89 for 41011@debbugs.gnu.org; Sun, 24 May 2020 07:01:07 -0400 Received: from localhost (80-110-127-207.cgn.dynamic.surfer.at [80.110.127.207]) by dd26836.kasserver.com (Postfix) with ESMTPSA id AA4E833623B8; Sun, 24 May 2020 13:01:03 +0200 (CEST) Date: Sun, 24 May 2020 13:00:32 +0200 From: Danny Milosavljevic Message-ID: <20200524125859.7efe5169@scratchpost.org> In-Reply-To: <92DB8E2B-1CA2-41AE-9265-53C4F5337686@vodafonemail.de> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <87h7w7cc55.fsf@gnu.org> <92DB8E2B-1CA2-41AE-9265-53C4F5337686@vodafonemail.de> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/6HHy1=B/.9DoMaLvGG0Kt7G"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/6HHy1=B/.9DoMaLvGG0Kt7G Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Stefan, On Sun, 24 May 2020 12:18:38 +0200 Stefan wrote: > But I=E2=80=99m not sure, if the field bootloader-name can be dropped the= n[after adding bootloader-configuration-file to boot-parameters] from . But if, then we could probably also drop the field name from = the record.=20 We definitely can't drop it. The name is required in order to know which bootloader to restore when deleting system generations. After all you coul= d be deleting the generation that switched from extlinux to grub. How to boot t= hen? (see lookup-bootloader-by-name call site) Since we are trying to have the bootloader to use part of the Guix system configuration (for better or for worse), we have to be really careful to pick the right bootloader and generate the configuration for the right bootloader, otherwise the computer won't boot anymore *and* you couldn't select the before-fuckup generation anymore either. > Yes, it=E2=80=99s kind of possible to inherit from grub-efi-bootloader an= d overwrite the (configuration-file) field. In a first step this seems to work. But when e.g. deleting a system generation, in guix/scripts/system.scm (reinstall-bootloader) there is this code: > > ;; Use the detected bootloader with default configuration. > ;; It will be enough to allow the system to boot. > (bootloader-config (bootloader-configuration > (bootloader bootloader)))=20 >In it seems =E2=80=93 but I=E2=80=99m not sure yet =E2= =80=93 that we only keep a symbol name to figure out the path to the grub.c= fg, although it is possible to just put that path directly there instead. A= nd using the symbol makes it hard do get a configurable bootloader: A new b= ootloader has to be a variable, tricks with macros come up. Also inheriting= from a bootloader and overwriting the configuration-file field =E2=80=93 f= or whatever reason =E2=80=93 is problematic: It seems to work at the beginn= ing, but only fails badly when removing a system generation. It seems to ha= ve subtle bugs. It=E2=80=99s not usable like other parts in guix. It=E2=80= =99s not hackable. I=E2=80=99d really prefer to change this. Yeah, well... that is the only way we could think of to make sure it actua= lly boots in all cases, as it is right now. (Though if the user had custom entries, that would nuke all of them--but that's still better than not being able to boot at all) Using a symbol was to make it clear that this is supposed to be a reference to an actual variable and not some weird mini-programming language inside a string or whatever. It would be better to have some kind of abstract representation of *all* the bootloader things one could want, in Guix in config.scm. That would make Guix system a lot more complicated, though (chainloading bootloaders for one--I saw you working on this, too). Just to be clear, I'm fine with changing boot-parameters, but be very very careful that all old versions of Guix and new versions of Guix can handle all the boot-parameters--at least falling back to something. It's not fun if you can't boot anymore. Source: I modified a lot of that stuff and wasn't able to boot quite often until I finally stopped overcomplicating the boot-parameters. >Actually there is a problem with all this in guix: There is (bootloader (t= arget =E2=80=A6)), >which gives the impression that one is able to freely chose a folder for t= he >bootloader files. However, the path =E2=80=9C/boot/grub.cfg=E2=80=9D is ki= nd of hard coded. Could you elaborate why having that hard-coded file path is bad? It makes booting a lot more resilient if it's hard-coded as opposed to havi= ng basic stuff like that configurable--and being careful all the time it's actually configured correctly for all the parties to it, some of them maybe not even inside Guix. --Sig_/6HHy1=B/.9DoMaLvGG0Kt7G Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl7KU9AACgkQ5xo1VCww uqUgcggAktmn9d/OWm+RkfK/Iv1iq6gO1IJbWBzmX9pjbH2hTnPyMsiR0Tw8nbEG I17LQHLY9/T+KfjygpvXPtRazByP5t4/B3ga+FPxQnaFcWXvOQprDyQgtzOFnQiG 4vXo3NqVWCcB/2tuRehhrdwkUMZ3gna+fgaRYlB8zSEiWCw7HlQAFcGJb05h1x5w gCkQEelaNBK+9cnjyjqyP9yEJhQruMfdtY1N3iCNZs2bJSY5jgMCsRe6ZrS3bSpy GiQh47gORJqePheNdnXjcws83Jtb8DDEwzJxIOxILtkpHs6mjtaOk4sP0lXay0+Z fR5L1ZQyXw1w3eYL5WsR1b4vDFDTyg== =Tih4 -----END PGP SIGNATURE----- --Sig_/6HHy1=B/.9DoMaLvGG0Kt7G-- From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 24 May 2020 13:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Cc: Mathieu Othacehe , 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.159032575821412 (code B ref 41011); Sun, 24 May 2020 13:10:02 +0000 Received: (at 41011) by debbugs.gnu.org; 24 May 2020 13:09:18 +0000 Received: from localhost ([127.0.0.1]:36671 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcqNR-0005ZI-PQ for submit@debbugs.gnu.org; Sun, 24 May 2020 09:09:18 -0400 Received: from vsmx011.vodafonemail.xion.oxcs.net ([153.92.174.89]:37689) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcqNQ-0005Z5-9q for 41011@debbugs.gnu.org; Sun, 24 May 2020 09:09:16 -0400 Received: from vsmx003.vodafonemail.xion.oxcs.net (unknown [192.168.75.197]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTP id CD17059CFE9; Sun, 24 May 2020 13:09:10 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [2.206.141.243]) by mta-7-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 1B488539AB3; Sun, 24 May 2020 13:09:04 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <20200524125859.7efe5169@scratchpost.org> Date: Sun, 24 May 2020 15:09:02 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <078D1EA7-0875-4F24-AA49-D39CCDC77403@vodafonemail.de> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <87h7w7cc55.fsf@gnu.org> <92DB8E2B-1CA2-41AE-9265-53C4F5337686@vodafonemail.de> <20200524125859.7efe5169@scratchpost.org> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Danny! > Am 24.05.2020 um 13:00 schrieb Danny Milosavljevic = : >=20 >> But I=E2=80=99m not sure, if the field bootloader-name can be dropped = then[after adding bootloader-configuration-file to boot-parameters] from = . But if, then we could probably also drop the field = name from the record.=20 >=20 > We definitely can't drop it. The name is required in order to know = which > bootloader to restore when deleting system generations. After all you = could be > deleting the generation that switched from extlinux to grub. How to = boot then? >=20 > (see lookup-bootloader-by-name call site) OK, I understand. I will take a look at it. > Since we are trying to have the bootloader to use part of the Guix = system > configuration (for better or for worse), we have to be really careful = to > pick the right bootloader and generate the configuration for the right > bootloader, otherwise the computer won't boot anymore *and* you = couldn't > select the before-fuckup generation anymore either. Hm, if I select an older system generation in GRUB, than that older one = is booted. But this doesn't change the bootloader. If I then delete some system generations =E2=80=93 as I=E2=80=99ve seen = so far, but I might be wrong =E2=80=93 the bootloader is not reinstalled = either. Only the grub.cfg is regenerated to remove the deleted = generations. If I reboot, then I'm still using the latest generation = GRUB, but boot some older system generation, which would not be able by = itself to install this very recent GRUB in use. If I then reconfigure the system, only then another GRUB - or even a = different bootloader, depending on my etc/config.scm =E2=80=93 will be = installed and the according configuration file will be generated as = well. Then again all will fit. In the worst case the (bootloader = (bootloader-configuration =E2=80=A6) =E2=80=A6) in my etc/config.scm is = still newer than this older guix system in use is able to handle.=20 Oh, by the way, does booting an older system generation also change the = guix version in use from the latest 'guix pull'? I don't think it does. And does booting an older generation change the config.scm? I don=E2=80=99= t think so either. Actually, I don=E2=80=99t really understand what you mean. Are there = circumstances beside a 'guix system reconfigure' in which the bootloader = gets reinstalled? And with reinstall I don=E2=80=99t mean to only = regenerate the grub.cfg, but calling /sbin/grub-install. Isn=E2=80=99t the actual problem for an older running system generation = to know which bootloder is currently in use? I think this can't be = inferred by the currently running system generation. It may happen, that = you use a brand new bootloader which is not known by the older system = generation you just switched to. But still then, if you invoke a 'sudo -E guix system delete-generations' = or a 'sudo -E guix system reconfigure' I think you still use the very = latest guix version that you 'guix pull'-ed last. And that guix version = should still know all brand new bootloader. The problem may =E2=80=9Conly=E2= =80=9D be to know for 'sudo -E guix system delete-generations' which one = to use. But actually the bootloader-name field in = /var/guix/profiles/system/parameters can't tell either, as it must be an = older bootloader than the brand new one. Maybe the information about the bootloader version in use needs to = reside with the installed bootloader somewhere below /boot/efi/=E2=80=A6? = But this may be impossible for the legacy grub-bootloader. >> Yes, it=E2=80=99s kind of possible to inherit from = grub-efi-bootloader and overwrite > the (configuration-file) field. In a first step this seems to work. = But when > e.g. deleting a system generation, in guix/scripts/system.scm > (reinstall-bootloader) there is this code: >>=20 >> ;; Use the detected bootloader with default configuration. >> ;; It will be enough to allow the system to boot. >> (bootloader-config (bootloader-configuration >> (bootloader bootloader)))=20 >=20 >> In it seems =E2=80=93 but I=E2=80=99m not sure yet = =E2=80=93 that we only keep a symbol name to figure out the path to the = grub.cfg, although it is possible to just put that path directly there = instead. And using the symbol makes it hard do get a configurable = bootloader: A new bootloader has to be a variable, tricks with macros = come up. Also inheriting from a bootloader and overwriting the = configuration-file field =E2=80=93 for whatever reason =E2=80=93 is = problematic: It seems to work at the beginning, but only fails badly = when removing a system generation. It seems to have subtle bugs. It=E2=80=99= s not usable like other parts in guix. It=E2=80=99s not hackable. I=E2=80=99= d really prefer to change this. >=20 > Yeah, well... that is the only way we could think of to make sure it = actually > boots in all cases, as it is right now. I think after switching to an older system generation this is not true, = as explained above. Am I wrong about this? > Just to be clear, I'm fine with changing boot-parameters, but be very = very > careful that all old versions of Guix and new versions of Guix can = handle > all the boot-parameters--at least falling back to something. I see. > Could you elaborate why having that hard-coded file path is bad? >=20 > It makes booting a lot more resilient if it's hard-coded as opposed to = having > basic stuff like that configurable--and being careful all the time = it's > actually configured correctly for all the parties to it, some of them = maybe > not even inside Guix. As I wrote a bit below: I think there is a second possibility. It may be = possible to create a symlink from /boot-nfs/efi/boot/grub.cfg to = ../../../boot/grub.cfg. Then the assumption that there will always be a = /boot/grub.cfg file stays valid. But Im still unsure about this. Bye Stefan= From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 24 May 2020 13:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Stefan Cc: Mathieu Othacehe , 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.159032776724494 (code B ref 41011); Sun, 24 May 2020 13:43:02 +0000 Received: (at 41011) by debbugs.gnu.org; 24 May 2020 13:42:47 +0000 Received: from localhost ([127.0.0.1]:36687 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcqtr-0006Mz-3j for submit@debbugs.gnu.org; Sun, 24 May 2020 09:42:47 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:56002) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcqtp-0006Mn-8v for 41011@debbugs.gnu.org; Sun, 24 May 2020 09:42:46 -0400 Received: from localhost (80-110-127-207.cgn.dynamic.surfer.at [80.110.127.207]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 72CAA336396B; Sun, 24 May 2020 15:42:43 +0200 (CEST) Date: Sun, 24 May 2020 15:42:15 +0200 From: Danny Milosavljevic Message-ID: <20200524154215.1fdb0a94@scratchpost.org> In-Reply-To: <078D1EA7-0875-4F24-AA49-D39CCDC77403@vodafonemail.de> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <87h7w7cc55.fsf@gnu.org> <92DB8E2B-1CA2-41AE-9265-53C4F5337686@vodafonemail.de> <20200524125859.7efe5169@scratchpost.org> <078D1EA7-0875-4F24-AA49-D39CCDC77403@vodafonemail.de> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/Yd/Y.Ar=_/91LQW_.QAyPZA"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/Yd/Y.Ar=_/91LQW_.QAyPZA Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Stefan, On Sun, 24 May 2020 15:09:02 +0200 Stefan wrote: > Hm, if I select an older system generation in GRUB, than that older one i= s booted. But this doesn't change the bootloader. Correct. It doesn't need to since it just changes which Linux kernel will = be booted temporarily, including what system and so on. "System" here excludes $HOME. Since the guix package manager itself is in $HOME, I think that that doesn'= t revert though. > If I then delete some system generations =E2=80=93 as I=E2=80=99ve seen s= o far, but I might be wrong =E2=80=93 the bootloader is not reinstalled eit= her. > Only the grub.cfg is regenerated to remove the deleted generations. You are totally right O_O reinstall-bootloader says: > ;; Only install bootloader configuration file. What happened here? Why?! (I think we should document these bootloader Guix intricacies in some bette= r place than the mailing list archives; can't keep the thing straight other= wise :P) >If I reboot, then I'm still using the latest generation GRUB, but boot som= e older system generation, which would not be able by itself to install thi= s very recent GRUB in use. It should be able to since guix package manager including package definitio= ns is in $HOME, which is not rolled back, I think. The only way to install= the very recent GRUB is guix system reconfigure, and that will totally be = able to see the newest guix packages. > If I then reconfigure the system, only then another GRUB - or even a diff= erent bootloader, depending on my etc/config.scm =E2=80=93 will be installe= d and the according configuration file will be generated as well. Then agai= n all will fit. Yes, that case is fine. > In the worst case the (bootloader (bootloader-configuration =E2=80=A6) = =E2=80=A6) in my etc/config.scm is still newer than this older guix system = in use is able to handle. I think guix-the-package-manager is not reverted, so it will be able to see= the newest installable stuff.=20 > Oh, by the way, does booting an older system generation also change the g= uix version in use from the latest 'guix pull'? I don't think it does. No, that is per-user and not per-system. > And does booting an older generation change the config.scm? I don=E2=80= =99t think so either. No. > Actually, I don=E2=80=99t really understand what you mean. Are there circ= umstances beside a 'guix system reconfigure' in which the bootloader gets r= einstalled? And with reinstall I don=E2=80=99t mean to only regenerate the = grub.cfg, but calling /sbin/grub-install. I think the actual bootloader (any of them those worked before) should be r= einstalled by guix system delete-generations too, but apparently it doesn't= do it right now. Sounds very dangerous. Doesn't that mean if one changed bootloaders in the= past and then keeps using guix system delete-generations, that one eventua= lly couldn't boot anymore? O_O > Isn=E2=80=99t the actual problem for an older running system generation t= o know which bootloder is currently in use? I think this can't be inferred = by the currently running system generation. It may happen, that you use a b= rand new bootloader which is not known by the older system generation you j= ust switched to. I think guix-the-package-manager is still the newest one even after selecti= ng an older system generation. So the "brand new bootloader" case should be fine. But the delete-generation case basically would have had to do the actual bo= otloader installation too. Like it is now, it totally has a huge problem. A possible way around having to know which bootloader is in use would be to= just always install the configurations for all the known bootloaders. > But still then, if you invoke a 'sudo -E guix system delete-generations' = or a 'sudo -E guix system reconfigure' I think you still use the very lates= t guix version that you 'guix pull'-ed last. Yes. > And that guix version should still know all brand new bootloader. The pro= blem may =E2=80=9Conly=E2=80=9D be to know for 'sudo -E guix system delete-= generations' which one to use. Yep. > But actually the bootloader-name field in /var/guix/profiles/system/param= eters can't tell either, as it must be an older bootloader than the brand n= ew one. Correct. > Maybe the information about the bootloader version in use needs to reside= with the installed bootloader somewhere below /boot/efi/=E2=80=A6? But thi= s may be impossible for the legacy grub-bootloader. That sounds like a huge can of worms to open. Better would be some kind of= bootloader detector (can package "os-prober" do it maybe?)--or better yet,= just also install the bootloader each time a system generation is deleted = and/or system in reconfigured. That was the original plan. --Sig_/Yd/Y.Ar=_/91LQW_.QAyPZA Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl7KebcACgkQ5xo1VCww uqUsvAgAlGyws4HsfWGihBuvDBRyJ0XlR22D1MQ6RxN9A2soIu6YiEldFXqItcBb mSeSL9qQ7RZ2BfQierpulYMjqgTIsuFoNsu8FdeGTKqmh4e7Cl5yeE3x7GvYLAYf DHv1ljnG1ri+9DA3zVyVd0XyMyq2tydPxywoggwGE9RUdRyJOvHU7DuesMKJPpiR SnQm+OwYCu//3IPDB6p3eAWO2xM0SRJaH+ffXgU6u3XrwXOYe926J+irtNgNOnw1 bgkglLLWyP8bv38VjOFnX3ymJfTa0O+FsPx5r4VmwF4j2WYwSQ+vP8l4Uydq2t5s +hzS0E0c57jCn7eV/LTceYHWIq3GWQ== =T7xj -----END PGP SIGNATURE----- --Sig_/Yd/Y.Ar=_/91LQW_.QAyPZA-- From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 24 May 2020 14:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Stefan Cc: Mathieu Othacehe , 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.159032876427553 (code B ref 41011); Sun, 24 May 2020 14:00:02 +0000 Received: (at 41011) by debbugs.gnu.org; 24 May 2020 13:59:24 +0000 Received: from localhost ([127.0.0.1]:38394 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcr9v-0007AL-MS for submit@debbugs.gnu.org; Sun, 24 May 2020 09:59:23 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:57462) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcr9t-0007AC-OO for 41011@debbugs.gnu.org; Sun, 24 May 2020 09:59:22 -0400 Received: from localhost (80-110-127-207.cgn.dynamic.surfer.at [80.110.127.207]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 14FDD336378B; Sun, 24 May 2020 15:59:20 +0200 (CEST) Date: Sun, 24 May 2020 15:58:50 +0200 From: Danny Milosavljevic Message-ID: <20200524155850.3d24d358@scratchpost.org> In-Reply-To: <20200524154215.1fdb0a94@scratchpost.org> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <87h7w7cc55.fsf@gnu.org> <92DB8E2B-1CA2-41AE-9265-53C4F5337686@vodafonemail.de> <20200524125859.7efe5169@scratchpost.org> <078D1EA7-0875-4F24-AA49-D39CCDC77403@vodafonemail.de> <20200524154215.1fdb0a94@scratchpost.org> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/_AWrkuZtL2/_gqBdRFf+xvx"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/_AWrkuZtL2/_gqBdRFf+xvx Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable > > But actually the bootloader-name field in /var/guix/profiles/system/par= ameters can't tell either, as it must be an older bootloader than the brand= new one. =20 Yes, but as the comment in the source says, the goal is to be able to boot = at all, not be perfect. So basically we could assume that if a previous system generation has used = a bootloader [name] (and we can still apparently run guix commands) then th= at bootloader actually could boot that system, and presumably can boot it a= gain if we installed it now. Might make sense to use the newest generation possible for that. (I think = even if you used the boot menu or guix system switch-generation, the newest= generation would still be present, just not current; so if that used the b= ootloader name of the newest generation that exists we might be safe) All this complication is just because we don't have the file name of the os= configuration (/etc/config.scm) in guix system delete-generations. What a= bout us just requiring it from the user and then installing the bootloader&= config that is specified there? That would be a lot less magical--it basic= ally would do the same that guix system reconfigure does now, then. (What about guix system switch-generation? What does it do regarding bootl= oader installation? *mumbles* *checks* Aha, it also only installs the boot= loader configuration) guix/scripts/system.scm says: > (bootloader (lookup-bootloader-by-name (system-bootloader-name))) What is that (system-bootloader-name) magical parameterless call? Which ge= neration does that use? *shakes head* Our source code there totally could use some more comments... --Sig_/_AWrkuZtL2/_gqBdRFf+xvx Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl7KfZoACgkQ5xo1VCww uqVbhQf/UUenwtb/ND4d45bfRLremUqigBqxIdh/dq260g7x7MkXACbmG345qofQ xBw92W2nnFA9AQHt35Dtxo+qoQig3evY6fUr559XxINAdcdaV3UzM7iDr2XAz53S QNOWkYSE+G8Z7OowCYkc5BmP9VJRfL0EMfKstuBLrg549oZoc6FdDOkatQt+RKTZ sLC31aBIpr3lArgqk4DNOo82ABrtIgQ86ZBBqB20epbGpYo2LQgDpdGA3e8Et279 2vHKNQxD5hVUCpeexaMwp6tNn6tmNimco+/s9iNSM8VG9mxSYtcMraIA9/J5IMyz HQdP6TrZ9zezLP4mhkrKG1ch8zJeVQ== =i3Ii -----END PGP SIGNATURE----- --Sig_/_AWrkuZtL2/_gqBdRFf+xvx-- From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 24 May 2020 16:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Cc: Mathieu Othacehe , 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.159033886410373 (code B ref 41011); Sun, 24 May 2020 16:48:01 +0000 Received: (at 41011) by debbugs.gnu.org; 24 May 2020 16:47:44 +0000 Received: from localhost ([127.0.0.1]:38550 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jctmq-0002hE-5h for submit@debbugs.gnu.org; Sun, 24 May 2020 12:47:44 -0400 Received: from vsmx012.vodafonemail.xion.oxcs.net ([153.92.174.90]:47240) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jctmo-0002h1-OL for 41011@debbugs.gnu.org; Sun, 24 May 2020 12:47:43 -0400 Received: from vsmx004.vodafonemail.xion.oxcs.net (unknown [192.168.75.198]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTP id 9DF8DF34F33; Sun, 24 May 2020 16:47:36 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [2.206.141.243]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTPA id D703B19B02F; Sun, 24 May 2020 16:47:29 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <20200524154215.1fdb0a94@scratchpost.org> Date: Sun, 24 May 2020 18:47:28 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <29547D4C-4E43-457D-A836-7EEF417A55B9@vodafonemail.de> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <87h7w7cc55.fsf@gnu.org> <92DB8E2B-1CA2-41AE-9265-53C4F5337686@vodafonemail.de> <20200524125859.7efe5169@scratchpost.org> <078D1EA7-0875-4F24-AA49-D39CCDC77403@vodafonemail.de> <20200524154215.1fdb0a94@scratchpost.org> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Danny! > Am 24.05.2020 um 15:42 schrieb Danny Milosavljevic = : >=20 > You are totally right O_O >=20 > reinstall-bootloader says: >=20 >> ;; Only install bootloader configuration file. >=20 > What happened here? Why?! =46rom my point of o newbie view nothing, this has ever been so. :-) > I think the actual bootloader (any of them those worked before) should = be reinstalled by guix system delete-generations too, but apparently it = doesn't do it right now. > Sounds very dangerous. Doesn't that mean if one changed bootloaders = in the past and then keeps using guix system delete-generations, that = one eventually couldn't boot anymore? O_O I think this may not be needed. The task of the bootloader is to parse = the generated configuration file and load the initrd and kernel. If the = current latest bootloader is able do this, than all is fine. The loaded = system generation does not matter for this. Why should 'guix system switch-generation' or 'guix system = delete-generations' brake anything here, as long as the generated = configuration file is still readable by the bootloader in use? Ah, now I got your point! An older generation now potentially has a = different value in the bootloader-name field of the = record. Then it will generate the wrong bootloader configuration file, = e.g. for extlinux instead of for grub-efi.=20 Well, the bootloader-name information of an older system generation does = not help. > So the "brand new bootloader" case should be fine. > But the delete-generation case basically would have had to do the = actual bootloader installation too. Like it is now, it totally has a = huge problem. >=20 > A possible way around having to know which bootloader is in use would = be to just always install the configurations for all the known = bootloaders. Hm, not sure. >> Maybe the information about the bootloader version in use needs to = reside with the installed bootloader somewhere below /boot/efi/=E2=80=A6? = But this may be impossible for the legacy grub-bootloader. >=20 > That sounds like a huge can of worms to open. Better would be some = kind of bootloader detector (can package "os-prober" do it maybe?)--or = better yet, just also install the bootloader each time a system = generation is deleted and/or system is reconfigured. That was the = original plan. Some information from the installed bootloader could very well be passed = via kernel arguments. This way the bootloader would actively spread = information about itself and this will work with any bootloader.=20 We could use for example these two kernel arguments: --bootloader-configuration-file-generator=3Dgrub-configuration-file = --bootloader-configuration-file=3D/boot/grub.cfg If we =E2=80=93 like today =E2=80=93 do not reinstall the bootloader = when switching generations, these are the needed information: how and = where to generate the configuration file. If the guix in $HOME does not know the passed generator procedure, then = it there would automatically be a fallback: = /var/guix/profiles/system/parameters contains a kernel-arguments field = already! That would contain a matching generator function then. If the = generator is neither in kernel-arguments, then we could fall-back to the = bootloader-name field and even reinstall the bootloader. As it is today, the bootloader is a state. And to reduce the risk of = failures (power-loss), it makes sense to install the bootloader only if = absolutely necessary. Bye Stefan From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 24 May 2020 17:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Cc: Mathieu Othacehe , 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.159033998512098 (code B ref 41011); Sun, 24 May 2020 17:07:01 +0000 Received: (at 41011) by debbugs.gnu.org; 24 May 2020 17:06:25 +0000 Received: from localhost ([127.0.0.1]:38570 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcu4u-000394-Nx for submit@debbugs.gnu.org; Sun, 24 May 2020 13:06:24 -0400 Received: from mx009.vodafonemail.xion.oxcs.net ([153.92.174.39]:62504) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcu4t-00038s-1U for 41011@debbugs.gnu.org; Sun, 24 May 2020 13:06:23 -0400 Received: from vsmx002.vodafonemail.xion.oxcs.net (unknown [192.168.75.192]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTP id A0F006045D9; Sun, 24 May 2020 17:06:17 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [2.206.141.243]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTPA id E92E26047AC; Sun, 24 May 2020 17:06:10 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <20200524155850.3d24d358@scratchpost.org> Date: Sun, 24 May 2020 19:06:08 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <427BDAFE-32EA-4C33-817C-C4523ADC3696@vodafonemail.de> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <87h7w7cc55.fsf@gnu.org> <92DB8E2B-1CA2-41AE-9265-53C4F5337686@vodafonemail.de> <20200524125859.7efe5169@scratchpost.org> <078D1EA7-0875-4F24-AA49-D39CCDC77403@vodafonemail.de> <20200524154215.1fdb0a94@scratchpost.org> <20200524155850.3d24d358@scratchpost.org> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Danny! > Am 24.05.2020 um 15:58 schrieb Danny Milosavljevic = : >=20 > All this complication is just because we don't have the file name of = the os configuration (/etc/config.scm) in guix system = delete-generations. Hm, somehow true. > What about us just requiring it from the user and then installing the = bootloader&config that is specified there? That would be a lot less = magical--it basically would do the same that guix system reconfigure = does now, then. But it would mean to always install the bootloader without actual need, = which is a point of failure. However, this is the case for reconfigure, = too. Bye Stefan= From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 06 Jun 2020 13:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mathieu Othacehe Cc: 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.159145023117150 (code B ref 41011); Sat, 06 Jun 2020 13:31:02 +0000 Received: (at 41011) by debbugs.gnu.org; 6 Jun 2020 13:30:31 +0000 Received: from localhost ([127.0.0.1]:51073 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jhYu6-0004SK-PI for submit@debbugs.gnu.org; Sat, 06 Jun 2020 09:30:31 -0400 Received: from vsmx011.vodafonemail.xion.oxcs.net ([153.92.174.89]:57747) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jhYu4-0004JH-1v for 41011@debbugs.gnu.org; Sat, 06 Jun 2020 09:30:29 -0400 Received: from vsmx003.vodafonemail.xion.oxcs.net (unknown [192.168.75.197]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTP id 9A3E659D1A8; Sat, 6 Jun 2020 13:30:22 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [145.254.41.70]) by mta-7-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 40CC6539B6B; Sat, 6 Jun 2020 13:30:18 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <92DB8E2B-1CA2-41AE-9265-53C4F5337686@vodafonemail.de> Date: Sat, 6 Jun 2020 15:30:17 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <87h7w7cc55.fsf@gnu.org> <92DB8E2B-1CA2-41AE-9265-53C4F5337686@vodafonemail.de> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Mathieu! I changed my mind. I think it is better in a first step to keep the = convention to have a fixed /boot/grub/grub.cfg. Therefore I create = another link at //efi/boot/grub.cfg pointing to that file. Then = there is no trouble with the yet, and the = grub-efi-net-bootloader doesn't need to know about the target directory = before installation. I removed the macro as well, hence fixing the path to efi/boot. To boot = different systems =E2=80=93 because of the grub.cfg link =E2=80=93 there = needs to be some redirection via PXE or DNS on some higher level. With = the macro you could have several //efi/Guix directories on = the same tftp server, but their grub.cfg link would still all point to = the same location: ../../../boot/grub/grub. So the macro makes no sense = anymore. Bye Stefan= From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 06 Jun 2020 13:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mathieu Othacehe Cc: 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.159145041923832 (code B ref 41011); Sat, 06 Jun 2020 13:34:02 +0000 Received: (at 41011) by debbugs.gnu.org; 6 Jun 2020 13:33:39 +0000 Received: from localhost ([127.0.0.1]:51077 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jhYx8-0006CK-Ce for submit@debbugs.gnu.org; Sat, 06 Jun 2020 09:33:38 -0400 Received: from vsmx012.vodafonemail.xion.oxcs.net ([153.92.174.90]:33582) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jhYx7-0006C8-2g for 41011@debbugs.gnu.org; Sat, 06 Jun 2020 09:33:37 -0400 Received: from vsmx004.vodafonemail.xion.oxcs.net (unknown [192.168.75.198]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTP id 89823F34E34; Sat, 6 Jun 2020 13:33:31 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [145.254.41.70]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTPA id F02CD19ADB0; Sat, 6 Jun 2020 13:33:26 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: Date: Sat, 6 Jun 2020 15:33:26 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <87h7w7cc55.fsf@gnu.org> <92DB8E2B-1CA2-41AE-9265-53C4F5337686@vodafonemail.de> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/bootloader/grub.scm (grub-efi-net-bootloader): New efi bootloader = for network booting via tftp/nfs. (install-grub-efi-net): New bootloader installer for tftp. (grub-root-search): Adding support for tftp root. (eye-candy): Use 'gfxterm' for all systems if selected via = 'terminal-outputs'. * gnu/system.scm (read-boot-parameters): Prevent devices with ":/" from = being treated as a file system label. * gnu/build/linux-boot.scm (device-string->file-system-device): Prevent = devices with ":/" from being treated as a file system label. --- gnu/bootloader/grub.scm | 127 +++++++++++++++++++++++++++------------ gnu/build/linux-boot.scm | 1 + gnu/system.scm | 3 +- 3 files changed, 93 insertions(+), 38 deletions(-) diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index 2d9a39afc3..60b3a12037 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -23,7 +23,7 @@ =20 (define-module (gnu bootloader grub) #:use-module (guix records) - #:use-module ((guix utils) #:select (%current-system)) + #:use-module ((guix utils) #:select (%current-system = %current-target-system)) #:use-module (guix gexp) #:use-module (gnu artwork) #:use-module (gnu bootloader) @@ -47,6 +47,8 @@ =20 grub-bootloader grub-efi-bootloader + make-grub-efi-net-bootloader + grub-efi-net-bootloader grub-mkrescue-bootloader grub-minimal-bootloader =20 @@ -135,41 +137,25 @@ file with the resolution provided in CONFIG." (_ #f))))) =20 (define* (eye-candy config store-device store-mount-point - #:key store-directory-prefix system port) + #:key store-directory-prefix port) "Return a gexp that writes to PORT (a port-valued gexp) the = 'grub.cfg' part concerned with graphics mode, background images, colors, and all that. STORE-DEVICE designates the device holding the store, and = STORE-MOUNT-POINT is its mount point; these are used to determine where the background image = and -fonts must be searched for. SYSTEM must be the target system = string---e.g., -\"x86_64-linux\". STORE-DIRECTORY-PREFIX is a directory prefix to = prepend to -any store file name." - (define setup-gfxterm-body - (let ((gfxmode - (or (and-let* ((theme (bootloader-configuration-theme = config)) - (gfxmode (grub-theme-gfxmode theme))) - (string-join gfxmode ";")) - "auto"))) - - ;; Intel and EFI systems need to be switched into graphics mode, = whereas - ;; most other modern architectures have no other mode and = therefore - ;; don't need to be switched. - - ;; XXX: Do we really need to restrict to x86 systems? We could = imitate - ;; what the GRUB default configuration does and decide based on = whether - ;; a user provided 'gfxterm' in the terminal-outputs field of = their - ;; bootloader-configuration record. - (if (string-match "^(x86_64|i[3-6]86)-" system) - (format #f " - set gfxmode=3D~a - insmod all_video - insmod gfxterm~%" gfxmode) - ""))) - +fonts must be searched for. STORE-DIRECTORY-PREFIX is a directory = prefix to +prepend to any store file name." (define (setup-gfxterm config font-file) (if (memq 'gfxterm (bootloader-configuration-terminal-outputs = config)) - #~(format #f "if loadfont ~a; then - setup_gfxterm -fi~%" #+font-file) + #~(format #f " +if loadfont ~a; then + set gfxmode=3D~a + insmod all_video + insmod gfxterm +fi~%" + #$font-file + #$(string-join + (grub-theme-gfxmode (bootloader-theme config)) + ";")) "")) =20 (define (theme-colors type) @@ -190,8 +176,6 @@ fi~%" #+font-file) =20 (and image #~(format #$port " -function setup_gfxterm {~a} - # Set 'root' to the partition that contains /gnu/store. ~a =20 @@ -206,7 +190,6 @@ else set menu_color_normal=3Dcyan/blue set menu_color_highlight=3Dwhite/blue fi~%" - #$setup-gfxterm-body #$(grub-root-search store-device font-file) #$(setup-gfxterm config font-file) #$(grub-setup-io config) @@ -313,6 +296,9 @@ code." ((? file-system-label? label) (format #f "search --label --set ~a" (file-system-label->string label))) + ((? (lambda (device) + (and (string? device) (string-contains device ":/"))) = nfs-uri) + "set root=3D(tftp)") ((or #f (? string?)) #~(format #f "search --file --set ~a" #$file))))) =20 @@ -358,7 +344,6 @@ when booting a root file system on a Btrfs = subvolume." (menu-entry-device (first all-entries)) (menu-entry-device-mount-point (first all-entries)) #:store-directory-prefix store-directory-prefix - #:system system #:port #~port)) =20 (define keyboard-layout-config @@ -498,11 +483,73 @@ fi~%")))) "--bootloader-id=3DGuix" "--efi-directory" target-esp)))) =20 +(define (install-grub-efi-net subdir) + "Define a grub-efi bootloader installer for installation in SUBDIR, +which is usually \"efi/boot\" or \"efi/Guix\"." + (let* ((arch (car (string-split (or (%current-target-system) + (%current-system)) + #\-))) + (efi-bootloader-link (string-append "/boot" + (match arch + ("i686" "ia32") + ("x86_64" "x64") + ("arm" "arm") + ("armhf" "arm") + ("aarch64" "aa64") + ("riscv" "riscv32") + ("riscv64" "riscv64")) + ".efi")) + (efi-bootloader (string-append (match arch + ("i686" "i386") + ("x86_64" "x86_64") + ("arm" "arm") + ("armhf" "arm") + ("aarch64" "arm64") + ("riscv" "riscv32") + ("riscv64" "riscv64")) + "-efi/core.efi"))) + #~(lambda (bootloader target mount-point) + "Install GRUB as e.g. \"bootx64.efi\" or \"bootarm64.efi\" = \"into +SUBDIR, which is usually \"efi/boot\" or \"efi/Guix\" below the = directory TARGET +for the system whose root is mounted at MOUNT-POINT." + (let* (;; Use target-depth and subdir-depth to construct links = to + ;; "../gnu" and "../../../boot/grub/grub.cfg" with the = correct + ;; number of "../". Note: This doesn't consider ".." or = ".", + ;; which may appear inside target or subdir. + (target-depth (length (delete "" (string-split target = #\/)))) + (subdir-depth (length (delete "" (string-split #$subdir = #\/)))) + (up1 (string-join (make-list target-depth "..") "/" = 'suffix)) + (up2 (string-join (make-list subdir-depth "..") "/" = 'suffix)) + (net-dir (string-append mount-point target "/")) + (store-name (car (delete "" (string-split bootloader = #\/)))) + (store (string-append up1 store-name)) + (store-link (string-append net-dir store-name)) + (grub-cfg (string-append up1 up2 "boot/grub/grub.cfg")) + (grub-cfg-link (string-append net-dir #$subdir = "/grub.cfg")) + (efi-bootloader-link + (string-append net-dir #$subdir = #$efi-bootloader-link))) + ;; Tell 'grub-install' that there might be a LUKS-encrypted = /boot or + ;; root partition. + (setenv "GRUB_ENABLE_CRYPTODISK" "y") + (invoke/quiet (string-append bootloader "/bin/grub-mknetdir") + (string-append "--net-directory=3D" net-dir) + (string-append "--subdir=3D" #$subdir)) + (false-if-exception (delete-file store-link)) + (symlink store store-link) + (false-if-exception (delete-file grub-cfg-link)) + (symlink grub-cfg grub-cfg-link) + (false-if-exception (delete-file efi-bootloader-link)) + (symlink #$efi-bootloader efi-bootloader-link))))) + ^L =20 ;;; ;;; Bootloader definitions. ;;; +;;; For all these grub-bootloader variables the path to = /boot/grub/grub.cfg +;;; is fixed. Inheriting and overwriting the field = 'configuration-file' will +;;; break 'guix system delete-generations', 'guix system = switch-generation', +;;; and 'guix system roll-back'. =20 (define grub-bootloader (bootloader @@ -513,12 +560,12 @@ fi~%")))) (configuration-file "/boot/grub/grub.cfg") (configuration-file-generator grub-configuration-file))) =20 -(define* grub-minimal-bootloader +(define grub-minimal-bootloader (bootloader (inherit grub-bootloader) (package grub-minimal))) =20 -(define* grub-efi-bootloader +(define grub-efi-bootloader (bootloader (inherit grub-bootloader) (installer install-grub-efi) @@ -526,7 +573,13 @@ fi~%")))) (name 'grub-efi) (package grub-efi))) =20 -(define* grub-mkrescue-bootloader +(define grub-efi-net-bootloader + (bootloader + (inherit grub-efi-bootloader) + (name 'grub-efi-net-bootloader) + (installer (install-grub-efi-net "efi/boot")))) + +(define grub-mkrescue-bootloader (bootloader (inherit grub-efi-bootloader) (package grub-hybrid))) diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm index f08bb11514..3a79cfd461 100644 --- a/gnu/build/linux-boot.scm +++ b/gnu/build/linux-boot.scm @@ -503,6 +503,7 @@ upon error." ;; string, but the string can represent a device, a UUID, or a ;; label. So check for all three. (cond ((string-prefix? "/" device-string) device-string) + ((string-contains device-string ":/") device-string) ((uuid device-string) =3D> identity) (else (file-system-label device-string)))) =20 diff --git a/gnu/system.scm b/gnu/system.scm index ac8bbd1d16..91caba7012 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -301,7 +301,8 @@ file system labels." ((? string? device) ;; It used to be that we would not distinguish between labels = and ;; device names. Try to infer the right thing here. - (if (string-prefix? "/dev/" device) + (if (or (string-prefix? "/dev/" device) + (string-contains device ":/")) ; nfs device (file-system-label device))))) =20 --=20 2.26.0 From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 06 Jun 2020 17:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Stefan Cc: Mathieu Othacehe , 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.159146504923061 (code B ref 41011); Sat, 06 Jun 2020 17:38:01 +0000 Received: (at 41011) by debbugs.gnu.org; 6 Jun 2020 17:37:29 +0000 Received: from localhost ([127.0.0.1]:52374 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jhcl7-0005zt-9p for submit@debbugs.gnu.org; Sat, 06 Jun 2020 13:37:29 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:45584) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jhcl5-0005zi-Dn for 41011@debbugs.gnu.org; Sat, 06 Jun 2020 13:37:27 -0400 Received: from localhost (80-110-127-207.cgn.dynamic.surfer.at [80.110.127.207]) by dd26836.kasserver.com (Postfix) with ESMTPSA id A125B3363C0E; Sat, 6 Jun 2020 19:37:25 +0200 (CEST) Date: Sat, 6 Jun 2020 19:37:21 +0200 From: Danny Milosavljevic Message-ID: <20200606193721.1e126131@scratchpost.org> In-Reply-To: References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <87h7w7cc55.fsf@gnu.org> <92DB8E2B-1CA2-41AE-9265-53C4F5337686@vodafonemail.de> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/F5TTtvLub=JWi_mA4=wiXI_"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/F5TTtvLub=JWi_mA4=wiXI_ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Stefan, thanks for the patch! Could you create a new record type (something like ) and use that instead of magical ":/" where possible (i.e. everywhere except gnu/build/linux-boot.scm)? See also ./gnu/system/file-systems.scm file-system-label for how that is do= ne (just copy the record and the serializer for the initrd parameter and adapt= it). I know that previously we did magical string parsing, but I'd like not to a= dd to it. Also, is the eye-candy change necessary? I'm not opposed to it, but it would be nicer in an extra patch (separation of concerns), if necessary in this patch series. --Sig_/F5TTtvLub=JWi_mA4=wiXI_ Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl7b1FEACgkQ5xo1VCww uqWdIAf9F7rc8PLZJ995FWstvguFTymM7SI9NgsvNN6hGBHpnkHZoqmOdsAd6I63 wuMbVdNRtiiz+1YcRvQKhYEpn0wllqlhJgh5X0f4rSHx8JiKx3L6FxiIXqbuN596 ilwAafrPDHP362Chr9AdcmR9QuaNPm+8X1KRAloPzGKjWCR2WNGDwRKvQovnYeYt noIx7+zftkEPdbkRPvcFMGHBWoRwZIlEkdDDcjzf3U55juVCkcWQBAkyUxsOafSI CHr9O+osy+HRe7BzOUmKpl9C2p5wUuDCigutcDPD/TMgDl32RuCSPvBwKRDiNbEl 3FVYwYfgZeAvkZ/IeOpxp4IJM3kk2w== =cGOU -----END PGP SIGNATURE----- --Sig_/F5TTtvLub=JWi_mA4=wiXI_-- From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 09 Jun 2020 13:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Stefan , Maxim Cournoyer , 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.15917102503295 (code B ref 41011); Tue, 09 Jun 2020 13:45:01 +0000 Received: (at 41011) by debbugs.gnu.org; 9 Jun 2020 13:44:10 +0000 Received: from localhost ([127.0.0.1]:59319 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jieXx-0000r4-Lt for submit@debbugs.gnu.org; Tue, 09 Jun 2020 09:44:09 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:54230) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jieXw-0000qw-3c for 41011@debbugs.gnu.org; Tue, 09 Jun 2020 09:44:08 -0400 Received: from localhost (80-110-127-207.cgn.dynamic.surfer.at [80.110.127.207]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 543DB3360C41; Tue, 9 Jun 2020 15:44:06 +0200 (CEST) Date: Tue, 9 Jun 2020 15:44:00 +0200 From: Danny Milosavljevic Message-ID: <20200609154400.4c7d2f90@scratchpost.org> In-Reply-To: <46CD97B3-9994-4AB7-AA7D-4DE39AB7A238@vodafonemail.de> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <87h7w7cc55.fsf@gnu.org> <92DB8E2B-1CA2-41AE-9265-53C4F5337686@vodafonemail.de> <20200606193721.1e126131@scratchpost.org> <46CD97B3-9994-4AB7-AA7D-4DE39AB7A238@vodafonemail.de> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/VxRwEO7N=R4ZOGmZunm7bnt"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/VxRwEO7N=R4ZOGmZunm7bnt Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Stefan, On Tue, 9 Jun 2020 14:16:18 +0200 Stefan wrote: > I made your requested change (using ), but when trying a 'guix= system reconfigure =E2=80=A6' I only get this error: >=20 > guix system: error: #: invalid G-expre= ssion input >=20 > There is no backtrace, no nothing. I can=E2=80=99t figure out, which part= of the code tries to read this serialisation. Do you have a clue? I think it's a problem in the transfer of the record from host side to build side, in this case mostly via Linux kernel command line arguments, which are strings. The host side code can use these records, but eventually the build side code has to get a string and reconstruct it. I don't know how to debug it except for running the translation in my head. The error reporting facility could be improved a lot :( gnu/build/linux-boot.scm is build side. It runs when the system boots. In there it has=20 (define (device-string->file-system-device device-string) ;; The "--root=3DSPEC" kernel command-line option always provides a ;; string, but the string can represent a device, a UUID, a ;; label or a NFS spec. So check for all three. (cond ((string-prefix? "/" device-string) device-string) ((uuid device-string) =3D> identity) (else (file-system-label device-string)))) But looking at the condition (uuid device-string) I have no idea what that = means, or is bound to! It was introduced by: commit 281d80d8e547fe663aaacb3226119166dd3100f9 Author: Maxim Cournoyer Date: Tue Feb 11 14:00:06 2020 -0500 linux-boot: Refactor boot-system. =20 The --root option can now be omitted, and inferred from the root file s= ystem declaration instead. =20 * gnu/build/file-systems.scm (canonicalize-device-spec): Extend to supp= ort NFS directly, and... * gnu/build/linux-boot.scm (boot-system): ...remove NFS special casing = from here. Remove nested definitions for root-fs-type, root-fs-flags and root-fs-options, and bind those inside the let* instead. Make "--root"= take precedence over the device field string representation of the root file system. * doc/guix.texi (Initial RAM Disk): Document that "--root" can be left unspecified. If "--root" is not specified, it should then pick up the root from the root file system declaration.=20 @Maxim: How can we use your commit to boot from NFS? I see no way to leave "--root" off in the first place for a regular user. (Stefan's patch adds support for network boot via tftp/nfs via grub efi net)=20 Cheers, Danny --Sig_/VxRwEO7N=R4ZOGmZunm7bnt Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl7fkiAACgkQ5xo1VCww uqX71gf/a8PRw3iuSmnX/aC9ieouLHa9StvvcwSHYIR/9fFzpklaMG/r+vQ2JPt8 2qV1HU09f9AQpVIlrUI7WjDD2Y4ydhtwmOxlYA3vz8kdAUoPpyAgI7tKxAW3pKGK xiM/qLdQvenu385e7iNT0DylZrAC01OoeQ7FPfsDaHIgNGsyWVdZ9aa49jdTtK+f B4swxxauqg0JzxrAemluNisnIMB65v9/1pTbQ1WIv/PtYEqx/VU5uqlsidO9B0B0 SmaUxG9DY6Cz1kK1cApVJtNQ4DDa923fZsuOHD+bYZEY2qhdYJM+KNzdkvZAQEnO 0I68udFPk5eox6zJ4nhUXXAQZJ+BqQ== =U3/C -----END PGP SIGNATURE----- --Sig_/VxRwEO7N=R4ZOGmZunm7bnt-- From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 09 Jun 2020 14:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Cc: 41011@debbugs.gnu.org, Maxim Cournoyer Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.15917127598710 (code B ref 41011); Tue, 09 Jun 2020 14:26:01 +0000 Received: (at 41011) by debbugs.gnu.org; 9 Jun 2020 14:25:59 +0000 Received: from localhost ([127.0.0.1]:60526 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jifCQ-0002GQ-PJ for submit@debbugs.gnu.org; Tue, 09 Jun 2020 10:25:58 -0400 Received: from mx009.vodafonemail.xion.oxcs.net ([153.92.174.39]:55732) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jifCO-0002GA-8y for 41011@debbugs.gnu.org; Tue, 09 Jun 2020 10:25:57 -0400 Received: from vsmx002.vodafonemail.xion.oxcs.net (unknown [192.168.75.192]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTP id F17AE60408D; Tue, 9 Jun 2020 14:25:49 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [2.206.141.235]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 720C6602CE3; Tue, 9 Jun 2020 14:25:43 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <20200609154400.4c7d2f90@scratchpost.org> Date: Tue, 9 Jun 2020 16:25:41 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <691A5892-A7FB-41E0-BEBA-0B345A5D8945@vodafonemail.de> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <87h7w7cc55.fsf@gnu.org> <92DB8E2B-1CA2-41AE-9265-53C4F5337686@vodafonemail.de> <20200606193721.1e126131@scratchpost.org> <46CD97B3-9994-4AB7-AA7D-4DE39AB7A238@vodafonemail.de> <20200609154400.4c7d2f90@scratchpost.org> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi! > Am 09.06.2020 um 15:44 schrieb Danny Milosavljevic = : >=20 > gnu/build/linux-boot.scm is build side. It runs when the system = boots. >=20 > In there it has=20 >=20 > (define (device-string->file-system-device device-string) > ;; The "--root=3DSPEC" kernel command-line option always provides a > ;; string, but the string can represent a device, a UUID, a > ;; label or a NFS spec. So check for all three. > (cond ((string-prefix? "/" device-string) device-string) > ((uuid device-string) =3D> identity) > (else (file-system-label device-string)))) Yes, that code runs when the system boots. But in my case the error is = thrown already during the reconfigure itself. The trouble must be way = before.=20 Bye Stefan= From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 11 Jun 2020 04:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Cc: Stefan , 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.1591849280567 (code B ref 41011); Thu, 11 Jun 2020 04:22:01 +0000 Received: (at 41011) by debbugs.gnu.org; 11 Jun 2020 04:21:20 +0000 Received: from localhost ([127.0.0.1]:35767 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjEiO-000094-E1 for submit@debbugs.gnu.org; Thu, 11 Jun 2020 00:21:20 -0400 Received: from mail-qv1-f66.google.com ([209.85.219.66]:45208) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjEiM-00008q-8C for 41011@debbugs.gnu.org; Thu, 11 Jun 2020 00:21:19 -0400 Received: by mail-qv1-f66.google.com with SMTP id di13so2093781qvb.12 for <41011@debbugs.gnu.org>; Wed, 10 Jun 2020 21:21:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=nHxE/uxiUPpq30Z+2+erb4DZKoloHm0/+s6fRvq/f+E=; b=jsYA7nfjCIHw4ZhaRKbdKbMZBiVprJsvKHcDXyGToHkDkVjQWOM5AcxRBDboLV25eM NdtBtA1jd112KGSeCCvhQhFMGLszlW1OD7haXV4MhUr+jMb/1/QNYoKiNrvf/g95/zsV F/augQEgG/gS+o2wpmvHGc8f+l1xXQp2GzsraFsbHeGO3v4KfTWJtUW44snXqcdYhkSV RlK1ELe0MOXxWbIps8I/59AXQdpOSXD7nEYaziu1bPDmeqXAKdrchvEr/rQNaqLrQGXi fHPsqpJ74QAmu2k5HDIF9QKxFBYMDjPCei6iqwJ7DRKigf05+gOGKkU99UDq8O+rfEsu 7hnQ== 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:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=nHxE/uxiUPpq30Z+2+erb4DZKoloHm0/+s6fRvq/f+E=; b=lwWCKJO0XyJWqHoX5TifDXY5r1WSnpuRE5khY9yEluFjTiJ0Rwvoxuxo++nWjJaTl9 5R5K1w/0xXpIKZXM9NTKudA5dVN1Y0g0K9ZpesPf4+mYG1UzmfoVkWhqRoT8xyKqNBB/ hpK0enNsspJik6o/a1JVa4Fdm8MwjVIKnbPLpccpqn7chC6OOH1+Pe1qjSPcKjB6slFP +U5sNJZN37Cn7xY6kJXdvjej2J4RsRuGGBMfwykwwV6hmlFOUstq0IGoH1VKhgXsGNnL DvtGFYiWQolE3ynsxe/S7j08jYguJcUoMRuKpX1qhtONSHRWG2H/F9XmvM2Kko7bLKDJ 6s9A== X-Gm-Message-State: AOAM5307fGjq2b097Y95YQLr2aeJnej40nbLbeaoWvVaNuDM1BeZiUba s4KVYSk2OVMEoGLYEnq3F36wgPZ2uvM= X-Google-Smtp-Source: ABdhPJxYAhLKHR3RvWGVUYRXBNMkn0VmoJvkzIlrsPecBBjnz0D8lHCakaGgjjJZ82FMc6Xq71OSVg== X-Received: by 2002:ad4:556e:: with SMTP id w14mr6173232qvy.137.1591849272479; Wed, 10 Jun 2020 21:21:12 -0700 (PDT) Received: from hurd (dsl-10-134-63.b2b2c.ca. [72.10.134.63]) by smtp.gmail.com with ESMTPSA id q24sm1455777qkj.103.2020.06.10.21.21.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2020 21:21:11 -0700 (PDT) From: Maxim Cournoyer References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <87h7w7cc55.fsf@gnu.org> <92DB8E2B-1CA2-41AE-9265-53C4F5337686@vodafonemail.de> <20200606193721.1e126131@scratchpost.org> <46CD97B3-9994-4AB7-AA7D-4DE39AB7A238@vodafonemail.de> <20200609154400.4c7d2f90@scratchpost.org> Date: Thu, 11 Jun 2020 00:21:11 -0400 In-Reply-To: <20200609154400.4c7d2f90@scratchpost.org> (Danny Milosavljevic's message of "Tue, 9 Jun 2020 15:44:00 +0200") Message-ID: <87bllqi66g.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello Danny, Danny Milosavljevic writes: > Hi Stefan, > > On Tue, 9 Jun 2020 14:16:18 +0200 > Stefan wrote: > >> I made your requested change (using ), but when trying a 'gui= x system reconfigure =E2=80=A6' I only get this error: >>=20 >> guix system: error: #: invalid G-expr= ession input >>=20 >> There is no backtrace, no nothing. I can=E2=80=99t figure out, which par= t of the code tries to read this serialisation. Do you have a clue? > > I think it's a problem in the transfer of the record from host side to bu= ild > side, in this case mostly via Linux kernel command line arguments, which = are > strings. > > The host side code can use these records, but eventually the build side c= ode > has to get a string and reconstruct it. > > I don't know how to debug it except for running the translation in my hea= d. > The error reporting facility could be improved a lot :( > > gnu/build/linux-boot.scm is build side. It runs when the system boots. > > In there it has=20 > > (define (device-string->file-system-device device-string) > ;; The "--root=3DSPEC" kernel command-line option always provides a > ;; string, but the string can represent a device, a UUID, a > ;; label or a NFS spec. So check for all three. > (cond ((string-prefix? "/" device-string) device-string) > ((uuid device-string) =3D> identity) > (else (file-system-label device-string)))) > > But looking at the condition (uuid device-string) I have no idea what tha= t means, > or is bound to! It means that if the device-string (a string as its name imply) contains something that represent a UUID, return its corresponding UUID object. `uuid' comes from (gnu system uuid). Does that answer your question? > It was introduced by: > > commit 281d80d8e547fe663aaacb3226119166dd3100f9 > Author: Maxim Cournoyer > Date: Tue Feb 11 14:00:06 2020 -0500 > > linux-boot: Refactor boot-system. >=20=20=20=20=20 > The --root option can now be omitted, and inferred from the root file= system > declaration instead. >=20=20=20=20=20 > * gnu/build/file-systems.scm (canonicalize-device-spec): Extend to su= pport NFS > directly, and... > * gnu/build/linux-boot.scm (boot-system): ...remove NFS special casin= g from > here. Remove nested definitions for root-fs-type, root-fs-flags and > root-fs-options, and bind those inside the let* instead. Make "--roo= t" take > precedence over the device field string representation of the root fi= le > system. > * doc/guix.texi (Initial RAM Disk): Document that "--root" can be left > unspecified. > > If "--root" is not specified, it should then pick up the root from the ro= ot > file system declaration.=20 > > @Maxim: How can we use your commit to boot from NFS? I see no way to lea= ve > "--root" off in the first place for a regular user. (Stefan's patch adds > support for network boot via tftp/nfs via grub efi net)=20 This commit just makes it so that if --root was ever removed from the generated GRUB configuration, it'd still be able to find it automatically. It was added to be consistent with the fact that mount options are automatically taken from the root file system without any user option (and I initially had a rootflags user option but this was deemed unnecessary at the time). I'll probably add it back soon now that I've found a valid use case for it (passing the 'degraded' mount option for booting from a degraded Btrfs RAID is one). Does it cause a problem for the NFS boot via 'grub efi net' (I know nothing about it -- any link for a recommended reading?) When booting from NFS using the nfsroot Linux option, it's possible to specify a '/dev/nfs' as the root kernel parameter. /dev/nfs is not a real block device, it's just a stub hinting the kernel that its root file system is on NFS. Perhaps that can be used? Maxim From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 11 Jun 2020 11:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxim Cournoyer , Danny Milosavljevic Cc: 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.159187540128565 (code B ref 41011); Thu, 11 Jun 2020 11:37:01 +0000 Received: (at 41011) by debbugs.gnu.org; 11 Jun 2020 11:36:41 +0000 Received: from localhost ([127.0.0.1]:36138 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjLVg-0007Qf-SH for submit@debbugs.gnu.org; Thu, 11 Jun 2020 07:36:40 -0400 Received: from vsmx012.vodafonemail.xion.oxcs.net ([153.92.174.90]:6339) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjLVg-0007QL-09 for 41011@debbugs.gnu.org; Thu, 11 Jun 2020 07:36:40 -0400 Received: from vsmx004.vodafonemail.xion.oxcs.net (unknown [192.168.75.198]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTP id 77588F35060; Thu, 11 Jun 2020 11:36:33 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [145.254.41.74]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTPA id EF9BC19B446; Thu, 11 Jun 2020 11:36:26 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <87bllqi66g.fsf@gmail.com> Date: Thu, 11 Jun 2020 13:36:26 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <87h7w7cc55.fsf@gnu.org> <92DB8E2B-1CA2-41AE-9265-53C4F5337686@vodafonemail.de> <20200606193721.1e126131@scratchpost.org> <46CD97B3-9994-4AB7-AA7D-4DE39AB7A238@vodafonemail.de> <20200609154400.4c7d2f90@scratchpost.org> <87bllqi66g.fsf@gmail.com> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi! I found the root-cause of my problem: I missed a conversion in = gnu/system.scm (device-sexp). Sorry for the noise. Bye Stefan= From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 11 Jun 2020 13:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Stefan Cc: Danny Milosavljevic , 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.15918808505326 (code B ref 41011); Thu, 11 Jun 2020 13:08:02 +0000 Received: (at 41011) by debbugs.gnu.org; 11 Jun 2020 13:07:30 +0000 Received: from localhost ([127.0.0.1]:36288 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjMvZ-0001Np-Ka for submit@debbugs.gnu.org; Thu, 11 Jun 2020 09:07:29 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:36490) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjMvX-0001Nd-Lf for 41011@debbugs.gnu.org; Thu, 11 Jun 2020 09:07:28 -0400 Received: by mail-qk1-f194.google.com with SMTP id 205so5453436qkg.3 for <41011@debbugs.gnu.org>; Thu, 11 Jun 2020 06:07:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=oDGHVki3bAHYk64w+kdpHXKirpcY6ok5VoJUFYabgBo=; b=af21CWwtSOSczN6JGfMnSDp8DOGnNVOyhVYLvOoaG2x9q1jzeQxQIkyBVXBRkWPOiV shJRK/bizOgHrx4rc+DZ6NK7HGWL9S1+yi7DX+jMFN/Raz28s1E6RM9oiNDqSOMbvVA+ 6yDSzEu4Ck5abh4T3islBx2rHYTmaupqbCnVts2sFwYwutmaepWgTkJDwHtFr3xENvgf 2eX8zgtnv9ha+sZhceMzoq2WNE6NmmLk/CTt09aUe5eSLWWKTeV16gNgJcgjQyUeWQsS kfuKgpESi99d6XZpoYDsfyR/NgQY2csTwqYrLFPdicePjL07Z5SfLitBo2mysfNXgeUB uKpQ== 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:references:date:in-reply-to :message-id:user-agent:mime-version; bh=oDGHVki3bAHYk64w+kdpHXKirpcY6ok5VoJUFYabgBo=; b=kjdbe+Q/zBs2ze/SesOblhNrKVFb1s9zkLxDFk84hnHkYWHQ0hLoNpVW6nVnjMeo16 daL7oUkOlYwWdmtCeG7lJ7bf/FCPwhV3og6kQuSsFHPs4c2WOttdWztjGgIzoYL9Bi5J 6Fy8EZvgc151NiZ89gdsoR6sgtYChgp6ux+59QktlYqj9zyZemrkwv6O/aj8nEQXwhQk fbdLiW5ZrvFuRkiEwXqN4LW0VJNdxTJOXiFevza6GjroqVo8nZJ5bu9aea8gUJnSvRzI 0Fn6JhxXQvCgdQNkQvsjlIPthN5mlLNHaxofQBV8BaiqOkHrCyfe43zkFhQr2y/S2Hpq cUIg== X-Gm-Message-State: AOAM5314yEysz92gbNcVnuW4ywnArzy5n4w1/dWQt4+LuLBrNq5CVqIS IUADZdS/BqxEa05y6cdXPV2ZbHPz X-Google-Smtp-Source: ABdhPJwpXoeMHIgIaZcG6D57i2KLYd+6F0ns6nhqIIVXbUKM+kQJn23gnd7kRdha6n0x0bhc/ZMiRw== X-Received: by 2002:a37:74c5:: with SMTP id p188mr8379257qkc.435.1591880841797; Thu, 11 Jun 2020 06:07:21 -0700 (PDT) Received: from hurd (dsl-10-149-60.b2b2c.ca. [72.10.149.60]) by smtp.gmail.com with ESMTPSA id e53sm2441070qtk.50.2020.06.11.06.07.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jun 2020 06:07:21 -0700 (PDT) From: Maxim Cournoyer References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <87h7w7cc55.fsf@gnu.org> <92DB8E2B-1CA2-41AE-9265-53C4F5337686@vodafonemail.de> <20200606193721.1e126131@scratchpost.org> <46CD97B3-9994-4AB7-AA7D-4DE39AB7A238@vodafonemail.de> <20200609154400.4c7d2f90@scratchpost.org> <87bllqi66g.fsf@gmail.com> Date: Thu, 11 Jun 2020 09:07:20 -0400 In-Reply-To: (Stefan's message of "Thu, 11 Jun 2020 13:36:26 +0200") Message-ID: <87h7vhda47.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Stefan, Stefan writes: > Hi! > > I found the root-cause of my problem: I missed a conversion in gnu/system.scm (device-sexp). Sorry for the noise. No worries; thanks for working on bettering NFS support! Maxim From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 11 Jun 2020 13:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxim Cournoyer , Stefan Cc: 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.15918815846594 (code B ref 41011); Thu, 11 Jun 2020 13:20:01 +0000 Received: (at 41011) by debbugs.gnu.org; 11 Jun 2020 13:19:44 +0000 Received: from localhost ([127.0.0.1]:36318 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjN7Q-0001iI-Gf for submit@debbugs.gnu.org; Thu, 11 Jun 2020 09:19:44 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:38834) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjN7O-0001i8-EL for 41011@debbugs.gnu.org; Thu, 11 Jun 2020 09:19:42 -0400 Received: from localhost (80-110-127-207.cgn.dynamic.surfer.at [80.110.127.207]) by dd26836.kasserver.com (Postfix) with ESMTPSA id DC24633653F5; Thu, 11 Jun 2020 15:19:39 +0200 (CEST) Date: Thu, 11 Jun 2020 15:19:37 +0200 From: Danny Milosavljevic Message-ID: <20200611151937.204ad14d@scratchpost.org> In-Reply-To: <87bllqi66g.fsf@gmail.com> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <87h7w7cc55.fsf@gnu.org> <92DB8E2B-1CA2-41AE-9265-53C4F5337686@vodafonemail.de> <20200606193721.1e126131@scratchpost.org> <46CD97B3-9994-4AB7-AA7D-4DE39AB7A238@vodafonemail.de> <20200609154400.4c7d2f90@scratchpost.org> <87bllqi66g.fsf@gmail.com> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/=am4l1_r3KS5=990uDgH02q"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/=am4l1_r3KS5=990uDgH02q Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Maxim, Hi Stefan, On Thu, 11 Jun 2020 00:21:11 -0400 Maxim Cournoyer wrote: > > (define (device-string->file-system-device device-string) > > ;; The "--root=3DSPEC" kernel command-line option always provides a > > ;; string, but the string can represent a device, a UUID, a > > ;; label or a NFS spec. So check for all three. > > (cond ((string-prefix? "/" device-string) device-string) > > ((uuid device-string) =3D> identity) > > (else (file-system-label device-string)))) > > > > But looking at the condition (uuid device-string) I have no idea what t= hat means, > > or is bound to! =20 >=20 > It means that if the device-string (a string as its name imply) contains > something that represent a UUID, return its corresponding UUID object. > `uuid' comes from (gnu system uuid). Does that answer your question? Oh! I've looked at now it but I still don't get it. How can that be a cond condition? Or asked differently, what if device-string does not represent an uuid, how come device-string->file-system-device does not enter the branch "=3D> iden= tity" ? > Does it cause a problem for the NFS boot via 'grub efi net' (I know > nothing about it -- any link for a recommended reading?) https://manpages.debian.org/testing/grub-common/grub-mknetdir.1.en.html Stefan has written a patch supporting it for Guix. (canonicalize-device-spec seems to expect a nfs share reference to be a string, too. Is that on purpose? No record? That's kinda weird when we even have records for device labels and uuids--but we don't have them for something that's actually complicated to specify? [1] :) ) > When booting > from NFS using the nfsroot Linux option, it's possible to specify a > '/dev/nfs' as the root kernel parameter. /dev/nfs is not a real block > device, it's just a stub hinting the kernel that its root file system is > on NFS. Perhaps that can be used? Hmm maybe. @Stefan? Also, could we have a system test testing this stuff? I can write the actual test--but could you tell me how to use the functionality introduced in this patch? [1] Reference docs for nfsroot: https://www.kernel.org/doc/Documentation/fi= lesystems/nfs/nfsroot.txt --Sig_/=am4l1_r3KS5=990uDgH02q Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl7iL2kACgkQ5xo1VCww uqXN3wgAn8JB7+NEMcj4kYz5P3wt2PSEz1rA5gml4ezMk3avxKkjZBLO+r3/7IR7 94PziwFb/6uRtIOxoPOsEzp1Al5bqLuHzwkcAvDx62VxKdrpyOkY8oBDnIPA/3sv MLwDe2SLYYZQDtO/Gyz6s+TaZvokU3ReJ0Er38qefrPRGKYyXD0pvOcX/SkTheeN Kun//ZBYCgOeYoMEzL1UYGdCn/tlmI97xV1QVQdlzgaUwAtPbBkOeZxY9x1xpVOu SOPiVVNasFMXKcabVm6lLY/bcy99kKXeNrv7doXtCPhF1sMCxHRknQDsTboxANMH J41lDBecMq137USle5K7WTR3FyQeLQ== =zDkN -----END PGP SIGNATURE----- --Sig_/=am4l1_r3KS5=990uDgH02q-- From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 12 Jun 2020 00:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxim Cournoyer Cc: Danny Milosavljevic , 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.159192040325019 (code B ref 41011); Fri, 12 Jun 2020 00:07:01 +0000 Received: (at 41011) by debbugs.gnu.org; 12 Jun 2020 00:06:43 +0000 Received: from localhost ([127.0.0.1]:38417 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjXDW-0006VP-P7 for submit@debbugs.gnu.org; Thu, 11 Jun 2020 20:06:43 -0400 Received: from mx009.vodafonemail.xion.oxcs.net ([153.92.174.39]:25787) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjXDV-0006VB-A0 for 41011@debbugs.gnu.org; Thu, 11 Jun 2020 20:06:41 -0400 Received: from vsmx002.vodafonemail.xion.oxcs.net (unknown [192.168.75.192]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTP id 164B6605119; Fri, 12 Jun 2020 00:06:35 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [145.254.41.74]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTPA id A4740605118; Fri, 12 Jun 2020 00:06:28 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <87bllqi66g.fsf@gmail.com> Date: Fri, 12 Jun 2020 02:06:27 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <87h7w7cc55.fsf@gnu.org> <92DB8E2B-1CA2-41AE-9265-53C4F5337686@vodafonemail.de> <20200606193721.1e126131@scratchpost.org> <46CD97B3-9994-4AB7-AA7D-4DE39AB7A238@vodafonemail.de> <20200609154400.4c7d2f90@scratchpost.org> <87bllqi66g.fsf@gmail.com> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Maxim! > Does it cause a problem for the NFS boot via 'grub efi net' (I know > nothing about it -- any link for a recommended reading?) No, that=E2=80=99s no problem. Regarding =E2=80=98grub efi net=E2=80=99: Just take a look at the GRUB = manual. Actually GRUB is not dealing with NFS at all, it is using TFTP = to load files. Only Linux uses NFS to mount its root file system.=20 > When booting > from NFS using the nfsroot Linux option, it's possible to specify a > '/dev/nfs' as the root kernel parameter. /dev/nfs is not a real block > device, it's just a stub hinting the kernel that its root file system = is > on NFS. Perhaps that can be used? These =E2=80=9Croot=3D/dev/nfs rootfstype=3Dnfs nfsroot=3D=E2=80=A6 = ip=3D=E2=80=A6=E2=80=9D kernel arguments only make sense if an initrd = can be omitted. Either the initrd or such a root-nfs becomes the root = file system at startup. As the guix system is currently relying on an = initrd, this is not an option. Further you would need to ensure that certain CONFIG_NFS=E2=80=A6, = CONFIG_IP=E2=80=A6 and even more options for your network interface are = set to =E2=80=98=3Dy=E2=80=99 to ensure that Linux can make use of an = nfs-root. Bye Stefan= From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 12 Jun 2020 14:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Cc: 41011@debbugs.gnu.org, Maxim Cournoyer Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.159197288619888 (code B ref 41011); Fri, 12 Jun 2020 14:42:02 +0000 Received: (at 41011) by debbugs.gnu.org; 12 Jun 2020 14:41:26 +0000 Received: from localhost ([127.0.0.1]:40407 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjks2-0005Ai-Df for submit@debbugs.gnu.org; Fri, 12 Jun 2020 10:41:26 -0400 Received: from vsmx009.vodafonemail.xion.oxcs.net ([153.92.174.87]:42994) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjkrz-0005AS-EI for 41011@debbugs.gnu.org; Fri, 12 Jun 2020 10:41:24 -0400 Received: from vsmx001.vodafonemail.xion.oxcs.net (unknown [192.168.75.191]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTP id D2397159E3BD; Fri, 12 Jun 2020 14:41:16 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [145.254.41.74]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 35102159D105; Fri, 12 Jun 2020 14:41:08 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <20200611151937.204ad14d@scratchpost.org> Date: Fri, 12 Jun 2020 16:41:07 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <7B2DD68D-AD33-4D82-B375-78097A326E13@vodafonemail.de> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <87h7w7cc55.fsf@gnu.org> <92DB8E2B-1CA2-41AE-9265-53C4F5337686@vodafonemail.de> <20200606193721.1e126131@scratchpost.org> <46CD97B3-9994-4AB7-AA7D-4DE39AB7A238@vodafonemail.de> <20200609154400.4c7d2f90@scratchpost.org> <87bllqi66g.fsf@gmail.com> <20200611151937.204ad14d@scratchpost.org> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Danny! > (canonicalize-device-spec seems to expect a nfs share reference to be = a > string, too. Is that on purpose? No record? That's = kinda > weird when we even have records for device labels and uuids--but we = don't > have them for something that's actually complicated to specify? [1] :) = ) I think you are already able today to specify a (file-system (type = "nfs") (device "my-server:/srv/nfs/music") =E2=80=A6). It is just not = sufficient yet for an NFS root file system. And using this style is = still possible. Therefore I started to use a simple string for an NFS share, too. That = canonicalize-device-spec expects a string is due to an older patch from = me in (boot-system), which Maxim moved from there. Actually I see a difference between an NFS share and a file system label = and an UUID, and this is (file-system (type =E2=80=A6) =E2=80=A6). If = you specify for example "ext4" or "btrfs" the =E2=80=98device=E2=80=99 = field can still have multiple representations, whereas for the type = "nfs" the device field can only have one representation. >> When booting >> from NFS using the nfsroot Linux option, it's possible to specify a >> '/dev/nfs' as the root kernel parameter. /dev/nfs is not a real = block >> device, it's just a stub hinting the kernel that its root file system = is >> on NFS. Perhaps that can be used? >=20 > Hmm maybe. @Stefan? As explained in another e-mail, no, that=E2=80=99s not an option. > Also, could we have a system test testing this stuff? I can write the > actual test--but could you tell me how to use the functionality = introduced > in this patch? A system test would be great! You need a TFTP server serving the content of some /boot=E2=80=A6 folder = as its root, which gets filled by the new grub-efi-net bootloader. This = folder name is specified by (bootloader-configuration (target =E2=80=A6) = =E2=80=A6). So lets assume you will use /boot-tftp for this. The bootloader installer will create a link /boot-tftp/gnu pointing to = ../gnu, and a link /boot-tftp/efi/boot/grub.cfg pointing to = ../../../boot/grub/grub.cfg. So the TFTP server needs to have access to = the store and the grub.cfg through these links as well. You need a DHCP server pointing the guix machine to the TFTP server and = to the file to boot. I use dnsmasq for this. My relevant configuration = lines are the =E2=80=9CTFTP server name=E2=80=9D option number 66 and = the =E2=80=9CBootfile name=E2=80=9D option 67: dhcp-option-force=3D66,10.10.10.10 dhcp-option-force=3D67,efi/boot/bootaa64.efi The dnsmasq program can be configured with=20 enable-tftp tftp-root=3D/srv/tftp/ to act as a TFTP server, too. This is probably preferable. You need an NFS server serving the root file system. And you need a guix machine, capable to boot via network. Possibly any = UEFI system could work, I think using qemu is possible as well. I=E2=80=99m using a Raspberry Pi 3b. It is not PXE compliant, but = capable to boot via network. For example it can only handle an IP = address but no hostname inside the =E2=80=9CTFTP server name=E2=80=9D = option. After specific firmware blobs have been loaded, it is loading = the U-Boot, which then acts as an UEFI implementation and uses PXE. = However, I do not use special PXE functionality, but finally the U-Boot = will try to load /efi/boot/bootaa64.efi via TFTP, which in fact is GRUB. GRUB then loads more files via TFTP from /efi/boot, most interestingly = /efi/boot/grub.cfg, which is a link to ../../../boot/grub/grub.cfg. And = that file points GRUB to the store. Up to here no NFS is involved at all. GRUB will load the initrd and = start Linux. Then the guix system is running and will mount its root = file system via NFS. If it is possible to start qemu with just an initrd, a kernel, and = kernel arguments, then it would be possible to avoid DHCP, TFTP, and = GRUB. This might be a much simpler first step for a test, only requiring = an NFS server. Bye Stefan= From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 14 Jun 2020 18:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Cc: Stefan , 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.159216099323673 (code B ref 41011); Sun, 14 Jun 2020 18:57:01 +0000 Received: (at 41011) by debbugs.gnu.org; 14 Jun 2020 18:56:33 +0000 Received: from localhost ([127.0.0.1]:44508 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkXo0-00069l-Sl for submit@debbugs.gnu.org; Sun, 14 Jun 2020 14:56:33 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:35195) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkXny-00069V-Ap for 41011@debbugs.gnu.org; Sun, 14 Jun 2020 14:56:31 -0400 Received: by mail-qt1-f195.google.com with SMTP id z1so10996709qtn.2 for <41011@debbugs.gnu.org>; Sun, 14 Jun 2020 11:56:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=SirjVjAeJT5ei0PNuIxIbpRHNRcN/7nPnBhDK+XoEcY=; b=AMfNSLNL1nqrJHeTBM8Uuu81lejd+6mUTBi+NPJWPoKyy5uwropWv13lvfPk49geyT BhPkVtrIWXamD0WXuc0M2fo1EDuHLR2JUCRTSqpDzaL8Px866BamqCFBzKHW+XrqNmM5 OYjS//ie3DxJxi+QZ3rq6lF0Jpz0ZLtt9zCJ6n4RFp8Is7cyf224/SFZPSSRJ4X1SRL7 MQREQD5V9tvbSmHQ3V47Wxn1VNJMV5/R8+kcjI8e2pwzt//ge9tyZLEPIP46zjGUvOO5 dMu6SPGU5gPuorozYwHQ/fBL1ALKc9ufxmDQ855/MVxIJTX5v3Go87RU9XH6+fwcPO7Y Lpkw== 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:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=SirjVjAeJT5ei0PNuIxIbpRHNRcN/7nPnBhDK+XoEcY=; b=tTGc6O5B2u3aB86F+3pOgIIQp1RYdb9iHUL2LAUzMdAHAvXeYPLgh4Jh0CkoShSEpS zi5nyKssZhpgw95Ewwl8k+wrI2V6mQ5gPD+cx9ccQxdxutPc7ASqMIeFsDePd2/M5OJ7 wHwtWtP5q50v//5+RHjGY6Szrj7KMcEFxb+2Z7HnHCyh+cZ5zx5JPzokB4LSuRK1zp6B w2QAXfEfdVUAwim6OLJS85AzjpXfznli7YcJW9SO0AyCv5W2T7VU7hb1elk1MHD5R9vU cux/98OiYEKFFBRayHH2Y8seyyzdJwuZiZXoHs0iA/ZwmSHHJAI3WFdbjJn6VORIf8gL UoMA== X-Gm-Message-State: AOAM533RXFo/9o1ZTEtDXMvoeOF50fGzufqqx1ILIr43R5lKYkEXv6zR HJ7Qa7hQLsWrisMUAyJRZGiI9/DOapw= X-Google-Smtp-Source: ABdhPJy1HQ1KQ3vAUmuQEmM95iuFiKpYsHGCCfMb95Ntc6aDlBhy8urGhmycpxT/tg/kfCym4hn68g== X-Received: by 2002:ac8:7252:: with SMTP id l18mr12390264qtp.71.1592160984625; Sun, 14 Jun 2020 11:56:24 -0700 (PDT) Received: from hurd (dsl-10-134-19.b2b2c.ca. [72.10.134.19]) by smtp.gmail.com with ESMTPSA id g51sm10399285qtb.69.2020.06.14.11.56.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 11:56:24 -0700 (PDT) From: Maxim Cournoyer References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <87h7w7cc55.fsf@gnu.org> <92DB8E2B-1CA2-41AE-9265-53C4F5337686@vodafonemail.de> <20200606193721.1e126131@scratchpost.org> <46CD97B3-9994-4AB7-AA7D-4DE39AB7A238@vodafonemail.de> <20200609154400.4c7d2f90@scratchpost.org> <87bllqi66g.fsf@gmail.com> <20200611151937.204ad14d@scratchpost.org> Date: Sun, 14 Jun 2020 14:56:23 -0400 In-Reply-To: <20200611151937.204ad14d@scratchpost.org> (Danny Milosavljevic's message of "Thu, 11 Jun 2020 15:19:37 +0200") Message-ID: <87eeqhh3xk.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello Danny, Danny Milosavljevic writes: > Hi Maxim, > Hi Stefan, > > On Thu, 11 Jun 2020 00:21:11 -0400 > Maxim Cournoyer wrote: > >> > (define (device-string->file-system-device device-string) >> > ;; The "--root=3DSPEC" kernel command-line option always provides a >> > ;; string, but the string can represent a device, a UUID, a >> > ;; label or a NFS spec. So check for all three. >> > (cond ((string-prefix? "/" device-string) device-string) >> > ((uuid device-string) =3D> identity) >> > (else (file-system-label device-string)))) >> > >> > But looking at the condition (uuid device-string) I have no idea what = that means, >> > or is bound to!=20=20 >>=20 >> It means that if the device-string (a string as its name imply) contains >> something that represent a UUID, return its corresponding UUID object. >> `uuid' comes from (gnu system uuid). Does that answer your question? > > Oh! I've looked at now it but I still don't get it. Perhaps the '=3D>' syntax is the reason why? The the Guile Reference info manual defines it as such: For the =E2=80=98=3D>=E2=80=99 clause type, EXPRESSION is evaluated and the resulting procedure is applied to the value of TEST. The result of this procedure application is then the result of the =E2=80=98cond=E2=80=99-expression. (uuid device-string) returns either #f or a uuid object. So applying the identity function to a uuid object yields that same object. HTH! Maxim From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 14 Jun 2020 19:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Stefan Cc: Danny Milosavljevic , 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.159216179524897 (code B ref 41011); Sun, 14 Jun 2020 19:10:01 +0000 Received: (at 41011) by debbugs.gnu.org; 14 Jun 2020 19:09:55 +0000 Received: from localhost ([127.0.0.1]:44512 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkY0x-0006TV-2m for submit@debbugs.gnu.org; Sun, 14 Jun 2020 15:09:55 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:34423) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkY0v-0006TH-1q for 41011@debbugs.gnu.org; Sun, 14 Jun 2020 15:09:53 -0400 Received: by mail-qt1-f196.google.com with SMTP id u17so11037422qtq.1 for <41011@debbugs.gnu.org>; Sun, 14 Jun 2020 12:09:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=9OF8jnYyv74LOtLNUwnDcsRajrmFdWtgyYCaB75O+9A=; b=t6F2/QW5mddQnBOX59lWG96WXFNJAE6giYNyjZiAIEO0ZmhRec7r4XWjPdDf3Odh9W SBZoJJ2izCKA09S4dH1RYzYZteF9v9qfX9vT04FHmXkMEwOdUXFHX+2kj/lu8RzyeyCW /rW53OFMK10D8Cq0zFJpB9CIHv/fiXsj2F80/aZiOUxDtijw1y8yqmERP0c4j031QAND FHgJRautP9iDRmfyPEo45EjyO46OwGCMvffCKRpVS256/D69L7UqmjZjpJN1A2KpM3q4 AJfeXL7NXiA6U2tjhmFDbVctiQpXwNlDxnez7NQqwlo3rN26kmbjsXbqVs4cMm+uC/cf +MuA== 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:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=9OF8jnYyv74LOtLNUwnDcsRajrmFdWtgyYCaB75O+9A=; b=M9ni9HTYH8L2MJh6/jm8MrnyPuudll1fSZ7LzC1ua/Z30lrgAZCRn7JjqnISOsp0Dy AZHFd9IyP0lrgHxG+wc2mkbIVbNQNFHO93G/VIUU1VOzxf/YR25xjUv1psSzJC+st5aS ByV3bP8AdwvRXXuoQqbJefmIFI7BTSf5ZVOWxDXYd+7qPgvTRJhLHbwDxcil1j+2wKop 35WAAEZ/FP9KpBZj3f/s4xfGI28SbqKbISL+YUq3AR4TYZDRXzGH+CER67DH4y9z0KxC 2enKhGg7lSv3s2AX+bD/gikYQde5g6cyRupgUtRajZcLuHWudkLVCPSKs5FliDqI5nVw qPdQ== X-Gm-Message-State: AOAM531PA46/QaPAlYVn4hbq94fUqBnGrWLd1dTFuAWcmXfIbs0MIiqE Dx7oY4XT9P0tVo4JL3AJe6sY6EcSUes= X-Google-Smtp-Source: ABdhPJyoC+9AXIJW6SjzdGmZ11I+uVrU/hM2O7QLxjEDgVDSedImtX3n9ePVkmCWA0W5JUuR+P++iA== X-Received: by 2002:ac8:4143:: with SMTP id e3mr12190050qtm.28.1592161787315; Sun, 14 Jun 2020 12:09:47 -0700 (PDT) Received: from hurd (dsl-10-134-19.b2b2c.ca. [72.10.134.19]) by smtp.gmail.com with ESMTPSA id x54sm10787340qta.42.2020.06.14.12.09.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 12:09:46 -0700 (PDT) From: Maxim Cournoyer References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <87h7w7cc55.fsf@gnu.org> <92DB8E2B-1CA2-41AE-9265-53C4F5337686@vodafonemail.de> <20200606193721.1e126131@scratchpost.org> <46CD97B3-9994-4AB7-AA7D-4DE39AB7A238@vodafonemail.de> <20200609154400.4c7d2f90@scratchpost.org> <87bllqi66g.fsf@gmail.com> Date: Sun, 14 Jun 2020 15:09:46 -0400 In-Reply-To: (Stefan's message of "Fri, 12 Jun 2020 02:06:27 +0200") Message-ID: <87a715h3b9.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello Stefan! Stefan writes: [...] > Regarding =E2=80=98grub efi net=E2=80=99: Just take a look at the GRUB > manual. Actually GRUB is not dealing with NFS at all, it is using TFTP > to load files. Only Linux uses NFS to mount its root file system. I see. Then we're talking about TFTP support in GRUB, and it doesn't seem to depend on EFI at all (which is good!). >> When booting >> from NFS using the nfsroot Linux option, it's possible to specify a >> '/dev/nfs' as the root kernel parameter. /dev/nfs is not a real block >> device, it's just a stub hinting the kernel that its root file system is >> on NFS. Perhaps that can be used? > > These =E2=80=9Croot=3D/dev/nfs rootfstype=3Dnfs nfsroot=3D=E2=80=A6 ip=3D= =E2=80=A6=E2=80=9D kernel arguments > only make sense if an initrd can be omitted. Either the initrd or such > a root-nfs becomes the root file system at startup. As the guix system > is currently relying on an initrd, this is not an option. I see. Thanks for explaining, I understand the plan better now. > Further you would need to ensure that certain CONFIG_NFS=E2=80=A6, CONFIG= _IP=E2=80=A6 > and even more options for your network interface are set to =E2=80=98=3Dy= =E2=80=99 to > ensure that Linux can make use of an nfs-root. Yes. For having done it recently, enabling the NFS support in the kernel doesn't require much change, but then supporting a vast array of network cards directly in the kernel doesn't sound too appealing. IIUC, going through an initrd allows dynamically loading kernel modules instead of having them statically built in the kernel (so that a user could add a network module of their choice to their OS declaration without having to rebuild the default kernel), which is why it's better to go that route in Guix. Am I understanding things correctly? Thanks! Maxim From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 17 Jun 2020 13:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxim Cournoyer Cc: Danny Milosavljevic , 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.159239954013345 (code B ref 41011); Wed, 17 Jun 2020 13:13:02 +0000 Received: (at 41011) by debbugs.gnu.org; 17 Jun 2020 13:12:20 +0000 Received: from localhost ([127.0.0.1]:50732 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jlXrY-0003TA-3R for submit@debbugs.gnu.org; Wed, 17 Jun 2020 09:12:20 -0400 Received: from vsmx009.vodafonemail.xion.oxcs.net ([153.92.174.87]:25932) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jlXrV-0003Sv-Tz for 41011@debbugs.gnu.org; Wed, 17 Jun 2020 09:12:19 -0400 Received: from vsmx001.vodafonemail.xion.oxcs.net (unknown [192.168.75.191]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTP id 70C72159D2ED; Wed, 17 Jun 2020 13:12:11 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [2.201.117.60]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTPA id E7AFD159D415; Wed, 17 Jun 2020 13:12:04 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <87a715h3b9.fsf@gmail.com> Date: Wed, 17 Jun 2020 15:12:03 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <97853D17-5928-4EDB-918B-793D9DB3ED95@vodafonemail.de> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> <87h7w7cc55.fsf@gnu.org> <92DB8E2B-1CA2-41AE-9265-53C4F5337686@vodafonemail.de> <20200606193721.1e126131@scratchpost.org> <46CD97B3-9994-4AB7-AA7D-4DE39AB7A238@vodafonemail.de> <20200609154400.4c7d2f90@scratchpost.org> <87bllqi66g.fsf@gmail.com> <87a715h3b9.fsf@gmail.com> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Maxim! > I see. Then we're talking about TFTP support in GRUB, and it doesn't > seem to depend on EFI at all (which is good!). Well, the data transfer in GRUB is using TFTP, but the actual network = driver, the facilities to start a kernel and so on, happens by GRUB via = the EFI-API in my case, which is provided by the U-Boot. It may be a runtime detection, if the EFI-API or the legacy BIOS = functions are used. I don=E2=80=99t know. In that case I should probably rename grub-efi-net to grub-net. > Yes. For having done it recently, enabling the NFS support in the = kernel > doesn't require much change, but then supporting a vast array of = network > cards directly in the kernel doesn't sound too appealing. IIUC, going > through an initrd allows dynamically loading kernel modules instead of > having them statically built in the kernel (so that a user could add a > network module of their choice to their OS declaration without having = to > rebuild the default kernel), which is why it's better to go that route > in Guix. >=20 > Am I understanding things correctly? Yes. And additionally as a beginner I simply don=E2=80=99t want to try = to remove the initrd, I can=E2=80=99t even imagine the effort to do so. = :-) Bye Stefan= From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> In-Reply-To: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 05 Sep 2020 11:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.159930513514008 (code B ref 41011); Sat, 05 Sep 2020 11:26:02 +0000 Received: (at 41011) by debbugs.gnu.org; 5 Sep 2020 11:25:35 +0000 Received: from localhost ([127.0.0.1]:41623 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kEWK7-0003dr-Hl for submit@debbugs.gnu.org; Sat, 05 Sep 2020 07:25:35 -0400 Received: from vsmx011.vodafonemail.xion.oxcs.net ([153.92.174.89]:26230) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kEWK6-0003de-67 for 41011@debbugs.gnu.org; Sat, 05 Sep 2020 07:25:35 -0400 Received: from vsmx003.vodafonemail.xion.oxcs.net (unknown [192.168.75.197]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTP id E02B159D61A for <41011@debbugs.gnu.org>; Sat, 5 Sep 2020 11:25:27 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [178.5.77.113]) by mta-7-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 96535539AB9 for <41011@debbugs.gnu.org>; Sat, 5 Sep 2020 11:25:25 +0000 (UTC) From: Stefan Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: Date: Sat, 5 Sep 2020 13:25:24 +0200 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/bootloader/grub.scm (grub-net-bootloader): New bootloader for network booting via tftp. (install-grub-net): New bootloader installer for tftp. --- gnu/bootloader/grub.scm | 79 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 75 insertions(+), 4 deletions(-) diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index b905ae360c..8f078dc2ac 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -24,7 +24,7 @@ =20 (define-module (gnu bootloader grub) #:use-module (guix records) - #:use-module ((guix utils) #:select (%current-system)) + #:use-module ((guix utils) #:select (%current-system = %current-target-system)) #:use-module (guix gexp) #:use-module (gnu artwork) #:use-module (gnu bootloader) @@ -46,8 +46,11 @@ grub-theme-color-highlight grub-theme-gfxmode =20 + install-grub-net + grub-bootloader grub-efi-bootloader + grub-net-bootloader grub-mkrescue-bootloader grub-minimal-bootloader =20 @@ -501,11 +504,73 @@ fi~%")))) "--bootloader-id=3DGuix" "--efi-directory" target-esp)))) =20 +(define (install-grub-net subdir) + "Define a grub-net bootloader installer for installation in SUBDIR, +which is usually \"efi/boot\" or \"efi/Guix\"." + (let* ((arch (car (string-split (or (%current-target-system) + (%current-system)) + #\-))) + (efi-bootloader-link (string-append "/boot" + (match arch + ("i686" "ia32") + ("x86_64" "x64") + ("arm" "arm") + ("armhf" "arm") + ("aarch64" "aa64") + ("riscv" "riscv32") + ("riscv64" "riscv64")) + ".efi")) + (efi-bootloader (string-append (match arch + ("i686" "i386") + ("x86_64" "x86_64") + ("arm" "arm") + ("armhf" "arm") + ("aarch64" "arm64") + ("riscv" "riscv32") + ("riscv64" "riscv64")) + "-efi/core.efi"))) + #~(lambda (bootloader target mount-point) + "Install GRUB as e.g. \"bootx64.efi\" or \"bootarm64.efi\" = \"into +SUBDIR, which is usually \"efi/boot\" or \"efi/Guix\" below the = directory TARGET +for the system whose root is mounted at MOUNT-POINT." + (let* (;; Use target-depth and subdir-depth to construct links = to + ;; "../gnu" and "../../../boot/grub/grub.cfg" with the = correct + ;; number of "../". Note: This doesn't consider ".." or = ".", + ;; which may appear inside target or subdir. + (target-depth (length (delete "" (string-split target = #\/)))) + (subdir-depth (length (delete "" (string-split #$subdir = #\/)))) + (up1 (string-join (make-list target-depth "..") "/" = 'suffix)) + (up2 (string-join (make-list subdir-depth "..") "/" = 'suffix)) + (net-dir (string-append mount-point target "/")) + (store-name (car (delete "" (string-split bootloader = #\/)))) + (store (string-append up1 store-name)) + (store-link (string-append net-dir store-name)) + (grub-cfg (string-append up1 up2 "boot/grub/grub.cfg")) + (grub-cfg-link (string-append net-dir #$subdir = "/grub.cfg")) + (efi-bootloader-link + (string-append net-dir #$subdir = #$efi-bootloader-link))) + ;; Tell 'grub-install' that there might be a LUKS-encrypted = /boot or + ;; root partition. + (setenv "GRUB_ENABLE_CRYPTODISK" "y") + (invoke/quiet (string-append bootloader "/bin/grub-mknetdir") + (string-append "--net-directory=3D" net-dir) + (string-append "--subdir=3D" #$subdir)) + (false-if-exception (delete-file store-link)) + (symlink store store-link) + (false-if-exception (delete-file grub-cfg-link)) + (symlink grub-cfg grub-cfg-link) + (false-if-exception (delete-file efi-bootloader-link)) + (symlink #$efi-bootloader efi-bootloader-link))))) + ^L =20 ;;; ;;; Bootloader definitions. ;;; +;;; For all these grub-bootloader variables the path to = /boot/grub/grub.cfg +;;; is fixed. Inheriting and overwriting the field = 'configuration-file' will +;;; break 'guix system delete-generations', 'guix system = switch-generation', +;;; and 'guix system roll-back'. =20 (define grub-bootloader (bootloader @@ -516,12 +581,12 @@ fi~%")))) (configuration-file "/boot/grub/grub.cfg") (configuration-file-generator grub-configuration-file))) =20 -(define* grub-minimal-bootloader +(define grub-minimal-bootloader (bootloader (inherit grub-bootloader) (package grub-minimal))) =20 -(define* grub-efi-bootloader +(define grub-efi-bootloader (bootloader (inherit grub-bootloader) (installer install-grub-efi) @@ -529,7 +594,13 @@ fi~%")))) (name 'grub-efi) (package grub-efi))) =20 -(define* grub-mkrescue-bootloader +(define grub-net-bootloader + (bootloader + (inherit grub-efi-bootloader) + (name 'grub-net-bootloader) + (installer (install-grub-net "efi/Guix")))) + +(define grub-mkrescue-bootloader (bootloader (inherit grub-efi-bootloader) (package grub-hybrid))) --=20 2.26.0 From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 06 Sep 2020 13:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 41011@debbugs.gnu.org Cc: Mathieu Othacehe , Maxim Cournoyer , Danny Milosavljevic Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.159939765311211 (code B ref 41011); Sun, 06 Sep 2020 13:08:01 +0000 Received: (at 41011) by debbugs.gnu.org; 6 Sep 2020 13:07:33 +0000 Received: from localhost ([127.0.0.1]:45033 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kEuOL-0002ul-4x for submit@debbugs.gnu.org; Sun, 06 Sep 2020 09:07:33 -0400 Received: from vsmx012.vodafonemail.xion.oxcs.net ([153.92.174.90]:21015) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kEuOJ-0002uX-CK for 41011@debbugs.gnu.org; Sun, 06 Sep 2020 09:07:31 -0400 Received: from vsmx004.vodafonemail.xion.oxcs.net (unknown [192.168.75.198]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTP id 8AF5EF353E4; Sun, 6 Sep 2020 13:07:24 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [178.5.77.113]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 079A919AE7F; Sun, 6 Sep 2020 13:07:15 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: Date: Sun, 6 Sep 2020 15:07:14 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <2D3B6A0E-908C-4DA8-ABD5-2601233D13DF@vodafonemail.de> References: X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi! This debbugs thread got already very long. Therefore I would like to = focus on the grub changes in this ticket done with my last patch, see = This patch only introduces a new grub-net bootloader, which basically = installs grub via its grub-mknetdir command. There is no modification of other bootloaders. The restriction of the = =E2=80=9C/boot/grub/grub.cfg=E2=80=9D file remains. As usually the DHCP option 67 =E2=80=9CBootfile name=E2=80=9D is = involved to point the EFI of a machine to the file to boot via TFTP, I = chose to export (install-grub-net subdir) as well to be able to modify = that path, whose default is /boot/efi/Guix/boot[x64|aa64|=E2=80=A6].efi, = to something else, e.g. (bootloader (inherit grub-net-bootloader (installer (install-grub-net = "efi/machine-1")))) To be able to boot different machines with their own guix installation, = however, there is still the problem to provide to each an own grub.cfg = file via TFTP. This file =E2=80=93 as you know =E2=80=93 has still a = hard coded path of /boot/grub/grub.cfg. But this is a different issue = and should not be tackled with this patch. Bye Stefan= From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 06 Sep 2020 14:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Stefan Cc: 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.15994029705290 (code B ref 41011); Sun, 06 Sep 2020 14:37:01 +0000 Received: (at 41011) by debbugs.gnu.org; 6 Sep 2020 14:36:10 +0000 Received: from localhost ([127.0.0.1]:46745 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kEvm5-0001NE-M0 for submit@debbugs.gnu.org; Sun, 06 Sep 2020 10:36:10 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:39676) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kEvm0-0001N2-FU for 41011@debbugs.gnu.org; Sun, 06 Sep 2020 10:36:08 -0400 Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at [80.110.126.103]) by dd26836.kasserver.com (Postfix) with ESMTPSA id DD86C3363FB1; Sun, 6 Sep 2020 16:36:01 +0200 (CEST) Date: Sun, 6 Sep 2020 16:35:59 +0200 From: Danny Milosavljevic Message-ID: <20200906163559.1b56c36f@scratchpost.org> In-Reply-To: References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/l9vaRW05C86OpKk/hmO26wf"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/l9vaRW05C86OpKk/hmO26wf Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Stefan, I think this looks good in general. I'd like to do some nitpicking on the names--especially since the procedure= is exported and thus presumably can't have its signature modified later without breaking backward compatibility. In this case, the man page grub-mknetdir(8) mentions "netboot" ? Do you think "net" or "netboot" is a better name for this functionality ? On Sat, 5 Sep 2020 13:25:24 +0200 Stefan wrote: > + install-grub-net I'm fine with whatever--but the man page says "netboot". If that's the usu= al name, let's use it. If "net"'s the usual name, let's use that. > + (let* ((arch (car (string-split (or (%current-target-system) > + (%current-system)) > + #\-))) Let's not use arcane Scheme anachronisms like "car". I know most Scheme programmers probably know what it does--but still, better not to use names of registers of a machine no one uses anymore. Better something like this: (let* ((system-parts (string-split (or (%current-target-system) (%current-system)) #\-))) > + (efi-bootloader-link (string-append "/boot" > + (match arch > + ("i686" "ia32") > + ("x86_64" "x64") > + ("arm" "arm") > + ("armhf" "arm") > + ("aarch64" "aa64") > + ("riscv" "riscv32") > + ("riscv64" "riscv64")) > + ".efi")) Also, I have a slight preference for greppable file names even when it's a little more redundant, so more like that: (match system-parts (("i686" _ ...) "ia32.efi") (("x86_64" _ ...) "x64.efi") (("arm" _ ...) "arm.efi") (("armhf" _ ...) "arm.efi") (("aarch64" _ ...) "aa64.efi") (("riscv" _ ...) "riscv32.efi") (("riscv64" _ ...) "riscv64.efi")) > + (efi-bootloader (string-append (match arch > + ("i686" "i386") > + ("x86_64" "x86_64") > + ("arm" "arm") > + ("armhf" "arm") > + ("aarch64" "arm64") > + ("riscv" "riscv32") > + ("riscv64" "riscv64")) > + "-efi/core.efi"))) Likewise: (efi-bootloader (match system-parts (("i686" _ ...) "i386-efi/core.efi") (("x86_64" _ ...) "x86_64-efi/core.efi") (("arm" _ ...) "arm-efi/core.efi") (("armhf" _ ...) "arm-efi/core.efi") (("aarch64" _ ...) "arm64-efi/core.efi") (("riscv" _ ...) "riscv32-efi/core.efi") (("riscv64" _ ...) "riscv64-efi/core.efi")))) > + #~(lambda (bootloader target mount-point) > + "Install GRUB as e.g. \"bootx64.efi\" or \"bootarm64.efi\" \"into > +SUBDIR, which is usually \"efi/boot\" or \"efi/Guix\" below the director= y TARGET > +for the system whose root is mounted at MOUNT-POINT." I think you mean: > + "Install GRUB as e.g. \"bootx64.efi\" or \"bootarm64.efi\" \"into > +SUBDIR (which is usually \"efi/boot\" or \"efi/Guix\") below the directo= ry TARGET > +for the system whose root is mounted at MOUNT-POINT." > + (let* (;; Use target-depth and subdir-depth to construct links to > + ;; "../gnu" and "../../../boot/grub/grub.cfg" with the co= rrect > + ;; number of "../". Note: This doesn't consider ".." or "= .", > + ;; which may appear inside target or subdir. Uhhhh... that could use some more explanationary comments in the source code of why it is done in the first place. Also, is TARGET itself assumed to be an absolute path or is it relative to something else ? According to the rest of the patch it's relative to MOUNT-POINT--but please state this explicitly in the docstring. > + (target-depth (length (delete "" (string-split target #\/= )))) > + (subdir-depth (length (delete "" (string-split #$subdir #= \/)))) > + (up1 (string-join (make-list target-depth "..") "/" 'suff= ix)) Maybe better name: escape-target or something. > + (up2 (string-join (make-list subdir-depth "..") "/" 'suff= ix)) Maybe better name: escape-subdir or something. So this is in order to get out of (string-append TARGET "/" SUBDIR), correc= t? Does the (string-append TARGET "/" SUBDIR) have an official name ? If not, fine. > + (net-dir (string-append mount-point target "/")) So TARGET is relative to MOUNT-POINT ? And MOUNT-POINT is assumed to have a slash at the end ? > + (store-name (car (delete "" (string-split bootloader #\/)= ))) Maybe use match. Also isn't there an official way to find out how the store is called ? (%store-prefix) ? > + (store (string-append up1 store-name)) (string-append escape-target store-name) > + (store-link (string-append net-dir store-name)) *mumbles to self* (string-append MOUNT-POINT TARGET) is net-dir. So it tries to get to (string-append MOUNT-POINT "/gnu"). I vaguely remember our docker pack adding some serious plumbing to support symlinks like that. I'll try to find it. I just wanted to send this E-Mail because of the foll= owing: > ;;; > ;;; Bootloader definitions. > ;;; > +;;; For all these grub-bootloader variables the path to /boot/grub/grub.= cfg > +;;; is fixed. Inheriting and overwriting the field 'configuration-file'= will > +;;; break 'guix system delete-generations', 'guix system switch-generati= on', > +;;; and 'guix system roll-back'. I've added that comment to the source code in an extra commit 3f2bd9df410e85795ec656052f44d2cddec2a060 in guix master. Thank you very much for it. > -(define* grub-minimal-bootloader > +(define grub-minimal-bootloader > (bootloader > -(define* grub-efi-bootloader > +(define grub-efi-bootloader > (bootloader > -(define* grub-mkrescue-bootloader > +(define grub-mkrescue-bootloader I've applied this hunk to guix master as commit 8664c35d6d7fd6e9ce1ca8adefa8070a8e556db4. Thanks. --Sig_/l9vaRW05C86OpKk/hmO26wf Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9U888ACgkQ5xo1VCww uqXJJAf/ZctzWQXWb20y+oL9pJncfsY9wWhvi8ru1vZ8ft2VvuoqEXjd9sAArASU sBgEtSJfcbygCD2CPRdr9xWxqxR3E/ADl/GKAou+QmlHceLnQLTx8+lVgs/TH9hv fNnvBG0yM9D9/1B4B4KjRURU0KhbXdGRrf/toWgXEW7DFtC7plQv7DCgv55gnV77 TvWg2rGBrRnJAegdKnAVrIGjo89wDwIZ2hmZRZiw57o7WlXigSfZGxJyXbgqkbDD RiYTUcrd5ih4OzdBhBY0rPhE0JStnBxlaK3jBlWL38/RwAf01xPn8YBXExUgGOBH C/s8pDSMqH2H/6UOQ82mAxDkAJOXQg== =KE80 -----END PGP SIGNATURE----- --Sig_/l9vaRW05C86OpKk/hmO26wf-- From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 06 Sep 2020 15:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Stefan Cc: 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.159940528517633 (code B ref 41011); Sun, 06 Sep 2020 15:15:01 +0000 Received: (at 41011) by debbugs.gnu.org; 6 Sep 2020 15:14:45 +0000 Received: from localhost ([127.0.0.1]:46829 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kEwNR-0004aJ-Fi for submit@debbugs.gnu.org; Sun, 06 Sep 2020 11:14:45 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:48020) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kEwNP-0004aB-Ry for 41011@debbugs.gnu.org; Sun, 06 Sep 2020 11:14:44 -0400 Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at [80.110.126.103]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 334403368063; Sun, 6 Sep 2020 17:14:42 +0200 (CEST) Date: Sun, 6 Sep 2020 17:14:39 +0200 From: Danny Milosavljevic Message-ID: <20200906171439.1a0f2896@scratchpost.org> In-Reply-To: <20200906163559.1b56c36f@scratchpost.org> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <20200906163559.1b56c36f@scratchpost.org> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/ZAcwCQkBjgBBqo7=gPvBmm4"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/ZAcwCQkBjgBBqo7=gPvBmm4 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable > I vaguely remember our docker pack adding some serious plumbing to support > symlinks like that. ((guix build union) #:select (relative-file-name)) symlink-relative in (guix build union): "Assuming both OLD and NEW are absolute file names, make NEW a symlink to OLD, but using a relative file name." --Sig_/ZAcwCQkBjgBBqo7=gPvBmm4 Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9U/N8ACgkQ5xo1VCww uqV5NQf9GZHKEymvFnTt5GUK6bm2ladj+GVv/zd3zHXitp3PSkKY7zsYe3LUhPXS 7EhA/n/7Fn4yqBJ5KtlE4JfYRxOrvm6Cdi9fQVDo+flTu0VyAaHNco4A4r7/44CR OEGvH0EsP6+vA6Lv74eVwP/BVpd6F90VTNby5/cTEN6hhRd2Jp/HccrRnm2LMBg8 yu9Y/5Er4yTZ1guGpVT3lJC5JXHk8NDuH6hMNVKkP/fX4kE2uF67BCvREntBQmdO +pVr+6TInTMzCNSnC6thkfNUFZSU0uM1E3/VCx5N1+k6T3jTmWrj68YfShyXrtGd ngUxP3ZYDtE9FH6rZKCQRfXEOrLAdw== =nM2c -----END PGP SIGNATURE----- --Sig_/ZAcwCQkBjgBBqo7=gPvBmm4-- From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 07 Sep 2020 23:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Cc: 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.159951959418497 (code B ref 41011); Mon, 07 Sep 2020 23:00:02 +0000 Received: (at 41011) by debbugs.gnu.org; 7 Sep 2020 22:59:54 +0000 Received: from localhost ([127.0.0.1]:51347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kFQ78-0004oH-2K for submit@debbugs.gnu.org; Mon, 07 Sep 2020 18:59:54 -0400 Received: from vsmx011.vodafonemail.xion.oxcs.net ([153.92.174.89]:46874) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kFQ74-0004o0-LE for 41011@debbugs.gnu.org; Mon, 07 Sep 2020 18:59:53 -0400 Received: from vsmx003.vodafonemail.xion.oxcs.net (unknown [192.168.75.197]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTP id 1401059D342; Mon, 7 Sep 2020 22:59:44 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [178.5.77.113]) by mta-7-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 9938D539A8F; Mon, 7 Sep 2020 22:59:39 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <20200906163559.1b56c36f@scratchpost.org> Date: Tue, 8 Sep 2020 00:59:38 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <45F0D825-F888-42E9-BDAE-7BB6FA010A6E@vodafonemail.de> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <20200906163559.1b56c36f@scratchpost.org> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Danny! > In this case, the man page grub-mknetdir(8) mentions "netboot" ? > Do you think "net" or "netboot" is a better name for this = functionality ? At there is = only a single hit for =E2=80=98netboot=E2=80=99 which is in =E2=80=9CTo = generate a netbootable directory, run:=E2=80=9D. All GRUB variables and commands have the prefix =E2=80=98net_=E2=80=99. But I agree, grub-netboot seems to be a more describing name. In the end this is a grub-efi for booting over network. Would = grub-efi-netboot be an even better name? It will not work with BIOS = machines. > Let's not use arcane Scheme anachronisms like "car". I know most = Scheme > programmers probably know what it does--but still, better not to use > names of registers of a machine no one uses anymore. >=20 > Better something like this: >=20 > (let* ((system-parts (string-split (or (%current-target-system) > (%current-system)) > #\-))) I only need the first list element here. I will use (first =E2=80=A6). >> + (efi-bootloader-link (string-append "/boot" >=20 >> + (match arch >> + ("i686" "ia32") >> + ("x86_64" "x64") >> + ("arm" "arm") >> + ("armhf" "arm") >> + ("aarch64" "aa64") >> + ("riscv" "riscv32") >> + ("riscv64" = "riscv64")) >> + ".efi")) >=20 > Also, I have a slight preference for greppable file names even when = it's a > little more redundant, so more like that: >=20 > (match system-parts > (("i686" _ ...) "ia32.efi") > (("x86_64" _ ...) "x64.efi") > (("arm" _ ...) "arm.efi") > (("armhf" _ ...) "arm.efi") > (("aarch64" _ ...) "aa64.efi") > (("riscv" _ ...) "riscv32.efi") > (("riscv64" _ ...) "riscv64.efi")) I=E2=80=99m not familiar with the match syntax yet. For me using the = first element as arch seems simpler. >> + (efi-bootloader (string-append (match arch >> + ("i686" "i386") >> + ("x86_64" "x86_64") >> + ("arm" "arm") >> + ("armhf" "arm") >> + ("aarch64" "arm64") >> + ("riscv" "riscv32") >> + ("riscv64" "riscv64")) >> + "-efi/core.efi"))) >=20 > Likewise: >=20 > (efi-bootloader (match system-parts > (("i686" _ ...) "i386-efi/core.efi") > (("x86_64" _ ...) "x86_64-efi/core.efi") > (("arm" _ ...) "arm-efi/core.efi") > (("armhf" _ ...) "arm-efi/core.efi") > (("aarch64" _ ...) "arm64-efi/core.efi") > (("riscv" _ ...) "riscv32-efi/core.efi") > (("riscv64" _ ...) "riscv64-efi/core.efi")))) I=E2=80=99d prefer to keep the still grepable =E2=80=9C/core.efi=E2=80=9D = separate. >> + #~(lambda (bootloader target mount-point) >=20 >> + "Install GRUB as e.g. \"bootx64.efi\" or \"bootarm64.efi\" = \"into >> +SUBDIR, which is usually \"efi/boot\" or \"efi/Guix\" below the = directory TARGET >> +for the system whose root is mounted at MOUNT-POINT." >=20 > I think you mean: >=20 >> + "Install GRUB as e.g. \"bootx64.efi\" or \"bootarm64.efi\" = \"into >> +SUBDIR (which is usually \"efi/boot\" or \"efi/Guix\") below the = directory TARGET >> +for the system whose root is mounted at MOUNT-POINT." Yes. >> + (let* (;; Use target-depth and subdir-depth to construct = links to >> + ;; "../gnu" and "../../../boot/grub/grub.cfg" with = the correct >> + ;; number of "../". Note: This doesn't consider ".." = or ".", >> + ;; which may appear inside target or subdir. >=20 > Uhhhh... that could use some more explanationary comments in the = source code > of why it is done in the first place. I=E2=80=99ll put an explanation into the doc-string. This is because the = grub.cfg and the store both need to be accessible to GRUB via TFTP, but = the TFTP root is TARGET, which is usually /boot. > Also, is TARGET itself assumed to be an absolute path or is it = relative to > something else ? According to the rest of the patch it's relative to > MOUNT-POINT--but please state this explicitly in the docstring. TARGET is the (operating-system (boot-loader (target "/boot") =E2=80=A6) = =E2=80=A6). I think this has to be an absolute path, but I didn=E2=80=99t = find any checks for this. But the manual doesn=E2=80=99t mention this, = just all examples are using absolute paths. And yes, when using =E2=80=98guix system init /etc/config.scm = /mnt/here=E2=80=99, then MOUNT-POINT and TARGET are concatenated. But = this is nothing specific to the new installer, this is the usual = behaviour of Guix and the reason for the two parameters TARGET and = MOUNT-POINT to any bootloader installer. I don=E2=80=99t think stating = this inside the new doc-string is the right place. >> + (target-depth (length (delete "" (string-split target = #\/)))) >=20 >> + (subdir-depth (length (delete "" (string-split = #$subdir #\/)))) >=20 >> + (up1 (string-join (make-list target-depth "..") "/" = 'suffix)) >=20 > Maybe better name: escape-target or something. >=20 >> + (up2 (string-join (make-list subdir-depth "..") "/" = 'suffix)) >=20 > Maybe better name: escape-subdir or something. >=20 > So this is in order to get out of (string-append TARGET "/" SUBDIR), = correct? Yes, correct. I=E2=80=99ll rework this with the (symlink-relative) = function you mentioned. > Does the (string-append TARGET "/" SUBDIR) have an official name ? > If not, fine. No. The TARGET becomes the TFTP root for GRUB, the SUBDIR becomes the = =E2=80=98prefix=E2=80=99 variable for GRUB. >> + (net-dir (string-append mount-point target "/")) >=20 > So TARGET is relative to MOUNT-POINT ? > And MOUNT-POINT is assumed to have a slash at the end ? MOUNT-POINT is either =E2=80=98/=E2=80=99 or depends on the argument to = =E2=80=98guix system init=E2=80=99. On the other side TARGET has to be = an absolute path, so it should be safe. At least (install-grub-efi) = makes the same mistake. What do you think? >> + (store-name (car (delete "" (string-split bootloader = #\/)))) >=20 > Maybe use match. I=E2=80=99ll use (first =E2=80=A6). > Also isn't there an official way to find out how the store is called ? > (%store-prefix) ? I only need the first path element to the store, which is usually /gnu. = The %store-prefix contains /gnu/store then. So it makes no difference. >> + (store (string-append up1 store-name)) >=20 > (string-append escape-target store-name) >=20 >> + (store-link (string-append net-dir store-name)) >=20 > *mumbles to self* (string-append MOUNT-POINT TARGET) is net-dir. > So it tries to get to (string-append MOUNT-POINT "/gnu"). The trouble is that GRUB shall load a file like = /gnu/store/=E2=80=A6-linux=E2=80=A6/Image via TFTP, but the TFTP root is = actually Guix=E2=80=99 final /boot folder. In the end this creates a relative symlink as ../gnu pointing from = /mnt/here/boot/gnu to /mnt/here/gnu. And GRUB=E2=80=99s =E2=80=9Cworking directory=E2=80=9D to search for its = modules and the grub.cfg is defined by its =E2=80=98prefix=E2=80=99 = variable, which is set through the SUBDIR argument, which defaults to = Guix=E2=80=99 final /boot/efi/Guix. This requires a relative symlink as ../../../boot/grub/grub.cfg pointing = from /mnt/here/boot/efi/Guix/grub.cfg to /mnt/here/boot/grub/grub.cfg. And be aware that TARGET may be /boot, but could be something else like = /tftp-root. Then the symlink would point from = /mnt/here/tftp-root/efi/Guix/grub.cfg to /mnt/here/boot/grub/grub.cfg, = as the later is kind of hard-coded. >> ;;; Bootloader definitions. >> ;;; >> +;;; For all these grub-bootloader variables the path to = /boot/grub/grub.cfg >> +;;; is fixed. Inheriting and overwriting the field = 'configuration-file' will >> +;;; break 'guix system delete-generations', 'guix system = switch-generation', >> +;;; and 'guix system roll-back'. >=20 > I've added that comment to the source code in an extra commit > 3f2bd9df410e85795ec656052f44d2cddec2a060 in guix master. > Thank you very much for it. >=20 >> -(define* grub-minimal-bootloader >> +(define grub-minimal-bootloader >> (bootloader >=20 >> -(define* grub-efi-bootloader >> +(define grub-efi-bootloader >> (bootloader >=20 >> -(define* grub-mkrescue-bootloader >> +(define grub-mkrescue-bootloader >=20 > I've applied this hunk to guix master as commit > 8664c35d6d7fd6e9ce1ca8adefa8070a8e556db4. >=20 > Thanks. Thanks! Bye Stefan= From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 08 Sep 2020 22:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Stefan Cc: 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.159960466222751 (code B ref 41011); Tue, 08 Sep 2020 22:38:02 +0000 Received: (at 41011) by debbugs.gnu.org; 8 Sep 2020 22:37:42 +0000 Received: from localhost ([127.0.0.1]:56690 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kFmFB-0005ur-Tw for submit@debbugs.gnu.org; Tue, 08 Sep 2020 18:37:42 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:42092) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kFmF8-0005ud-Vq for 41011@debbugs.gnu.org; Tue, 08 Sep 2020 18:37:40 -0400 Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at [80.110.126.103]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 2C09C3363C04; Wed, 9 Sep 2020 00:37:36 +0200 (CEST) Date: Wed, 9 Sep 2020 00:37:32 +0200 From: Danny Milosavljevic Message-ID: <20200909003732.5c401932@scratchpost.org> In-Reply-To: <45F0D825-F888-42E9-BDAE-7BB6FA010A6E@vodafonemail.de> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <20200906163559.1b56c36f@scratchpost.org> <45F0D825-F888-42E9-BDAE-7BB6FA010A6E@vodafonemail.de> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/84XO61oIHrsS/4w0YjT3vGx"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/84XO61oIHrsS/4w0YjT3vGx Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Stefan, On Tue, 8 Sep 2020 00:59:38 +0200 Stefan wrote: > In the end this is a grub-efi for booting over network.=20 >Would grub-efi-netboot be an even better name? It will not work with BIOS = machines. Oh, then definitely let's use that name. > I only need the first list element here. I will use (first =E2=80=A6). Okay. (I leave it to the others to comment on here if they have a problem with it= --I see no downside in this case) > >> + (efi-bootloader-link (string-append "/boot" =20 > > =20 > >> + (match arch > >> + ("i686" "ia32") > >> + ("x86_64" "x64") > >> + ("arm" "arm") > >> + ("armhf" "arm") > >> + ("aarch64" "aa64") > >> + ("riscv" "riscv32") > >> + ("riscv64" "riscv64")) > >> + ".efi")) =20 > >=20 > > Also, I have a slight preference for greppable file names even when it'= s a > > little more redundant, so more like that: > >=20 > > (match system-parts > > (("i686" _ ...) "ia32.efi") > > (("x86_64" _ ...) "x64.efi") > > (("arm" _ ...) "arm.efi") > > (("armhf" _ ...) "arm.efi") > > (("aarch64" _ ...) "aa64.efi") > > (("riscv" _ ...) "riscv32.efi") > > (("riscv64" _ ...) "riscv64.efi")) =20 >=20 > I=E2=80=99m not familiar with the match syntax yet. For me using the firs= t element as arch seems simpler. Match just does pattern matching. The pattern here is for example ("i686" = _ ...). That means it will match anything that is a list that is starting with "i68= 6". It will put the remainder (...) into the variable "_" (which is customary to use as "don't care" variable). The major advantage of using "match" is its failure mode. If the thing mat= ched on is not a list (for some unfathomable reason) or if the first element is = not matched on (!) then you get an exception--which is much better than doing w= eird unknown stuff. You have used "match" before--but only on parts of the list. Why not use it on the whole list? It makes little sense to do manual destructuring and th= en use match--when match would have done the destructuring bind anyway. > > Likewise: > >=20 > > (efi-bootloader (match system-parts > > (("i686" _ ...) "i386-efi/core.efi") > > (("x86_64" _ ...) "x86_64-efi/core.efi") > > (("arm" _ ...) "arm-efi/core.efi") > > (("armhf" _ ...) "arm-efi/core.efi") > > (("aarch64" _ ...) "arm64-efi/core.efi") > > (("riscv" _ ...) "riscv32-efi/core.efi") > > (("riscv64" _ ...) "riscv64-efi/core.efi")))) = =20 >=20 > I=E2=80=99d prefer to keep the still grepable =E2=80=9C/core.efi=E2=80=9D= separate. Sure. > And yes, when using =E2=80=98guix system init /etc/config.scm /mnt/here= =E2=80=99, then MOUNT-POINT and TARGET are concatenated. But this is nothin= g specific to the new installer, this is the usual behaviour of Guix and th= e reason for the two parameters TARGET and MOUNT-POINT to any bootloader in= staller. I don=E2=80=99t think stating this inside the new doc-string is th= e right place. Ah, so that's what it means. Well, it should be stated *somewhere* at least. It probably is and I just didn't see it. > Yes, correct. I=E2=80=99ll rework this with the (symlink-relative) functi= on you mentioned. Thanks! > > So TARGET is relative to MOUNT-POINT ? > > And MOUNT-POINT is assumed to have a slash at the end ? =20 >=20 > MOUNT-POINT is either =E2=80=98/=E2=80=99 or depends on the argument to = =E2=80=98guix system init=E2=80=99. On the other side TARGET has to be an a= bsolute path, so it should be safe. At least (install-grub-efi) makes the s= ame mistake. What do you think? If grub-efi does it then it seems to be fine to do it--at least we didn't g= et bug reports caused by it. Let's just keep using it for the time being. > >> + (store-name (car (delete "" (string-split bootloader #= \/)))) =20 > >=20 > > Maybe use match. =20 >=20 > I=E2=80=99ll use (first =E2=80=A6). >=20 > > Also isn't there an official way to find out how the store is called ? > > (%store-prefix) ? =20 >=20 > I only need the first path element to the store, which is usually /gnu. T= he %store-prefix contains /gnu/store then. So it makes no difference. I have no strong opinion either way, except please add a comment that you are extracting part of the store prefix (or whatever) from the in-store name of the bootloader store item. It seems weird to me to do that--but then again I don't get why Guix has two directories (/gnu and /gnu/store) to the store anyway. Fine, I guess. I'm not sure whether it would be technically possible to have a custom store directory like "/foo" without "/gnu" as the store. That would be a problem--and I'm sure someone somewhere does that--otherwise, why have %store-prefix as a variable otherwise? > >> + (store (string-append up1 store-name)) =20 > >=20 > > (string-append escape-target store-name) > > =20 > >> + (store-link (string-append net-dir store-name)) =20 > >=20 > > *mumbles to self* (string-append MOUNT-POINT TARGET) is net-dir. > > So it tries to get to (string-append MOUNT-POINT "/gnu"). =20 >=20 > The trouble is that GRUB shall load a file like /gnu/store/=E2=80=A6-linu= x=E2=80=A6/Image via TFTP, but the TFTP root is actually Guix=E2=80=99 fina= l /boot folder. >=20 > In the end this creates a relative symlink as ../gnu pointing from /mnt/h= ere/boot/gnu to /mnt/here/gnu. >=20 > And GRUB=E2=80=99s =E2=80=9Cworking directory=E2=80=9D to search for its = modules and the grub.cfg is defined by its =E2=80=98prefix=E2=80=99 variabl= e, which is set through the SUBDIR argument, which defaults to Guix=E2=80= =99 final /boot/efi/Guix. >=20 > This requires a relative symlink as ../../../boot/grub/grub.cfg pointing = from /mnt/here/boot/efi/Guix/grub.cfg to /mnt/here/boot/grub/grub.cfg. >=20 > And be aware that TARGET may be /boot, but could be something else like /= tftp-root. Then the symlink would point from /mnt/here/tftp-root/efi/Guix/g= rub.cfg to /mnt/here/boot/grub/grub.cfg, as the later is kind of hard-coded. Please add that to comments in the source code. Otherwise, it would be very probable to be broken by further maintenance. --Sig_/84XO61oIHrsS/4w0YjT3vGx Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9YB60ACgkQ5xo1VCww uqUmIAgAic8c/mwPCrQCQ2NIhg2W6JHUdqKba5gsezZDi3nZe+js+SNZ8UYDgfXu GypYlur6DTfPrTb3VtZxubkJEvmKhGD8Ld7sgziGqKbA8hUY4w7cHaJ6gMkm9XKW cwj59VkY+Y4TqCMO0aM7rPC2zJmI9fIe+v+rwn/BB0VawA55QUuOLEV13Fjni0s7 RspHPkl/YCQuquHDG+Mf7dE3oBRTfXQ0ME4e7XqYPpvdEn/db0IaZUqX+/deP5yA 25FYV9Zx+4LpqZpaXX3TThYpvwWnmGhbsak/DkAoLQIn9Z18YrT+/A+1aXNtORqg nJOLspGdq+s7/DPOsFk9CNk3BQ75Jg== =pqkk -----END PGP SIGNATURE----- --Sig_/84XO61oIHrsS/4w0YjT3vGx-- From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via TFTP. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 13 Sep 2020 17:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Cc: 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.160001917827536 (code B ref 41011); Sun, 13 Sep 2020 17:47:02 +0000 Received: (at 41011) by debbugs.gnu.org; 13 Sep 2020 17:46:18 +0000 Received: from localhost ([127.0.0.1]:51641 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHW4v-0007A3-T6 for submit@debbugs.gnu.org; Sun, 13 Sep 2020 13:46:18 -0400 Received: from vsmx011.vodafonemail.xion.oxcs.net ([153.92.174.89]:36669) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHW4r-00079m-Ho for 41011@debbugs.gnu.org; Sun, 13 Sep 2020 13:46:16 -0400 Received: from vsmx003.vodafonemail.xion.oxcs.net (unknown [192.168.75.197]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTP id 0A5C559D509; Sun, 13 Sep 2020 17:46:07 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [188.100.45.56]) by mta-7-out.mta.xion.oxcs.net (Postfix) with ESMTPA id A6BA1539D16; Sun, 13 Sep 2020 17:46:02 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <20200909003732.5c401932@scratchpost.org> Date: Sun, 13 Sep 2020 19:46:01 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <20200906163559.1b56c36f@scratchpost.org> <45F0D825-F888-42E9-BDAE-7BB6FA010A6E@vodafonemail.de> <20200909003732.5c401932@scratchpost.org> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/bootloader/grub.scm (grub-efi-netboot-bootloader): New bootloader = for network booting. (install-grub-efi-netboot): New bootloader installer for network = booting. (grub-root-search): Set the root to "(tftp)" if the searched file is not = stored on a local devices, i.e. an NFS share. --- gnu/bootloader/grub.scm | 97 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 96 insertions(+), 1 deletion(-) diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index e3febeefd0..552bc34f5a 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -23,8 +23,10 @@ ;;; along with GNU Guix. If not, see . =20 (define-module (gnu bootloader grub) + #:use-module (guix build union) #:use-module (guix records) - #:use-module ((guix utils) #:select (%current-system)) + #:use-module (guix store) + #:use-module ((guix utils) #:select (%current-system = %current-target-system)) #:use-module (guix gexp) #:use-module (gnu artwork) #:use-module (gnu bootloader) @@ -46,8 +48,11 @@ grub-theme-color-highlight grub-theme-gfxmode =20 + install-grub-efi-netboot + grub-bootloader grub-efi-bootloader + grub-efi-netboot-bootloader grub-mkrescue-bootloader grub-minimal-bootloader =20 @@ -295,6 +300,9 @@ code." ((? file-system-label? label) (format #f "search --label --set ~a" (file-system-label->string label))) + ((? (lambda (device) + (and (string? device) (string-contains device ":/"))) = nfs-uri) + "set root=3D(tftp)") ((or #f (? string?)) #~(format #f "search --file --set ~a" #$file))))) =20 @@ -501,6 +509,87 @@ fi~%")))) "--bootloader-id=3DGuix" "--efi-directory" target-esp)))) =20 +(define (install-grub-efi-netboot subdir) + "Define a grub-efi-netboot bootloader installer for installation in = SUBDIR, +which is usually efi/Guix or efi/boot." + (let* ((system (string-split (or (%current-target-system) + (%current-system)) + #\-)) + (boot-efi-link (match system + (("i686" _ ...) "/bootia32.efi") + (("x86_64" _ ...) "/bootx64.efi") + (("arm" _ ...) "/bootarm.efi") + (("armhf" _ ...) "/bootarm.efi") + (("aarch64" _ ...) "/bootaa64.efi") + (("riscv" _ ...) "/bootriscv32.efi") + (("riscv64" _ ...) "/bootriscv64.efi"))) + (efi-bootloader (string-append (match system + (("i686" _ ...) "i386-efi") + (("x86_64" _ ...) = "x86_64-efi") + (("arm" _ ...) "arm-efi") + (("armhf" _ ...) "arm-efi") + (("aarch64" _ ...) = "arm64-efi") + (("riscv" _ ...) = "riscv32-efi") + (("riscv64" _ ...) = "riscv64-efi")) + "/core.efi"))) + (with-imported-modules + '((guix build union)) + #~(lambda (bootloader target mount-point) + "Install the BOOTLOADER, which must be the package grub, as = e.g. +bootx64.efi or bootarm64.efi into SUBDIR, which is usually efi/Guix or = efi/boot, +below the directory TARGET for the system whose root is mounted at = MOUNT-POINT. + +MOUNT-POINT is the last argument in 'guix system init /etc/config.scm = mnt/point' +or '/' for other 'guix system' commands. + +TARGET is the target argument given to the bootloader-configuration in +(operating-system + (bootloader (bootloader-configuration + (target \"/boot\") + =E2=80=A6)) + =E2=80=A6) +TARGET is required to be an absolute path and must be provided by a = TFTP server +as the TFTP root directory. + +GRUB will load tftp://server/SUBDIR/grub.cfg and this file will = instruct it to +load more files from the store like = tftp://server/gnu/store/=E2=80=A6-linux=E2=80=A6/Image. + +To make this possible two symlinks will be created. The first symlink = points +relatively form TARGET/SUBDIR/grub.cfg to /boot/grub/grub.cfg. And the = second +symlink points relatively from TARGET/%store-prefix to %store-prefix. + +It is important to note that these symlinks need to be relativ, as the = absolute +paths on the TFTP server side are unknown. + +It is also important to note that both symlinks will point outside the = TFTP root +directory and that the TARGET/%store-prefix symlink makes the whole = store +accessible via TFTP. Possibly the TFTP server must be configured +to allow accesses outside its TFTP root directory. This may need to be +considered for security aspects." + (use-modules ((guix build union) #:select (symlink-relative))) + (let* ((net-dir (string-append mount-point target "/")) + (sub-dir (string-append net-dir #$subdir "/")) + (store-link (string-append net-dir (%store-prefix))) + (grub-cfg "/boot/grub/grub.cfg") + (grub-cfg-link (string-append sub-dir (basename = grub-cfg))) + (boot-efi-link (string-append sub-dir = #$boot-efi-link))) + ;; Prepare the symlink to the store. + (mkdir-p (dirname store-link)) + (false-if-exception (delete-file store-link)) + (symlink-relative (%store-prefix) store-link) + ;; Prepare the symlink to the grub.cfg, which points into = the store. + (false-if-exception (delete-file grub-cfg-link)) + (symlink-relative grub-cfg grub-cfg-link) + ;; Install GRUB, which refers to the grub.cfg, with support = for + ;; encrypted partitions, + (setenv "GRUB_ENABLE_CRYPTODISK" "y") + (invoke/quiet (string-append bootloader = "/bin/grub-mknetdir") + (string-append "--net-directory=3D" net-dir) + (string-append "--subdir=3D" #$subdir)) + ;; Prepare the bootloader symlink, which points to GRUB. + (false-if-exception (delete-file boot-efi-link)) + (symlink #$efi-bootloader boot-efi-link)))))) + ^L =20 ;;; @@ -533,6 +622,12 @@ fi~%")))) (name 'grub-efi) (package grub-efi))) =20 +(define grub-efi-netboot-bootloader + (bootloader + (inherit grub-efi-bootloader) + (name 'grub-efi-netboot-bootloader) + (installer (install-grub-efi-netboot "efi/Guix")))) + (define grub-mkrescue-bootloader (bootloader (inherit grub-efi-bootloader) --=20 2.26.0 From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via TFTP. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 14 Sep 2020 07:00:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Stefan Cc: Danny Milosavljevic , 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.16000667934479 (code B ref 41011); Mon, 14 Sep 2020 07:00:01 +0000 Received: (at 41011) by debbugs.gnu.org; 14 Sep 2020 06:59:53 +0000 Received: from localhost ([127.0.0.1]:52342 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHiSu-0001A9-Tl for submit@debbugs.gnu.org; Mon, 14 Sep 2020 02:59:53 -0400 Received: from flashner.co.il ([178.62.234.194]:45072) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHiSs-00019v-Ne for 41011@debbugs.gnu.org; Mon, 14 Sep 2020 02:59:51 -0400 Received: from localhost (unknown [31.210.181.177]) by flashner.co.il (Postfix) with ESMTPSA id F045B4026E; Mon, 14 Sep 2020 06:59:43 +0000 (UTC) Date: Mon, 14 Sep 2020 09:59:11 +0300 From: Efraim Flashner Message-ID: <20200914065911.GB1717@E5400> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <20200906163559.1b56c36f@scratchpost.org> <45F0D825-F888-42E9-BDAE-7BB6FA010A6E@vodafonemail.de> <20200909003732.5c401932@scratchpost.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="WhfpMioaduB5tiZL" Content-Disposition: inline In-Reply-To: X-PGP-Key-ID: 0x41AAE7DCCA3D8351 X-PGP-Key: https://flashner.co.il/~efraim/efraim_flashner.asc X-PGP-Fingerprint: A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --WhfpMioaduB5tiZL Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Sep 13, 2020 at 07:46:01PM +0200, Stefan wrote: > * gnu/bootloader/grub.scm (grub-efi-netboot-bootloader): New bootloader f= or > network booting. > (install-grub-efi-netboot): New bootloader installer for network booting. > (grub-root-search): Set the root to "(tftp)" if the searched file is not = stored > on a local devices, i.e. an NFS share. > --- > gnu/bootloader/grub.scm | 97 ++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 96 insertions(+), 1 deletion(-) >=20 > diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm > index e3febeefd0..552bc34f5a 100644 > --- a/gnu/bootloader/grub.scm > +++ b/gnu/bootloader/grub.scm > @@ -23,8 +23,10 @@ > ;;; along with GNU Guix. If not, see . > =20 > (define-module (gnu bootloader grub) > + #:use-module (guix build union) > #:use-module (guix records) > - #:use-module ((guix utils) #:select (%current-system)) > + #:use-module (guix store) > + #:use-module ((guix utils) #:select (%current-system %current-target-s= ystem)) > #:use-module (guix gexp) > #:use-module (gnu artwork) > #:use-module (gnu bootloader) > @@ -46,8 +48,11 @@ > grub-theme-color-highlight > grub-theme-gfxmode > =20 > + install-grub-efi-netboot > + > grub-bootloader > grub-efi-bootloader > + grub-efi-netboot-bootloader > grub-mkrescue-bootloader > grub-minimal-bootloader > =20 > @@ -295,6 +300,9 @@ code." > ((? file-system-label? label) > (format #f "search --label --set ~a" > (file-system-label->string label))) > + ((? (lambda (device) > + (and (string? device) (string-contains device ":/"))) nfs-= uri) > + "set root=3D(tftp)") > ((or #f (? string?)) > #~(format #f "search --file --set ~a" #$file))))) > =20 > @@ -501,6 +509,87 @@ fi~%")))) > "--bootloader-id=3DGuix" > "--efi-directory" target-esp)))) > =20 > +(define (install-grub-efi-netboot subdir) > + "Define a grub-efi-netboot bootloader installer for installation in SU= BDIR, > +which is usually efi/Guix or efi/boot." > + (let* ((system (string-split (or (%current-target-system) > + (%current-system)) > + #\-)) > + (boot-efi-link (match system > + (("i686" _ ...) "/bootia32.efi") > + (("x86_64" _ ...) "/bootx64.efi") > + (("arm" _ ...) "/bootarm.efi") > + (("armhf" _ ...) "/bootarm.efi") > + (("aarch64" _ ...) "/bootaa64.efi") > + (("riscv" _ ...) "/bootriscv32.efi") > + (("riscv64" _ ...) "/bootriscv64.efi"))) Don't forget the fall-through case, even if it's just ((_ ...) "/bootTODO.efi") > + (efi-bootloader (string-append (match system > + (("i686" _ ...) "i386-efi") > + (("x86_64" _ ...) "x86_64-efi") > + (("arm" _ ...) "arm-efi") > + (("armhf" _ ...) "arm-efi") > + (("aarch64" _ ...) "arm64-efi") > + (("riscv" _ ...) "riscv32-efi") > + (("riscv64" _ ...) "riscv64-ef= i")) > + "/core.efi"))) With the fall-through case here, can this be changed to (("i686" _ ...) "i386-efi") (("aarch64" _ ...) "arm64-efi") (("riscv" _ ...) "riscv32-efi") ((_ ...) (string-append (first (string-split (nix-system->gnu-triplet (or (%current-system) (%current-target-system))) #\_)) "-efi")) > + (with-imported-modules > + '((guix build union)) > + #~(lambda (bootloader target mount-point) > + "Install the BOOTLOADER, which must be the package grub, as e.g. > +bootx64.efi or bootarm64.efi into SUBDIR, which is usually efi/Guix or e= fi/boot, > +below the directory TARGET for the system whose root is mounted at MOUNT= -POINT. > + > +MOUNT-POINT is the last argument in 'guix system init /etc/config.scm mn= t/point' > +or '/' for other 'guix system' commands. > + > +TARGET is the target argument given to the bootloader-configuration in > +(operating-system > + (bootloader (bootloader-configuration > + (target \"/boot\") > + =E2=80=A6)) > + =E2=80=A6) > +TARGET is required to be an absolute path and must be provided by a TFTP= server > +as the TFTP root directory. > + > +GRUB will load tftp://server/SUBDIR/grub.cfg and this file will instruct= it to > +load more files from the store like tftp://server/gnu/store/=E2=80=A6-li= nux=E2=80=A6/Image. > + > +To make this possible two symlinks will be created. The first symlink po= ints > +relatively form TARGET/SUBDIR/grub.cfg to /boot/grub/grub.cfg. And the s= econd > +symlink points relatively from TARGET/%store-prefix to %store-prefix. > + > +It is important to note that these symlinks need to be relativ, as the a= bsolute > +paths on the TFTP server side are unknown. > + > +It is also important to note that both symlinks will point outside the T= FTP root > +directory and that the TARGET/%store-prefix symlink makes the whole store > +accessible via TFTP. Possibly the TFTP server must be configured > +to allow accesses outside its TFTP root directory. This may need to be > +considered for security aspects." > + (use-modules ((guix build union) #:select (symlink-relative))) > + (let* ((net-dir (string-append mount-point target "/")) > + (sub-dir (string-append net-dir #$subdir "/")) > + (store-link (string-append net-dir (%store-prefix))) > + (grub-cfg "/boot/grub/grub.cfg") > + (grub-cfg-link (string-append sub-dir (basename grub-cfg= ))) > + (boot-efi-link (string-append sub-dir #$boot-efi-link))) > + ;; Prepare the symlink to the store. > + (mkdir-p (dirname store-link)) > + (false-if-exception (delete-file store-link)) > + (symlink-relative (%store-prefix) store-link) > + ;; Prepare the symlink to the grub.cfg, which points into the= store. > + (false-if-exception (delete-file grub-cfg-link)) > + (symlink-relative grub-cfg grub-cfg-link) > + ;; Install GRUB, which refers to the grub.cfg, with support f= or > + ;; encrypted partitions, > + (setenv "GRUB_ENABLE_CRYPTODISK" "y") > + (invoke/quiet (string-append bootloader "/bin/grub-mknetdir") > + (string-append "--net-directory=3D" net-dir) > + (string-append "--subdir=3D" #$subdir)) > + ;; Prepare the bootloader symlink, which points to GRUB. > + (false-if-exception (delete-file boot-efi-link)) > + (symlink #$efi-bootloader boot-efi-link)))))) > + > ^L > =20 > ;;; > @@ -533,6 +622,12 @@ fi~%")))) > (name 'grub-efi) > (package grub-efi))) > =20 > +(define grub-efi-netboot-bootloader > + (bootloader > + (inherit grub-efi-bootloader) > + (name 'grub-efi-netboot-bootloader) > + (installer (install-grub-efi-netboot "efi/Guix")))) > + > (define grub-mkrescue-bootloader > (bootloader > (inherit grub-efi-bootloader) > --=20 > 2.26.0 >=20 >=20 >=20 >=20 --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --WhfpMioaduB5tiZL Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl9fFLwACgkQQarn3Mo9 g1EzNRAAko3gKkTrjuf5KM09R8v9c9AsYdYwcItQJlT661CLbKwb4okLv3Hf9qNT BuKdEwnYfz0AVaELTLrWZlJ5GA8u+k7d4b2WOFCiWwI3jEzKjSboQ3f5ZaA6lRiA pjTzVP3Mjbhy4YgClp/2ZxJ/rAfE0thaDaNzQt7RMKpxqqLcyLHD3KC7q7MCST8b N7Tf1CXz25qV3QvKSc2hJRmj7ts1IOI8J06OoHfzir5VGm4JWpEjGrmkGaKcT84j QIYArNKdZ+m1TeBPUDRJIBwgAmuS2fm5ZzWIhmfpVROPnLmge1Gq0qdfTonm7p9f 0Swn1+NwJrwxImkcFJsK5KWQz9WYHilvS/KcOyPbwGFXsIFBUA3GqDwMBIGBTRuH GFModEsnit6eNrTmxSeShkPAIifc2zPcYAMEiPfwanYXg1S9IyDLVpgNrC9w0glT gY99OPsxV5dcTEHYvmbZ4QoUM1M19NIDbcWNkBkNdO/cF5nAoyqA+/ac06aNfkjM q8t2m04W4VhH2NXGVZLozfkDD8WUQD9mAQH7LxCn9lZSUs5kq7kfKI0G2OtxNkb2 6KYTXljurDSg6J853Rro1etTFdW95GVS71ElTrxglZgnoQ4zhnwMPeK9otmpZImI RyCCUeA/FiAvV5/PPsyuqeLBpr+tauQpPlHnjehN6afXcqma1Dg= =fG1h -----END PGP SIGNATURE----- --WhfpMioaduB5tiZL-- From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via TFTP. Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 14 Sep 2020 12:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Stefan Cc: 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.160008688530675 (code B ref 41011); Mon, 14 Sep 2020 12:35:02 +0000 Received: (at 41011) by debbugs.gnu.org; 14 Sep 2020 12:34:45 +0000 Received: from localhost ([127.0.0.1]:52988 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHngy-0007yg-UC for submit@debbugs.gnu.org; Mon, 14 Sep 2020 08:34:45 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:38678) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHngx-0007yX-9R for 41011@debbugs.gnu.org; Mon, 14 Sep 2020 08:34:43 -0400 Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at [80.110.126.103]) by dd26836.kasserver.com (Postfix) with ESMTPSA id CC40C3368786; Mon, 14 Sep 2020 14:34:40 +0200 (CEST) Date: Mon, 14 Sep 2020 14:34:25 +0200 From: Danny Milosavljevic Message-ID: <20200914143425.4fd44411@scratchpost.org> In-Reply-To: References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <20200906163559.1b56c36f@scratchpost.org> <45F0D825-F888-42E9-BDAE-7BB6FA010A6E@vodafonemail.de> <20200909003732.5c401932@scratchpost.org> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/+WfMwVAzatxc=4JCDcp+2TN"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/+WfMwVAzatxc=4JCDcp+2TN Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Stefan, On Sun, 13 Sep 2020 19:46:01 +0200 Stefan wrote: > diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm > index e3febeefd0..552bc34f5a 100644 > --- a/gnu/bootloader/grub.scm > +++ b/gnu/bootloader/grub.scm > @@ -295,6 +300,9 @@ code." > ((? file-system-label? label) > (format #f "search --label --set ~a" > (file-system-label->string label))) > + ((? (lambda (device) > + (and (string? device) (string-contains device ":/"))) nfs-= uri) > + "set root=3D(tftp)") > ((or #f (? string?)) > #~(format #f "search --file --set ~a" #$file))))) After careful consideration, I've pushed this to guix master, with a big comment in the source code as to why we are doing what we are doing. I can see no downside to defaulting to TFTP for the time being. I do wonder if there are cases now where Grub tries to use TFTP when the us= er meant to boot locally--but nothing comes to mind.=20 Thank you for your elaborative E-Mails. I will still review the remainder. Please take Efraim's comments into consideration. --Sig_/+WfMwVAzatxc=4JCDcp+2TN Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9fY1EACgkQ5xo1VCww uqX5DggAkJs1l5lsqlplWwFjm9X2W2gldMfpf1dsO5w4KWwP5gJWW5B+IzqLb/IA Jp/D+sHsp2vSBwo+zzNUTazna+T0ky89moeiiDafp0vFHNFcCJdYi5/a/mo5779W mPojnDObZP6bozTmPNLtxenWlzZgDi3rRZdfsnRctslD0kVouBFUueh3bk3nEMFe yKf2Ux9OCUvIlw/ep7Cw2sO5luAZdTshcqzddX1BJVXyqtkCRuIYg5SkP7a8yHXT fNNe/tsyNN4KstOIq/oxXdgRXgEK3d9v6CwCKAfCH7DnI/QysQ4RI0PahFmxuyvn KbiFt6OZnIlKWUDiEYnH8nz6HCMY2A== =jG9D -----END PGP SIGNATURE----- --Sig_/+WfMwVAzatxc=4JCDcp+2TN-- From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via TFTP. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 15 Sep 2020 20:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Efraim Flashner Cc: Danny Milosavljevic , 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.16002017499626 (code B ref 41011); Tue, 15 Sep 2020 20:30:02 +0000 Received: (at 41011) by debbugs.gnu.org; 15 Sep 2020 20:29:09 +0000 Received: from localhost ([127.0.0.1]:60653 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kIHZc-0002VC-Vw for submit@debbugs.gnu.org; Tue, 15 Sep 2020 16:29:09 -0400 Received: from vsmx011.vodafonemail.xion.oxcs.net ([153.92.174.89]:52544) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kIHZb-0002Ul-AD for 41011@debbugs.gnu.org; Tue, 15 Sep 2020 16:29:08 -0400 Received: from vsmx003.vodafonemail.xion.oxcs.net (unknown [192.168.75.197]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTP id 0445B59D9E3; Tue, 15 Sep 2020 20:29:01 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [188.100.45.56]) by mta-7-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 5C83C539B0A; Tue, 15 Sep 2020 20:28:54 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <20200914065911.GB1717@E5400> Date: Tue, 15 Sep 2020 22:28:53 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <20200906163559.1b56c36f@scratchpost.org> <45F0D825-F888-42E9-BDAE-7BB6FA010A6E@vodafonemail.de> <20200909003732.5c401932@scratchpost.org> <20200914065911.GB1717@E5400> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Efraim! >> + (boot-efi-link (match system >> + (("i686" _ ...) "/bootia32.efi") >> + (("x86_64" _ ...) "/bootx64.efi") >> + (("arm" _ ...) "/bootarm.efi") >> + (("armhf" _ ...) "/bootarm.efi") >> + (("aarch64" _ ...) "/bootaa64.efi") >> + (("riscv" _ ...) "/bootriscv32.efi") >> + (("riscv64" _ ...) "/bootriscv64.efi"))) >=20 > Don't forget the fall-through case, even if it's just > ((_ ...) "/bootTODO.efi") There was a contradicting remark by Danny: > The major advantage of using "match" is its failure mode. If the = thing matched > on is not a list (for some unfathomable reason) or if the first = element is not > matched on (!) then you get an exception--which is much better than = doing weird > unknown stuff. Actually I would prefer an error here as well. Imagine a successful = =E2=80=98guix system init=E2=80=99 silently creating a bootTODO.efi. = Booting that system will certainly fail and someone will have a hard = time to figure out that the generated bootTODO.efi is the reason. >> + (efi-bootloader (string-append (match system >> + (("i686" _ ...) = "i386-efi") >> + (("x86_64" _ ...) = "x86_64-efi") >> + (("arm" _ ...) "arm-efi") >> + (("armhf" _ ...) = "arm-efi") >> + (("aarch64" _ ...) = "arm64-efi") >> + (("riscv" _ ...) = "riscv32-efi") >> + (("riscv64" _ ...) = "riscv64-efi")) >> + "/core.efi"))) >=20 > With the fall-through case here, can this be changed to > (("i686" _ ...) "i386-efi") > (("aarch64" _ ...) "arm64-efi") > (("riscv" _ ...) "riscv32-efi") > ((_ ...) (string-append (first > (string-split > (nix-system->gnu-triplet > (or (%current-system) > (%current-target-system))) > #\_)) > "-efi")) There was a contradicting remark by Danny, which applies to the first = part as well: > Also, I have a slight preference for greppable file names even when = it's a > little more redundant I understand your point in generating the arch part. I also understand = the usage of (nix-system->gnu-triplet) to convert armhf to arm. I also = think the risk is low that the first part raises no error and this part = is doing something wrong without raising an error, too, leading to a not = booting system. So having a default here seems fine to me. However, Danny=E2=80=99s argument is convincing, too. And keeping this = block similar to the first block eases the understanding, at least mine. = My first thought seeing your suggestion was: =E2=80=9CWhy does this = block need to be different from the other and what is this code doing = differently?=E2=80=9D What do you think? Bye Stefan From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via TFTP. Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 15 Sep 2020 22:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Stefan Cc: 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.160020788419093 (code B ref 41011); Tue, 15 Sep 2020 22:12:01 +0000 Received: (at 41011) by debbugs.gnu.org; 15 Sep 2020 22:11:24 +0000 Received: from localhost ([127.0.0.1]:60753 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kIJAa-0004xs-9z for submit@debbugs.gnu.org; Tue, 15 Sep 2020 18:11:24 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:52896) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kIJAY-0004xj-6w for 41011@debbugs.gnu.org; Tue, 15 Sep 2020 18:11:22 -0400 Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at [80.110.126.103]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 625F33362145; Wed, 16 Sep 2020 00:11:20 +0200 (CEST) Date: Wed, 16 Sep 2020 00:10:34 +0200 From: Danny Milosavljevic Message-ID: <20200916000927.34dbbc56@scratchpost.org> In-Reply-To: References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <20200906163559.1b56c36f@scratchpost.org> <45F0D825-F888-42E9-BDAE-7BB6FA010A6E@vodafonemail.de> <20200909003732.5c401932@scratchpost.org> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/t5ZqBQ0bTIqcT6L40J4W0n_"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/t5ZqBQ0bTIqcT6L40J4W0n_ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hello Stefan, I have reviewed this new patch and it looks good to me. There's one thing, though: Where does this new bootloader get used? I think--from reading the source code and from your previous comments--that= the bootloader gets installed on the TFTP server, but as files to be served, no= t to boot the TFTP server itself. One is basically using "guix system init" to initialize an operating system, complete with bootloader--only it is served by an TFTP server instead of booted locally. Is that correct? If so, I think we should document that fact--because that= 's absolutely not obvious to a casual observer. Also, the same files also need to be exported by an NFS server on the same host as the TFTP server (which is a limitation. I understand the rationale, but the limitation has to be documented). This should be documented not in the bootloader (which does not require NFS at all, right?), but in doc/guix.texi--where ideally we'd document an example system configuration for it. I'll leave a week for comments and then will merge either this version or an eventual newer version to guix master. Thanks. --Sig_/t5ZqBQ0bTIqcT6L40J4W0n_ Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9hO9oACgkQ5xo1VCww uqVLDgf/dp14MfGizbaogSlGAz3G03P/RB73wH8n6xo92mevstgkcMlnGxuc8D0C /HyPvgNyOuOBJ1Xzp79LVU2Pb7Ett9/MP/yZlMjFsICnAcUEAlH7RRlIBP6spXgb Ha7aB/mgBbiBj3iO3z7NU4XOED1NWYSMt1oLYsqaWQM0XURRgLjUwOkBcMZkfQp5 tQwgs7ubuxCS8N6r0pg0OfsC/QRYuZvf7g49eT86hpxILJnMEARAGF7I7vmYCldq 2WdigwelH+1SK2nzCzWxBPC9e7O3RQ0p+qIaW7QGgpETkx3DEqJMgZw151xuhi4y ywXDnxtvD+hUrf3pG/UaSSPmtvm7EQ== =pc9Y -----END PGP SIGNATURE----- --Sig_/t5ZqBQ0bTIqcT6L40J4W0n_-- From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via TFTP. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 16 Sep 2020 07:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Stefan Cc: Danny Milosavljevic , 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.160024272017383 (code B ref 41011); Wed, 16 Sep 2020 07:52:01 +0000 Received: (at 41011) by debbugs.gnu.org; 16 Sep 2020 07:52:00 +0000 Received: from localhost ([127.0.0.1]:33108 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kISES-0004WI-0s for submit@debbugs.gnu.org; Wed, 16 Sep 2020 03:52:00 -0400 Received: from flashner.co.il ([178.62.234.194]:53700) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kISEP-0004W2-16 for 41011@debbugs.gnu.org; Wed, 16 Sep 2020 03:51:58 -0400 Received: from localhost (unknown [31.210.181.177]) by flashner.co.il (Postfix) with ESMTPSA id 742B740037; Wed, 16 Sep 2020 07:51:50 +0000 (UTC) Date: Wed, 16 Sep 2020 10:51:17 +0300 From: Efraim Flashner Message-ID: <20200916075117.GE19874@E5400> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <20200906163559.1b56c36f@scratchpost.org> <45F0D825-F888-42E9-BDAE-7BB6FA010A6E@vodafonemail.de> <20200909003732.5c401932@scratchpost.org> <20200914065911.GB1717@E5400> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="vJguvTgX93MxBIIe" Content-Disposition: inline In-Reply-To: X-PGP-Key-ID: 0x41AAE7DCCA3D8351 X-PGP-Key: https://flashner.co.il/~efraim/efraim_flashner.asc X-PGP-Fingerprint: A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --vJguvTgX93MxBIIe Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 15, 2020 at 10:28:53PM +0200, Stefan wrote: > Hi Efraim! >=20 > >> + (boot-efi-link (match system > >> + (("i686" _ ...) "/bootia32.efi") > >> + (("x86_64" _ ...) "/bootx64.efi") > >> + (("arm" _ ...) "/bootarm.efi") > >> + (("armhf" _ ...) "/bootarm.efi") > >> + (("aarch64" _ ...) "/bootaa64.efi") > >> + (("riscv" _ ...) "/bootriscv32.efi") > >> + (("riscv64" _ ...) "/bootriscv64.efi"))) > >=20 > > Don't forget the fall-through case, even if it's just > > ((_ ...) "/bootTODO.efi") >=20 > There was a contradicting remark by Danny: >=20 > > The major advantage of using "match" is its failure mode. If the thing= matched > > on is not a list (for some unfathomable reason) or if the first element= is not > > matched on (!) then you get an exception--which is much better than doi= ng weird > > unknown stuff. >=20 > Actually I would prefer an error here as well. Imagine a successful =E2= =80=98guix system init=E2=80=99 silently creating a bootTODO.efi. Booting t= hat system will certainly fail and someone will have a hard time to figure = out that the generated bootTODO.efi is the reason. >=20 My concern is more for architectures which aren't on the list having unfortunate errors while doing something unrelated. Another option then I suppose would be ((_ ...) #f) It should still fail if you try to use it but there's still a code path for, say, ppc64el. I like the #f idea better than bootTODO.efi. > >> + (efi-bootloader (string-append (match system > >> + (("i686" _ ...) "i386-efi") > >> + (("x86_64" _ ...) "x86_64-e= fi") > >> + (("arm" _ ...) "arm-efi") > >> + (("armhf" _ ...) "arm-efi") > >> + (("aarch64" _ ...) "arm64-e= fi") > >> + (("riscv" _ ...) "riscv32-e= fi") > >> + (("riscv64" _ ...) "riscv64= -efi")) > >> + "/core.efi"))) > >=20 > > With the fall-through case here, can this be changed to > > (("i686" _ ...) "i386-efi") > > (("aarch64" _ ...) "arm64-efi") > > (("riscv" _ ...) "riscv32-efi") > > ((_ ...) (string-append (first > > (string-split > > (nix-system->gnu-triplet > > (or (%current-system) > > (%current-target-system))) > > #\_)) > > "-efi")) I re-noticed that system is passed above so my code block could be a bit more contained ((_ ...) (string-append (first (string-split (nix-system->gnu-triplet system) #\_)) "-efi")) >=20 > There was a contradicting remark by Danny, which applies to the first par= t as well: >=20 > > Also, I have a slight preference for greppable file names even when it'= s a > > little more redundant >=20 > I understand your point in generating the arch part. I also understand th= e usage of (nix-system->gnu-triplet) to convert armhf to arm. I also think = the risk is low that the first part raises no error and this part is doing = something wrong without raising an error, too, leading to a not booting sys= tem. So having a default here seems fine to me. >=20 > However, Danny=E2=80=99s argument is convincing, too. And keeping this bl= ock similar to the first block eases the understanding, at least mine. My f= irst thought seeing your suggestion was: =E2=80=9CWhy does this block need = to be different from the other and what is this code doing differently?=E2= =80=9D >=20 > What do you think? >=20 The benefit is that there's less chance of typoing a mistake in the code, either when writing it or when editing it later. There's also the benefit again of not dismissing architectures which are currently not listed in the list. For something greppable, I don't really have a counter argument. Perhaps a hand-wavey "code correctness" of reusing macros. For unsupported architectures, ((_ ...) #f) again would work to make sure there is at least a code path which would definitely fail if someone tried to use it. That's my primary concern. >=20 > Bye >=20 > Stefan >=20 Thanks --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --vJguvTgX93MxBIIe Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl9hw/IACgkQQarn3Mo9 g1GYlRAAmDWgGgK5tBj+7DeNHaqgqqdGGi1hzb8i6Due9jyJ6b/2o3EeOaYCkbQ/ 7oLhNAH1zbqzftH8Uev7XcZEDBak62Zpld7Y7Optv9zC/hBgaVe/vkTkeYPCATll lxLdHTre4xbfyzLV+0fx+QEDn78CtIRylDt03D2AlYvGXivb4W6DvMv0nzzd9Hmm xDh/a8kz5uSf8Yg9GRl1C8bgwphKjJLLtB+bHFxzZ4hfH0ifVoev7gv6XcOOqCZD U0a98bDwtl3+8inNqpwTKf3cMfar7rFCSfyH+1TVX9rip+YDkcxY3SAabPimeILY IxJI3U5lCwjD4KPAYQJcoVe9Re072U8Az0xjUOHSOCsQfh4vyiHYgQE+LtK4GBDO t+5TbDbtwO9gTww5r+FDB2VphYccxRcqRKv5kYiPwzIcQACjye6ayiv7F+qKZVew LkntuZVdFmmh38ypdD7qey/w4H4WpxdUv4fdcm1jkb4WkZ8BCIvW1tkM0u4hLa2H 7kpcDgqrcGUkL9qhbChS2yacpaSkzcjKN/HgqxkQH9iO8b0OFqzirLCxsEx5DR6o 2iQNPDBdxkshbHffTm+u2ynOO+ECCdD28qb2dX+4H64T2i7T56Z26AHLHzoAnFYP S6xL6i0wBNjfwvv+AoX3rHYv46OsVPL6cE47uCHIr+/i+TJWQ9s= =E7hx -----END PGP SIGNATURE----- --vJguvTgX93MxBIIe-- From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via TFTP. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 19 Sep 2020 17:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Cc: 41011@debbugs.gnu.org, Efraim Flashner Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.16005380759698 (code B ref 41011); Sat, 19 Sep 2020 17:55:02 +0000 Received: (at 41011) by debbugs.gnu.org; 19 Sep 2020 17:54:35 +0000 Received: from localhost ([127.0.0.1]:48057 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJh4F-0002WL-55 for submit@debbugs.gnu.org; Sat, 19 Sep 2020 13:54:35 -0400 Received: from mx009.vodafonemail.xion.oxcs.net ([153.92.174.39]:51300) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJh4A-0002Vp-QG for 41011@debbugs.gnu.org; Sat, 19 Sep 2020 13:54:34 -0400 Received: from vsmx002.vodafonemail.xion.oxcs.net (unknown [192.168.75.192]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTP id 46E1C6048DB; Sat, 19 Sep 2020 17:54:24 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [2.206.141.21]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 85ACE6047C9; Sat, 19 Sep 2020 17:54:17 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <20200916075117.GE19874@E5400> Date: Sat, 19 Sep 2020 19:54:16 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <5C85E809-92D7-48F2-A8E2-2DF57460A6D9@vodafonemail.de> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <20200906163559.1b56c36f@scratchpost.org> <45F0D825-F888-42E9-BDAE-7BB6FA010A6E@vodafonemail.de> <20200909003732.5c401932@scratchpost.org> <20200914065911.GB1717@E5400> <20200916075117.GE19874@E5400> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * gnu/bootloader/grub.scm (grub-efi-netboot-bootloader): New bootloader = for network booting. (install-grub-efi-netboot): New bootloader installer for network = booting. (grub-root-search): Set the root to "(tftp)" if the searched file is not = stored on a local devices, i.e. an NFS share. --- gnu/bootloader/grub.scm | 106 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 105 insertions(+), 1 deletion(-) diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index e3febeefd0..211c314f4d 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -23,8 +23,10 @@ ;;; along with GNU Guix. If not, see . =20 (define-module (gnu bootloader grub) + #:use-module (guix build union) #:use-module (guix records) - #:use-module ((guix utils) #:select (%current-system)) + #:use-module (guix store) + #:use-module (guix utils) #:use-module (guix gexp) #:use-module (gnu artwork) #:use-module (gnu bootloader) @@ -46,8 +48,11 @@ grub-theme-color-highlight grub-theme-gfxmode =20 + install-grub-efi-netboot + grub-bootloader grub-efi-bootloader + grub-efi-netboot-bootloader grub-mkrescue-bootloader grub-minimal-bootloader =20 @@ -295,6 +300,9 @@ code." ((? file-system-label? label) (format #f "search --label --set ~a" (file-system-label->string label))) + ((? (lambda (device) + (and (string? device) (string-contains device ":/"))) = nfs-uri) + "set root=3D(tftp)") ((or #f (? string?)) #~(format #f "search --file --set ~a" #$file))))) =20 @@ -501,6 +509,96 @@ fi~%")))) "--bootloader-id=3DGuix" "--efi-directory" target-esp)))) =20 +(define (install-grub-efi-netboot subdir) + "Define a grub-efi-netboot bootloader installer for installation in = SUBDIR, +which is usually efi/Guix or efi/boot." + (let* ((system (string-split (nix-system->gnu-triplet + (or (%current-target-system) + (%current-system))) + #\-)) + (arch (first system)) + (boot-efi-link (match system + ;; These are the supportend systems and the = names + ;; defined by the UEFI standard for removable = media. + (("i686" _ ...) "/bootia32.efi") + (("x86_64" _ ...) "/bootx64.efi") + (("arm" _ ...) "/bootarm.efi") + (("aarch64" _ ...) "/bootaa64.efi") + (("riscv" _ ...) "/bootriscv32.efi") + (("riscv64" _ ...) "/bootriscv64.efi") + ;; Other systems are not supported, although = defined. + ;; (("riscv128" _ ...) "/bootriscv128.efi") + ;; (("ia64" _ ...) "/bootia64.efi") + ((_ ...) #f))) + (efi-bootloader (string-append + ;; This is the arch dependent file name of = GRUB, e.g. + ;; i368-efi/core.efi or arm64-efi/core.efi. + (match arch + ("i686" "i386") + ("aarch64" "arm64") + ("riscv" "riscv32") + (_ arch)) + "-efi/core.efi"))) + (with-imported-modules + '((guix build union)) + #~(lambda (bootloader target mount-point) + "Install the BOOTLOADER, which must be the package grub, as = e.g. +bootx64.efi or bootaa64.efi into SUBDIR, which is usually efi/Guix or = efi/boot, +below the directory TARGET for the system whose root is mounted at = MOUNT-POINT. + +MOUNT-POINT is the last argument in 'guix system init /etc/config.scm = mnt/point' +or '/' for other 'guix system' commands. + +TARGET is the target argument given to the bootloader-configuration in + +(operating-system + (bootloader (bootloader-configuration + (target \"/boot\") + =E2=80=A6)) + =E2=80=A6) + +TARGET is required to be an absolute directory name, usually mounted = via NFS, +and finally needs to be provided by a TFTP server as the TFTP root = directory. + +GRUB will load tftp://server/SUBDIR/grub.cfg and this file will = instruct it to +load more files from the store like = tftp://server/gnu/store/=E2=80=A6-linux=E2=80=A6/Image. + +To make this possible two symlinks will be created. The first symlink = points +relatively form TARGET/SUBDIR/grub.cfg to /boot/grub/grub.cfg. And the = second +symlink points relatively from TARGET/%store-prefix to %store-prefix. + +It is important to note that these symlinks need to be relativ, as the = absolute +paths on the TFTP server side are unknown. + +It is also important to note that both symlinks will point outside the = TFTP root +directory and that the TARGET/%store-prefix symlink makes the whole = store +accessible via TFTP. Possibly the TFTP server must be configured +to allow accesses outside its TFTP root directory. This may need to be +considered for security aspects." + (use-modules ((guix build union) #:select (symlink-relative))) + (let* ((net-dir (string-append mount-point target "/")) + (sub-dir (string-append net-dir #$subdir "/")) + (store-link (string-append net-dir (%store-prefix))) + (grub-cfg "/boot/grub/grub.cfg") + (grub-cfg-link (string-append sub-dir (basename = grub-cfg))) + (boot-efi-link (string-append sub-dir = #$boot-efi-link))) + ;; Prepare the symlink to the store. + (mkdir-p (dirname store-link)) + (false-if-exception (delete-file store-link)) + (symlink-relative (%store-prefix) store-link) + ;; Prepare the symlink to the grub.cfg, which points into = the store. + (false-if-exception (delete-file grub-cfg-link)) + (symlink-relative grub-cfg grub-cfg-link) + ;; Install GRUB, which refers to the grub.cfg, with support = for + ;; encrypted partitions, + (setenv "GRUB_ENABLE_CRYPTODISK" "y") + (invoke/quiet (string-append bootloader = "/bin/grub-mknetdir") + (string-append "--net-directory=3D" net-dir) + (string-append "--subdir=3D" #$subdir)) + ;; Prepare the bootloader symlink, which points to GRUB. + (false-if-exception (delete-file boot-efi-link)) + (symlink #$efi-bootloader boot-efi-link)))))) + ^L =20 ;;; @@ -533,6 +631,12 @@ fi~%")))) (name 'grub-efi) (package grub-efi))) =20 +(define grub-efi-netboot-bootloader + (bootloader + (inherit grub-efi-bootloader) + (name 'grub-efi-netboot-bootloader) + (installer (install-grub-efi-netboot "efi/Guix")))) + (define grub-mkrescue-bootloader (bootloader (inherit grub-efi-bootloader) --=20 2.26.0 From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via TFTP. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 20 Sep 2020 11:48:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Cc: 41011@debbugs.gnu.org, Efraim Flashner Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.16006024728112 (code B ref 41011); Sun, 20 Sep 2020 11:48:03 +0000 Received: (at 41011) by debbugs.gnu.org; 20 Sep 2020 11:47:52 +0000 Received: from localhost ([127.0.0.1]:49041 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJxot-00026V-7d for submit@debbugs.gnu.org; Sun, 20 Sep 2020 07:47:51 -0400 Received: from vsmx009.vodafonemail.xion.oxcs.net ([153.92.174.87]:20533) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJxon-0001yp-EE for 41011@debbugs.gnu.org; Sun, 20 Sep 2020 07:47:46 -0400 Received: from vsmx001.vodafonemail.xion.oxcs.net (unknown [192.168.75.191]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTP id F1766159DAA9; Sun, 20 Sep 2020 11:47:38 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [2.206.141.21]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 348F3159DB76; Sun, 20 Sep 2020 11:47:32 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <5C85E809-92D7-48F2-A8E2-2DF57460A6D9@vodafonemail.de> Date: Sun, 20 Sep 2020 13:47:31 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <20200906163559.1b56c36f@scratchpost.org> <45F0D825-F888-42E9-BDAE-7BB6FA010A6E@vodafonemail.de> <20200909003732.5c401932@scratchpost.org> <20200914065911.GB1717@E5400> <20200916075117.GE19874@E5400> <5C85E809-92D7-48F2-A8E2-2DF57460A6D9@vodafonemail.de> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/bootloader/grub.scm (grub-efi-netboot-bootloader): New bootloader = for network booting. (install-grub-efi-netboot): New bootloader installer for network = booting. (grub-root-search): Set the root to "(tftp)" if the searched file is not = stored on a local devices, i.e. an NFS share. --- gnu/bootloader/grub.scm | 111 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 107 insertions(+), 4 deletions(-) diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index f69bf8ed4d..fe771b2631 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -23,8 +23,10 @@ ;;; along with GNU Guix. If not, see . =20 (define-module (gnu bootloader grub) + #:use-module (guix build union) #:use-module (guix records) - #:use-module ((guix utils) #:select (%current-system)) + #:use-module (guix store) + #:use-module (guix utils) #:use-module (guix gexp) #:use-module (gnu artwork) #:use-module (gnu bootloader) @@ -46,8 +48,11 @@ grub-theme-color-highlight grub-theme-gfxmode =20 + install-grub-efi-netboot + grub-bootloader grub-efi-bootloader + grub-efi-netboot-bootloader grub-mkrescue-bootloader grub-minimal-bootloader =20 @@ -297,9 +302,11 @@ code." (file-system-label->string label))) ((? (lambda (device) (and (string? device) (string-contains device ":/"))) = nfs-uri) - ;; This assumes that if your root file system is on NFS, then - ;; you also want to load your grub extra files, kernel and = initrd - ;; from there. + ;; If the device is an NFS share, then we assume that the = expected + ;; file on that device (e.g. the GRUB background image or the = kernel) + ;; has to be loaded over the network. Otherwise we would need = an + ;; additional device information for some local disk to look = for that + ;; file, which we do not have. ;; ;; We explicitly set "root=3D(tftp)" here even though if = grub.cfg ;; had been loaded via TFTP, Grub would have set "root=3D(tftp)"= @@ -528,6 +535,96 @@ fi~%")))) "--bootloader-id=3DGuix" "--efi-directory" target-esp)))) =20 +(define (install-grub-efi-netboot subdir) + "Define a grub-efi-netboot bootloader installer for installation in = SUBDIR, +which is usually efi/Guix or efi/boot." + (let* ((system (string-split (nix-system->gnu-triplet + (or (%current-target-system) + (%current-system))) + #\-)) + (arch (first system)) + (boot-efi-link (match system + ;; These are the supportend systems and the = names + ;; defined by the UEFI standard for removable = media. + (("i686" _ ...) "/bootia32.efi") + (("x86_64" _ ...) "/bootx64.efi") + (("arm" _ ...) "/bootarm.efi") + (("aarch64" _ ...) "/bootaa64.efi") + (("riscv" _ ...) "/bootriscv32.efi") + (("riscv64" _ ...) "/bootriscv64.efi") + ;; Other systems are not supported, although = defined. + ;; (("riscv128" _ ...) "/bootriscv128.efi") + ;; (("ia64" _ ...) "/bootia64.efi") + ((_ ...) #f))) + (efi-bootloader (string-append + ;; This is the arch dependent file name of = GRUB, e.g. + ;; i368-efi/core.efi or arm64-efi/core.efi. + (match arch + ("i686" "i386") + ("aarch64" "arm64") + ("riscv" "riscv32") + (_ arch)) + "-efi/core.efi"))) + (with-imported-modules + '((guix build union)) + #~(lambda (bootloader target mount-point) + "Install the BOOTLOADER, which must be the package grub, as = e.g. +bootx64.efi or bootaa64.efi into SUBDIR, which is usually efi/Guix or = efi/boot, +below the directory TARGET for the system whose root is mounted at = MOUNT-POINT. + +MOUNT-POINT is the last argument in 'guix system init /etc/config.scm = mnt/point' +or '/' for other 'guix system' commands. + +TARGET is the target argument given to the bootloader-configuration in + +(operating-system + (bootloader (bootloader-configuration + (target \"/boot\") + =E2=80=A6)) + =E2=80=A6) + +TARGET is required to be an absolute directory name, usually mounted = via NFS, +and finally needs to be provided by a TFTP server as the TFTP root = directory. + +GRUB will load tftp://server/SUBDIR/grub.cfg and this file will = instruct it to +load more files from the store like = tftp://server/gnu/store/=E2=80=A6-linux=E2=80=A6/Image. + +To make this possible two symlinks will be created. The first symlink = points +relatively form TARGET/SUBDIR/grub.cfg to /boot/grub/grub.cfg. And the = second +symlink points relatively from TARGET/%store-prefix to %store-prefix. + +It is important to note that these symlinks need to be relativ, as the = absolute +paths on the TFTP server side are unknown. + +It is also important to note that both symlinks will point outside the = TFTP root +directory and that the TARGET/%store-prefix symlink makes the whole = store +accessible via TFTP. Possibly the TFTP server must be configured +to allow accesses outside its TFTP root directory. This may need to be +considered for security aspects." + (use-modules ((guix build union) #:select (symlink-relative))) + (let* ((net-dir (string-append mount-point target "/")) + (sub-dir (string-append net-dir #$subdir "/")) + (store-link (string-append net-dir (%store-prefix))) + (grub-cfg "/boot/grub/grub.cfg") + (grub-cfg-link (string-append sub-dir (basename = grub-cfg))) + (boot-efi-link (string-append sub-dir = #$boot-efi-link))) + ;; Prepare the symlink to the store. + (mkdir-p (dirname store-link)) + (false-if-exception (delete-file store-link)) + (symlink-relative (%store-prefix) store-link) + ;; Prepare the symlink to the grub.cfg, which points into = the store. + (false-if-exception (delete-file grub-cfg-link)) + (symlink-relative grub-cfg grub-cfg-link) + ;; Install GRUB, which refers to the grub.cfg, with support = for + ;; encrypted partitions, + (setenv "GRUB_ENABLE_CRYPTODISK" "y") + (invoke/quiet (string-append bootloader = "/bin/grub-mknetdir") + (string-append "--net-directory=3D" net-dir) + (string-append "--subdir=3D" #$subdir)) + ;; Prepare the bootloader symlink, which points to GRUB. + (false-if-exception (delete-file boot-efi-link)) + (symlink #$efi-bootloader boot-efi-link)))))) + ^L =20 ;;; @@ -560,6 +657,12 @@ fi~%")))) (name 'grub-efi) (package grub-efi))) =20 +(define grub-efi-netboot-bootloader + (bootloader + (inherit grub-efi-bootloader) + (name 'grub-efi-netboot-bootloader) + (installer (install-grub-efi-netboot "efi/Guix")))) + (define grub-mkrescue-bootloader (bootloader (inherit grub-efi-bootloader) --=20 2.26.0 From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via TFTP. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 20 Sep 2020 11:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Cc: 41011@debbugs.gnu.org, Efraim Flashner Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.16006029869155 (code B ref 41011); Sun, 20 Sep 2020 11:57:01 +0000 Received: (at 41011) by debbugs.gnu.org; 20 Sep 2020 11:56:26 +0000 Received: from localhost ([127.0.0.1]:49054 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJxxB-0002Nb-MZ for submit@debbugs.gnu.org; Sun, 20 Sep 2020 07:56:25 -0400 Received: from vsmx012.vodafonemail.xion.oxcs.net ([153.92.174.90]:34657) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJxx9-0002NN-60 for 41011@debbugs.gnu.org; Sun, 20 Sep 2020 07:56:24 -0400 Received: from vsmx004.vodafonemail.xion.oxcs.net (unknown [192.168.75.198]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTP id B8ABDF34F90; Sun, 20 Sep 2020 11:56:16 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [2.206.141.21]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 46A7F19AEAE; Sun, 20 Sep 2020 11:56:10 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: Date: Sun, 20 Sep 2020 13:56:09 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <2A23E912-6919-4A4A-A4CC-0C5FB1A5D5C1@vodafonemail.de> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <20200906163559.1b56c36f@scratchpost.org> <45F0D825-F888-42E9-BDAE-7BB6FA010A6E@vodafonemail.de> <20200909003732.5c401932@scratchpost.org> <20200914065911.GB1717@E5400> <20200916075117.GE19874@E5400> <5C85E809-92D7-48F2-A8E2-2DF57460A6D9@vodafonemail.de> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Danny! When rebasing my commit onto the current origin/master, there was a = conflict with your last commit. While reading your comment block, I = noticed that the first paragraph is not quite right, so I did a small = correction. Bye Stefan= From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via TFTP. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 26 Sep 2020 10:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Cc: 41011@debbugs.gnu.org, Efraim Flashner Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.160111756824078 (code B ref 41011); Sat, 26 Sep 2020 10:53:01 +0000 Received: (at 41011) by debbugs.gnu.org; 26 Sep 2020 10:52:48 +0000 Received: from localhost ([127.0.0.1]:45904 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kM7ou-0006GH-AW for submit@debbugs.gnu.org; Sat, 26 Sep 2020 06:52:48 -0400 Received: from vsmx009.vodafonemail.xion.oxcs.net ([153.92.174.87]:18240) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kM7os-0006G3-Rv for 41011@debbugs.gnu.org; Sat, 26 Sep 2020 06:52:47 -0400 Received: from vsmx001.vodafonemail.xion.oxcs.net (unknown [192.168.75.191]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTP id EB20B159DF53; Sat, 26 Sep 2020 10:52:40 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [2.206.141.21]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 79EA0159DF46; Sat, 26 Sep 2020 10:52:34 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <2A23E912-6919-4A4A-A4CC-0C5FB1A5D5C1@vodafonemail.de> Date: Sat, 26 Sep 2020 12:52:33 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <20200906163559.1b56c36f@scratchpost.org> <45F0D825-F888-42E9-BDAE-7BB6FA010A6E@vodafonemail.de> <20200909003732.5c401932@scratchpost.org> <20200914065911.GB1717@E5400> <20200916075117.GE19874@E5400> <5C85E809-92D7-48F2-A8E2-2DF57460A6D9@vodafonemail.de> <2A23E912-6919-4A4A-A4CC-0C5FB1A5D5C1@vodafonemail.de> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Danny! I realised a bug in my last patch: I tried to create the link to the = grub.cfg before the needed sub-directory has been created by = grub-mknetdir. The problem didn't show up before, because due to a previous bootloader = installation that directory was already present. An updated patch with a corrected order follows. Bye Stefan= From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via TFTP. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 26 Sep 2020 10:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Cc: 41011@debbugs.gnu.org, Efraim Flashner Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.160111765824243 (code B ref 41011); Sat, 26 Sep 2020 10:55:02 +0000 Received: (at 41011) by debbugs.gnu.org; 26 Sep 2020 10:54:18 +0000 Received: from localhost ([127.0.0.1]:45912 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kM7qL-0006Ix-Tc for submit@debbugs.gnu.org; Sat, 26 Sep 2020 06:54:18 -0400 Received: from mx009.vodafonemail.xion.oxcs.net ([153.92.174.39]:49776) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kM7qI-0006Ih-Gp for 41011@debbugs.gnu.org; Sat, 26 Sep 2020 06:54:16 -0400 Received: from vsmx002.vodafonemail.xion.oxcs.net (unknown [192.168.75.192]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTP id 5D424604829; Sat, 26 Sep 2020 10:54:08 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [2.206.141.21]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 8FD89604BDC; Sat, 26 Sep 2020 10:54:01 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <2A23E912-6919-4A4A-A4CC-0C5FB1A5D5C1@vodafonemail.de> Date: Sat, 26 Sep 2020 12:54:00 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <066A5D57-B0B1-4FF4-B07B-1A5030AA789F@vodafonemail.de> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <20200906163559.1b56c36f@scratchpost.org> <45F0D825-F888-42E9-BDAE-7BB6FA010A6E@vodafonemail.de> <20200909003732.5c401932@scratchpost.org> <20200914065911.GB1717@E5400> <20200916075117.GE19874@E5400> <5C85E809-92D7-48F2-A8E2-2DF57460A6D9@vodafonemail.de> <2A23E912-6919-4A4A-A4CC-0C5FB1A5D5C1@vodafonemail.de> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * gnu/bootloader/grub.scm (grub-efi-netboot-bootloader): New bootloader = for network booting. (install-grub-efi-netboot): New bootloader installer for network = booting. (grub-root-search): Set the root to "(tftp)" if the searched file is not = stored on a local devices, i.e. an NFS share. --- gnu/bootloader/grub.scm | 111 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 107 insertions(+), 4 deletions(-) diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index f69bf8ed4d..346a9cac7a 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -23,8 +23,10 @@ ;;; along with GNU Guix. If not, see . =20 (define-module (gnu bootloader grub) + #:use-module (guix build union) #:use-module (guix records) - #:use-module ((guix utils) #:select (%current-system)) + #:use-module (guix store) + #:use-module (guix utils) #:use-module (guix gexp) #:use-module (gnu artwork) #:use-module (gnu bootloader) @@ -46,8 +48,11 @@ grub-theme-color-highlight grub-theme-gfxmode =20 + install-grub-efi-netboot + grub-bootloader grub-efi-bootloader + grub-efi-netboot-bootloader grub-mkrescue-bootloader grub-minimal-bootloader =20 @@ -297,9 +302,11 @@ code." (file-system-label->string label))) ((? (lambda (device) (and (string? device) (string-contains device ":/"))) = nfs-uri) - ;; This assumes that if your root file system is on NFS, then - ;; you also want to load your grub extra files, kernel and = initrd - ;; from there. + ;; If the device is an NFS share, then we assume that the = expected + ;; file on that device (e.g. the GRUB background image or the = kernel) + ;; has to be loaded over the network. Otherwise we would need = an + ;; additional device information for some local disk to look = for that + ;; file, which we do not have. ;; ;; We explicitly set "root=3D(tftp)" here even though if = grub.cfg ;; had been loaded via TFTP, Grub would have set "root=3D(tftp)"= @@ -528,6 +535,96 @@ fi~%")))) "--bootloader-id=3DGuix" "--efi-directory" target-esp)))) =20 +(define (install-grub-efi-netboot subdir) + "Define a grub-efi-netboot bootloader installer for installation in = SUBDIR, +which is usually efi/Guix or efi/boot." + (let* ((system (string-split (nix-system->gnu-triplet + (or (%current-target-system) + (%current-system))) + #\-)) + (arch (first system)) + (boot-efi-link (match system + ;; These are the supportend systems and the = names + ;; defined by the UEFI standard for removable = media. + (("i686" _ ...) "/bootia32.efi") + (("x86_64" _ ...) "/bootx64.efi") + (("arm" _ ...) "/bootarm.efi") + (("aarch64" _ ...) "/bootaa64.efi") + (("riscv" _ ...) "/bootriscv32.efi") + (("riscv64" _ ...) "/bootriscv64.efi") + ;; Other systems are not supported, although = defined. + ;; (("riscv128" _ ...) "/bootriscv128.efi") + ;; (("ia64" _ ...) "/bootia64.efi") + ((_ ...) #f))) + (efi-bootloader (string-append + ;; This is the arch dependent file name of = GRUB, e.g. + ;; i368-efi/core.efi or arm64-efi/core.efi. + (match arch + ("i686" "i386") + ("aarch64" "arm64") + ("riscv" "riscv32") + (_ arch)) + "-efi/core.efi"))) + (with-imported-modules + '((guix build union)) + #~(lambda (bootloader target mount-point) + "Install the BOOTLOADER, which must be the package grub, as = e.g. +bootx64.efi or bootaa64.efi into SUBDIR, which is usually efi/Guix or = efi/boot, +below the directory TARGET for the system whose root is mounted at = MOUNT-POINT. + +MOUNT-POINT is the last argument in 'guix system init /etc/config.scm = mnt/point' +or '/' for other 'guix system' commands. + +TARGET is the target argument given to the bootloader-configuration in + +(operating-system + (bootloader (bootloader-configuration + (target \"/boot\") + =E2=80=A6)) + =E2=80=A6) + +TARGET is required to be an absolute directory name, usually mounted = via NFS, +and finally needs to be provided by a TFTP server as the TFTP root = directory. + +GRUB will load tftp://server/SUBDIR/grub.cfg and this file will = instruct it to +load more files from the store like = tftp://server/gnu/store/=E2=80=A6-linux=E2=80=A6/Image. + +To make this possible two symlinks will be created. The first symlink = points +relatively form TARGET/SUBDIR/grub.cfg to /boot/grub/grub.cfg. And the = second +symlink points relatively from TARGET/%store-prefix to %store-prefix. + +It is important to note that these symlinks need to be relativ, as the = absolute +paths on the TFTP server side are unknown. + +It is also important to note that both symlinks will point outside the = TFTP root +directory and that the TARGET/%store-prefix symlink makes the whole = store +accessible via TFTP. Possibly the TFTP server must be configured +to allow accesses outside its TFTP root directory. This may need to be +considered for security aspects." + (use-modules ((guix build union) #:select (symlink-relative))) + (let* ((net-dir (string-append mount-point target "/")) + (sub-dir (string-append net-dir #$subdir "/")) + (store-link (string-append net-dir (%store-prefix))) + (grub-cfg "/boot/grub/grub.cfg") + (grub-cfg-link (string-append sub-dir (basename = grub-cfg))) + (boot-efi-link (string-append sub-dir = #$boot-efi-link))) + ;; Prepare the symlink to the store. + (mkdir-p (dirname store-link)) + (false-if-exception (delete-file store-link)) + (symlink-relative (%store-prefix) store-link) + ;; Install GRUB, which refers to the grub.cfg, with support = for + ;; encrypted partitions, + (setenv "GRUB_ENABLE_CRYPTODISK" "y") + (invoke/quiet (string-append bootloader = "/bin/grub-mknetdir") + (string-append "--net-directory=3D" net-dir) + (string-append "--subdir=3D" #$subdir)) + ;; Prepare the symlink to the grub.cfg, which points into = the store. + (false-if-exception (delete-file grub-cfg-link)) + (symlink-relative grub-cfg grub-cfg-link) + ;; Prepare the bootloader symlink, which points to GRUB. + (false-if-exception (delete-file boot-efi-link)) + (symlink #$efi-bootloader boot-efi-link)))))) + ^L =20 ;;; @@ -560,6 +657,12 @@ fi~%")))) (name 'grub-efi) (package grub-efi))) =20 +(define grub-efi-netboot-bootloader + (bootloader + (inherit grub-efi-bootloader) + (name 'grub-efi-netboot-bootloader) + (installer (install-grub-efi-netboot "efi/Guix")))) + (define grub-mkrescue-bootloader (bootloader (inherit grub-efi-bootloader) --=20 2.26.0 From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via TFTP. Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 26 Sep 2020 16:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Stefan Cc: 41011@debbugs.gnu.org, Efraim Flashner Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.160113689431834 (code B ref 41011); Sat, 26 Sep 2020 16:15:01 +0000 Received: (at 41011) by debbugs.gnu.org; 26 Sep 2020 16:14:54 +0000 Received: from localhost ([127.0.0.1]:47652 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMCqb-0008HO-UR for submit@debbugs.gnu.org; Sat, 26 Sep 2020 12:14:54 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:57600) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMCqZ-0008HF-O5 for 41011@debbugs.gnu.org; Sat, 26 Sep 2020 12:14:52 -0400 Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at [80.110.126.103]) by dd26836.kasserver.com (Postfix) with ESMTPSA id E719833683FD; Sat, 26 Sep 2020 18:14:49 +0200 (CEST) Date: Sat, 26 Sep 2020 18:13:57 +0200 From: Danny Milosavljevic Message-ID: <20200926181357.1aa2faa4@scratchpost.org> In-Reply-To: <066A5D57-B0B1-4FF4-B07B-1A5030AA789F@vodafonemail.de> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <20200906163559.1b56c36f@scratchpost.org> <45F0D825-F888-42E9-BDAE-7BB6FA010A6E@vodafonemail.de> <20200909003732.5c401932@scratchpost.org> <20200914065911.GB1717@E5400> <20200916075117.GE19874@E5400> <5C85E809-92D7-48F2-A8E2-2DF57460A6D9@vodafonemail.de> <2A23E912-6919-4A4A-A4CC-0C5FB1A5D5C1@vodafonemail.de> <066A5D57-B0B1-4FF4-B07B-1A5030AA789F@vodafonemail.de> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/oRnESS6NO63ZjXFqMtTBmDa"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/oRnESS6NO63ZjXFqMtTBmDa Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Stefan, I think this is almost ready to be merged. There's still one thing I'm unclear about. I tested it this way: (1) create ~/config.scm with the following contents: (use-modules (gnu)) (operating-system (timezone "UTC") (bootloader (bootloader-configuration (bootloader grub-efi-netboot-bootloader) (target "/boot"))) (file-systems (cons* (file-system (mount-point "/") (device ":/foo") (type "nfs")) %base-file-systems)) (host-name "client1")) (2) mkdir ~/tf (3) ./pre-inst-env guix system init ~/config.scm ~/tf Now, ~/tf contains the system to be booted over the network, right? But ~/tf/boot/efi/Guix/grub.cfg points to the tftp machine's /boot . Is that a bug? Shouldn't it point to the /boot of ~/tf, the system to be booted? Likewise, the gnu store directly inside ~/tf is not used, but ~/tf/boot/gnu points to the tftp machines's /gnu. Shouldn't it point to the former? On Sat, 26 Sep 2020 12:54:00 +0200 Stefan wrote: > + (let* ((net-dir (string-append mount-point target "/")) > + (sub-dir (string-append net-dir #$subdir "/")) > + (store-link (string-append net-dir (%store-prefix))) > + (grub-cfg "/boot/grub/grub.cfg") Shouldn't that be (string-append mount-point "/boot/grub/grub.cfg") ? > + (grub-cfg-link (string-append sub-dir (basename grub-cfg= ))) > + (boot-efi-link (string-append sub-dir #$boot-efi-link))) > + ;; Prepare the symlink to the store. > + (mkdir-p (dirname store-link)) > + (false-if-exception (delete-file store-link)) > + (symlink-relative (%store-prefix) store-link) Shouldn't that be (symlink-relative (string-append mount-point (%store-prefix)) store-link) ? > + ;; Install GRUB, which refers to the grub.cfg, with support f= or > + ;; encrypted partitions, > + (setenv "GRUB_ENABLE_CRYPTODISK" "y") > + (invoke/quiet (string-append bootloader "/bin/grub-mknetdir") > + (string-append "--net-directory=3D" net-dir) > + (string-append "--subdir=3D" #$subdir)) > + ;; Prepare the symlink to the grub.cfg, which points into the= store. > + (false-if-exception (delete-file grub-cfg-link)) > + (symlink-relative grub-cfg grub-cfg-link) > + ;; Prepare the bootloader symlink, which points to GRUB. > + (false-if-exception (delete-file boot-efi-link)) > + (symlink #$efi-bootloader boot-efi-link)))))) Okay. --Sig_/oRnESS6NO63ZjXFqMtTBmDa Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9vaMUACgkQ5xo1VCww uqXAMwgAhoOQD30qdQ58+VfnoS8bv2fUxKD351NxlQb9N/7BnTEhR0gfQUTfl6ab FgWSfuF5cRT2sl2jM9JlTvhTBcH1TDgk4XisOvbgQykZtYLloA07Pl5BQihsqcAk HMOWj1RYuPSxc684EGtRviMHrzNucROEwmUg1hsmnTEjVnAIWLb5URPBi0D294pi sf1IBd9bakDt5Um0DJ9uFfWdFvC3cm2+TGWr57NRNtequ9KkaytdqlCG3ORk7RrF /4+jARfqqIZp9/l3+EWZh4em0Yd+UHtylFBf6zKHJgPxJQO9QVZbwR7UWd4ZZApE bO6FEfPXpknFuUG6WXFTerl9apSd9Q== =4/QB -----END PGP SIGNATURE----- --Sig_/oRnESS6NO63ZjXFqMtTBmDa-- From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via TFTP. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 27 Sep 2020 10:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Cc: 41011@debbugs.gnu.org, Efraim Flashner Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.160120385430923 (code B ref 41011); Sun, 27 Sep 2020 10:51:02 +0000 Received: (at 41011) by debbugs.gnu.org; 27 Sep 2020 10:50:54 +0000 Received: from localhost ([127.0.0.1]:48448 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMUGc-00082h-7V for submit@debbugs.gnu.org; Sun, 27 Sep 2020 06:50:54 -0400 Received: from mx009.vodafonemail.xion.oxcs.net ([153.92.174.39]:45541) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMUGY-00082Q-Mo for 41011@debbugs.gnu.org; Sun, 27 Sep 2020 06:50:52 -0400 Received: from vsmx002.vodafonemail.xion.oxcs.net (unknown [192.168.75.192]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTP id 2F742604501; Sun, 27 Sep 2020 10:50:44 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [2.206.141.21]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 1DD786043D3; Sun, 27 Sep 2020 10:50:37 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <20200926181357.1aa2faa4@scratchpost.org> Date: Sun, 27 Sep 2020 12:50:36 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <20200906163559.1b56c36f@scratchpost.org> <45F0D825-F888-42E9-BDAE-7BB6FA010A6E@vodafonemail.de> <20200909003732.5c401932@scratchpost.org> <20200914065911.GB1717@E5400> <20200916075117.GE19874@E5400> <5C85E809-92D7-48F2-A8E2-2DF57460A6D9@vodafonemail.de> <2A23E912-6919-4A4A-A4CC-0C5FB1A5D5C1@vodafonemail.de> <066A5D57-B0B1-4FF4-B07B-1A5030AA789F@vodafonemail.de> <20200926181357.1aa2faa4@scratchpost.org> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Danny! > But ~/tf/boot/efi/Guix/grub.cfg points to the tftp machine's /boot . > Is that a bug? Shouldn't it point to the /boot of ~/tf, the system > to be booted? >=20 > Likewise, the gnu store directly inside ~/tf is not used, but > ~/tf/boot/gnu points to the tftp machines's /gnu. Shouldn't it > point to the former? You are absolutely right, thanks. It seems that I only tested with = =E2=80=98guix system reconfigure=E2=80=99. My bad. I fixed it and this time used =E2=80=98guix system init=E2=80=99 for = verification. I also correct the description accordingly. Bye Stefan= From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via TFTP. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 27 Sep 2020 10:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Cc: 41011@debbugs.gnu.org, Efraim Flashner Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.160120392731062 (code B ref 41011); Sun, 27 Sep 2020 10:53:01 +0000 Received: (at 41011) by debbugs.gnu.org; 27 Sep 2020 10:52:07 +0000 Received: from localhost ([127.0.0.1]:48452 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMUHm-00084v-Hw for submit@debbugs.gnu.org; Sun, 27 Sep 2020 06:52:06 -0400 Received: from vsmx012.vodafonemail.xion.oxcs.net ([153.92.174.90]:55178) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMUHk-00084K-PJ for 41011@debbugs.gnu.org; Sun, 27 Sep 2020 06:52:05 -0400 Received: from vsmx004.vodafonemail.xion.oxcs.net (unknown [192.168.75.198]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTP id A9304F35030; Sun, 27 Sep 2020 10:51:58 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [2.206.141.21]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 1E2C919AEAD; Sun, 27 Sep 2020 10:51:52 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: Date: Sun, 27 Sep 2020 12:51:51 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <20200906163559.1b56c36f@scratchpost.org> <45F0D825-F888-42E9-BDAE-7BB6FA010A6E@vodafonemail.de> <20200909003732.5c401932@scratchpost.org> <20200914065911.GB1717@E5400> <20200916075117.GE19874@E5400> <5C85E809-92D7-48F2-A8E2-2DF57460A6D9@vodafonemail.de> <2A23E912-6919-4A4A-A4CC-0C5FB1A5D5C1@vodafonemail.de> <066A5D57-B0B1-4FF4-B07B-1A5030AA789F@vodafonemail.de> <20200926181357.1aa2faa4@scratchpost.org> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/bootloader/grub.scm (grub-efi-netboot-bootloader): New bootloader = for network booting. (install-grub-efi-netboot): New bootloader installer for network = booting. (grub-root-search): Set the root to "(tftp)" if the searched file is not = stored on a local devices, i.e. an NFS share. --- gnu/bootloader/grub.scm | 114 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 110 insertions(+), 4 deletions(-) diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index f69bf8ed4d..516a7d48c8 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -23,8 +23,10 @@ ;;; along with GNU Guix. If not, see . =20 (define-module (gnu bootloader grub) + #:use-module (guix build union) #:use-module (guix records) - #:use-module ((guix utils) #:select (%current-system)) + #:use-module (guix store) + #:use-module (guix utils) #:use-module (guix gexp) #:use-module (gnu artwork) #:use-module (gnu bootloader) @@ -46,8 +48,11 @@ grub-theme-color-highlight grub-theme-gfxmode =20 + install-grub-efi-netboot + grub-bootloader grub-efi-bootloader + grub-efi-netboot-bootloader grub-mkrescue-bootloader grub-minimal-bootloader =20 @@ -297,9 +302,11 @@ code." (file-system-label->string label))) ((? (lambda (device) (and (string? device) (string-contains device ":/"))) = nfs-uri) - ;; This assumes that if your root file system is on NFS, then - ;; you also want to load your grub extra files, kernel and = initrd - ;; from there. + ;; If the device is an NFS share, then we assume that the = expected + ;; file on that device (e.g. the GRUB background image or the = kernel) + ;; has to be loaded over the network. Otherwise we would need = an + ;; additional device information for some local disk to look = for that + ;; file, which we do not have. ;; ;; We explicitly set "root=3D(tftp)" here even though if = grub.cfg ;; had been loaded via TFTP, Grub would have set "root=3D(tftp)"= @@ -528,6 +535,99 @@ fi~%")))) "--bootloader-id=3DGuix" "--efi-directory" target-esp)))) =20 +(define (install-grub-efi-netboot subdir) + "Define a grub-efi-netboot bootloader installer for installation in = SUBDIR, +which is usually efi/Guix or efi/boot." + (let* ((system (string-split (nix-system->gnu-triplet + (or (%current-target-system) + (%current-system))) + #\-)) + (arch (first system)) + (boot-efi-link (match system + ;; These are the supportend systems and the = names + ;; defined by the UEFI standard for removable = media. + (("i686" _ ...) "/bootia32.efi") + (("x86_64" _ ...) "/bootx64.efi") + (("arm" _ ...) "/bootarm.efi") + (("aarch64" _ ...) "/bootaa64.efi") + (("riscv" _ ...) "/bootriscv32.efi") + (("riscv64" _ ...) "/bootriscv64.efi") + ;; Other systems are not supported, although = defined. + ;; (("riscv128" _ ...) "/bootriscv128.efi") + ;; (("ia64" _ ...) "/bootia64.efi") + ((_ ...) #f))) + (core-efi (string-append + ;; This is the arch dependent file name of GRUB, = e.g. + ;; i368-efi/core.efi or arm64-efi/core.efi. + (match arch + ("i686" "i386") + ("aarch64" "arm64") + ("riscv" "riscv32") + (_ arch)) + "-efi/core.efi"))) + (with-imported-modules + '((guix build union)) + #~(lambda (bootloader target mount-point) + "Install the BOOTLOADER, which must be the package grub, as = e.g. +bootx64.efi or bootaa64.efi into SUBDIR, which is usually efi/Guix or = efi/boot, +below the directory TARGET for the system whose root is mounted at = MOUNT-POINT. + +MOUNT-POINT is the last argument in 'guix system init /etc/config.scm = mnt/point' +or '/' for other 'guix system' commands. + +TARGET is the target argument given to the bootloader-configuration in + +(operating-system + (bootloader (bootloader-configuration + (target \"/boot\") + =E2=80=A6)) + =E2=80=A6) + +TARGET is required to be an absolute directory name, usually mounted = via NFS, +and finally needs to be provided by a TFTP server as the TFTP root = directory. + +GRUB will load tftp://server/SUBDIR/grub.cfg and this file will = instruct it to +load more files from the store like = tftp://server/gnu/store/=E2=80=A6-linux=E2=80=A6/Image. + +To make this possible two symlinks will be created. The first symlink = points +relatively form MOUNT-POINT/TARGET/SUBDIR/grub.cfg to +MOUNT-POINT/boot/grub/grub.cfg, and the second symlink points = relatively from +MOUNT-POINT/TARGET/%store-prefix to MOUNT-POINT/%store-prefix. + +It is important to note that these symlinks need to be relativ, as the = absolute +paths on the TFTP server side are unknown. + +It is also important to note that both symlinks will point outside the = TFTP root +directory and that the TARGET/%store-prefix symlink makes the whole = store +accessible via TFTP. Possibly the TFTP server must be configured +to allow accesses outside its TFTP root directory. This may need to be +considered for security aspects." + (use-modules ((guix build union) #:select (symlink-relative))) + (let* ((net-dir (string-append mount-point target "/")) + (sub-dir (string-append net-dir #$subdir "/")) + (store (string-append mount-point (%store-prefix))) + (store-link (string-append net-dir (%store-prefix))) + (grub-cfg (string-append mount-point = "/boot/grub/grub.cfg")) + (grub-cfg-link (string-append sub-dir (basename = grub-cfg))) + (boot-efi-link (string-append sub-dir = #$boot-efi-link))) + ;; Prepare the symlink to the store. + (mkdir-p (dirname store-link)) + (false-if-exception (delete-file store-link)) + (symlink-relative store store-link) + ;; Prepare the symlink to the grub.cfg, which points into = the store. + (mkdir-p (dirname grub-cfg-link)) + (false-if-exception (delete-file grub-cfg-link)) + (symlink-relative grub-cfg grub-cfg-link) + ;; Install GRUB, which refers to the grub.cfg, with support = for + ;; encrypted partitions, + (setenv "GRUB_ENABLE_CRYPTODISK" "y") + (invoke/quiet (string-append bootloader = "/bin/grub-mknetdir") + (string-append "--net-directory=3D" net-dir) + (string-append "--subdir=3D" #$subdir)) + ;; Prepare the bootloader symlink, which points to core.efi = of GRUB. + (false-if-exception (delete-file boot-efi-link)) + (symlink #$core-efi boot-efi-link)))))) + ^L =20 ;;; @@ -560,6 +660,12 @@ fi~%")))) (name 'grub-efi) (package grub-efi))) =20 +(define grub-efi-netboot-bootloader + (bootloader + (inherit grub-efi-bootloader) + (name 'grub-efi-netboot-bootloader) + (installer (install-grub-efi-netboot "efi/Guix")))) + (define grub-mkrescue-bootloader (bootloader (inherit grub-efi-bootloader) --=20 2.26.0 From unknown Fri Jun 13 11:12:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via TFTP. Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 27 Sep 2020 11:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Stefan Cc: 41011@debbugs.gnu.org, Efraim Flashner Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.160120729412105 (code B ref 41011); Sun, 27 Sep 2020 11:49:01 +0000 Received: (at 41011) by debbugs.gnu.org; 27 Sep 2020 11:48:14 +0000 Received: from localhost ([127.0.0.1]:48524 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMVA6-00039B-Aw for submit@debbugs.gnu.org; Sun, 27 Sep 2020 07:48:14 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:53164) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMVA5-000393-0E for 41011@debbugs.gnu.org; Sun, 27 Sep 2020 07:48:13 -0400 Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at [80.110.126.103]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 2408F33682F4; Sun, 27 Sep 2020 13:48:11 +0200 (CEST) Date: Sun, 27 Sep 2020 13:47:46 +0200 From: Danny Milosavljevic Message-ID: <20200927134746.1719fd34@scratchpost.org> In-Reply-To: References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <20200906163559.1b56c36f@scratchpost.org> <45F0D825-F888-42E9-BDAE-7BB6FA010A6E@vodafonemail.de> <20200909003732.5c401932@scratchpost.org> <20200914065911.GB1717@E5400> <20200916075117.GE19874@E5400> <5C85E809-92D7-48F2-A8E2-2DF57460A6D9@vodafonemail.de> <2A23E912-6919-4A4A-A4CC-0C5FB1A5D5C1@vodafonemail.de> <066A5D57-B0B1-4FF4-B07B-1A5030AA789F@vodafonemail.de> <20200926181357.1aa2faa4@scratchpost.org> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/pYcx3+k7.kAVgJlqNketXK0"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/pYcx3+k7.kAVgJlqNketXK0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Stefan, pushed to guix master as commits c85f316ae986331cc5181da4bcc757078d7a9412 (= implementation) and 740fd97ebeadebc02448cb0482084f359938b5fe (documentation), after success= ful test. Thanks! If you think this concludes this bug report, please close it (any mail to 41011-done@debbugs.gnu.org). Are there other parts still missing that you need? (I have a patch to dnsmasq to make it support configuring the built-in TFTP server that I've been using. I'll just post it to guix-patches@gnu.org so it gets a new number) --Sig_/pYcx3+k7.kAVgJlqNketXK0 Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9we+IACgkQ5xo1VCww uqVPMgf/Snv+rQbcgM7Aib6TOTDBk8rs4TKjjhHoY7EplVRD1E9fVfYZySYem5oq XjaHsIffoko/U2TJDBaa7r+8qEtFcrADpR8eRNj5lAgKcxfagNOU13HCBBwG/kTG 2vZNtTWjNyUwMHgDsqe6daQyvF/GHUbaz12wL5SpLi0fSXqpWky/fTRM4jYc6NT6 7oGLqn7yAJO6HPMNk3KMIJ/MkeWAcy0k40kPcXb+iSPIrAoPWLZx760IRdX6AK6s yhe45Uq+qgKEQ1RL8Sltf7Xf3WPTkKExhm8+dqwYIKrZVsTH8/5LxdAq83GjX2Jo G46NA2mGwVyiA74upzMxAHpk32ElCg== =sG6f -----END PGP SIGNATURE----- --Sig_/pYcx3+k7.kAVgJlqNketXK0-- From unknown Fri Jun 13 11:12:31 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Stefan Subject: bug#41011: closed ([bug#41011] [PATCH] gnu: grub: Support for network boot via TFTP.) Message-ID: References: <6F5F7FBB-5C85-4977-8976-BA52FCC2CB00@vodafonemail.de> <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> X-Gnu-PR-Message: they-closed 41011 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 41011@debbugs.gnu.org Date: Sun, 27 Sep 2020 11:58:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1601207882-12955-1" This is a multi-part message in MIME format... ------------=_1601207882-12955-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #41011: [PATCH] gnu: grub: Support for network boot via tftp/nfs. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 41011@debbugs.gnu.org. --=20 41011: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D41011 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1601207882-12955-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 41011-done) by debbugs.gnu.org; 27 Sep 2020 11:58:01 +0000 Received: from localhost ([127.0.0.1]:48536 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMVJY-0003Md-QW for submit@debbugs.gnu.org; Sun, 27 Sep 2020 07:58:01 -0400 Received: from vsmx009.vodafonemail.xion.oxcs.net ([153.92.174.87]:48983) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMVJX-0003MP-8G for 41011-done@debbugs.gnu.org; Sun, 27 Sep 2020 07:58:00 -0400 Received: from vsmx001.vodafonemail.xion.oxcs.net (unknown [192.168.75.191]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTP id B0B6E159DF43 for <41011-done@debbugs.gnu.org>; Sun, 27 Sep 2020 11:57:52 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [2.206.141.21]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 943B6159E2E0 for <41011-done@debbugs.gnu.org>; Sun, 27 Sep 2020 11:57:50 +0000 (UTC) From: Stefan Content-Type: text/plain Content-Transfer-Encoding: 7bit Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via TFTP. Message-Id: <6F5F7FBB-5C85-4977-8976-BA52FCC2CB00@vodafonemail.de> Date: Sun, 27 Sep 2020 13:57:49 +0200 To: 41011-done@debbugs.gnu.org Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 41011-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) ------------=_1601207882-12955-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 1 May 2020 20:32:58 +0000 Received: from localhost ([127.0.0.1]:50758 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jUcLC-0006BO-Aa for submit@debbugs.gnu.org; Fri, 01 May 2020 16:32:58 -0400 Received: from lists.gnu.org ([209.51.188.17]:55530) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jUcLA-0006BG-WD for submit@debbugs.gnu.org; Fri, 01 May 2020 16:32:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jUcLA-0006mW-1U for guix-patches@gnu.org; Fri, 01 May 2020 16:32:56 -0400 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUcL8-0002oR-5E for guix-patches@gnu.org; Fri, 01 May 2020 16:32:55 -0400 Received: from vsmx012.vodafonemail.xion.oxcs.net ([153.92.174.90]:14985) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jUcL7-0002bE-EL for guix-patches@gnu.org; Fri, 01 May 2020 16:32:53 -0400 Received: from vsmx004.vodafonemail.xion.oxcs.net (unknown [192.168.75.198]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTP id 288B9F35070 for ; Fri, 1 May 2020 20:32:47 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [90.186.146.133]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTPA id F072D19AE34 for ; Fri, 1 May 2020 20:32:44 +0000 (UTC) From: Stefan Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: [PATCH] gnu: grub: Support for network boot via tftp/nfs. Message-Id: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> Date: Fri, 1 May 2020 22:32:44 +0200 To: guix-patches@gnu.org Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-VADE-SCORE: 0 X-VADE-REASON: gggruggvucftvghtrhhoucdtuddrgeduhedrieejgddugeekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuvegfuffvqffogfftpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhtgfguffkfffvggfosehtqhhmtdhhtddvnecuhfhrohhmpefuthgvfhgrnhcuoehsthgvfhgrnhdqghhuihigsehvohgurghfohhnvghmrghilhdruggvqeenucggtffrrghtthgvrhhnpeeutdeliefgfedvheejhfekvedtgfegiefhgeehheffgfffhfdvjeejhfelgfevffenucfkphepledtrddukeeirddugeeirddufeefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehmrggtsghoohhkqdhprhhordhkuhhhqdifihgvshgvrdhmhidqrhhouhhtvghrrdguvgdpihhnvghtpeeltddrudekiedrudegiedrudeffedpmhgrihhlfhhrohhmpehsthgvfhgrnhdqghhuihigsehvohgurghfohhnvghmrghilhdruggvpdhrtghpthhtohepghhuihigqdhprghttghhvghssehgnhhurdhorhhg Received-SPF: pass client-ip=153.92.174.90; envelope-from=stefan-guix@vodafonemail.de; helo=vsmx012.vodafonemail.xion.oxcs.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/01 16:32:47 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 153.92.174.90 X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) * gnu/bootloader/grub.scm (grub-efi-net-bootloader): New efi bootloader = for network booting via tftp/nfs and possibly images, prepared for chain = loading. (install-grub-efi-net): New bootloader installer for tftp and possibly = images, does not need root rights. (grub-root-search): Adding support for tftp root. (eye-candy): Enable gfxterm support for all systems. * gnu/system.scm (read-boot-parameters): Prevent devices with ":/" from = being treated as a file system label. --- gnu/bootloader/grub.scm | 107 +++++++++++++++++++++++++++++++--------- gnu/system.scm | 3 +- 2 files changed, 86 insertions(+), 24 deletions(-) diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index 190b717163..9ca4f016f6 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -23,7 +23,7 @@ =20 (define-module (gnu bootloader grub) #:use-module (guix records) - #:use-module ((guix utils) #:select (%current-system)) + #:use-module ((guix utils) #:select (%current-system = %current-target-system)) #:use-module (guix gexp) #:use-module (gnu artwork) #:use-module (gnu bootloader) @@ -53,6 +53,7 @@ =20 grub-bootloader grub-efi-bootloader + grub-efi-net-bootloader grub-mkrescue-bootloader =20 grub-configuration)) @@ -142,34 +143,20 @@ WIDTH/HEIGHT, or #f if none was found." #:width width #:height height)))) =20 (define* (eye-candy config store-device store-mount-point - #:key system port) + #:key port) "Return a gexp that writes to PORT (a port-valued gexp) the 'grub.cfg' part concerned with graphics mode, background images, = colors, and all that. STORE-DEVICE designates the device holding the store, and STORE-MOUNT-POINT is its mount point; these are used to determine where = the -background image and fonts must be searched for. SYSTEM must be the = target -system string---e.g., \"x86_64-linux\"." +background image and fonts must be searched for." (define setup-gfxterm-body - (let ((gfxmode - (or (and-let* ((theme (bootloader-configuration-theme = config)) - (gfxmode (grub-gfxmode theme))) - (string-join gfxmode ";")) - "auto"))) - - ;; Intel and EFI systems need to be switched into graphics mode, = whereas - ;; most other modern architectures have no other mode and = therefore - ;; don't need to be switched. - - ;; XXX: Do we really need to restrict to x86 systems? We could = imitate - ;; what the GRUB default configuration does and decide based on = whether - ;; a user provided 'gfxterm' in the terminal-outputs field of = their - ;; bootloader-configuration record. - (if (string-match "^(x86_64|i[3-6]86)-" system) - (format #f " + (format #f " set gfxmode=3D~a insmod all_video - insmod gfxterm~%" gfxmode) - ""))) + insmod gfxterm~%" + (string-join + (grub-gfxmode (bootloader-theme config)) + ";"))) =20 (define (setup-gfxterm config font-file) (if (memq 'gfxterm (bootloader-configuration-terminal-outputs = config)) @@ -316,6 +303,9 @@ code." ((? file-system-label? label) (format #f "search --label --set ~a" (file-system-label->string label))) + ((? (lambda (device) + (and (string? device) (string-contains device ":/"))) = nfs-uri) + "set root=3D(tftp)") ((or #f (? string?)) #~(format #f "search --file --set ~a" #$file))))) =20 @@ -355,7 +345,6 @@ entries corresponding to old generations of the = system." (eye-candy config (menu-entry-device (first all-entries)) (menu-entry-device-mount-point (first all-entries)) - #:system system #:port #~port)) =20 (define keyboard-layout-config @@ -443,6 +432,68 @@ fi~%")))) "--bootloader-id=3DGuix" "--efi-directory" target-esp)))) =20 +(define (install-grub-efi-net efi-subdir) + "Define a grub-efi bootloader installer for installation in = EFI-SUBDIR, +which is usually \"efi/guix\" or \"efi/boot\"." + (let* ((arch (car (string-split (or (%current-target-system) + (%current-system)) + #\-))) + (efi-bootloader-link (string-append "boot" + (match arch + ("i686" "ia32") + ("x86_64" "x64") + ("armhf" "arm") + ("aarch64" "aa64") + ("riscv" "riscv32") + ("riscv64" "riscv64")) + ".efi")) + (efi-bootloader (string-append (match arch + ("i686" "i386") + ("x86_64" "x86_64") + ("armhf" "arm") + ("aarch64" "arm64") + ("riscv" "riscv32") + ("riscv64" "riscv64")) + "-efi/core.efi"))) + #~(lambda (bootloader target mount-point) + "Install GRUB as e.g. \"bootx64.efi\" or \"bootarm64.efi\" = \"into +EFI-SUBDIR, which is usually \"efi/guix\" or \"efi/boot\" below the = directory +TARGET for the system whose root is mounted at MOUNT-POINT." + (let* ((mount-point-list (delete "" (string-split mount-point = #\/))) + (target-list (delete "" (string-split target #\/))) + (net-dir + (string-append "/" (string-join (append + mount-point-list + target-list) + "/"))) + (subdir #$efi-subdir) + (efi-bootloader-link + (string-append net-dir "/" subdir "/" = #$efi-bootloader-link)) + (store-name (car (delete "" (string-split bootloader = #\/)))) + (store + ;; Use target-list to construct a "../gnu" link with a = correct + ;; number of "../" to the store. + (string-join (append (make-list (length target-list) = "..") + (list store-name)) + "/")) + (store-link (string-append net-dir "/" store-name))) + ;; Tell 'grub-install' that there might be a LUKS-encrypted = /boot or + ;; root partition. + (setenv "GRUB_ENABLE_CRYPTODISK" "y") + (invoke/quiet (string-append bootloader "/bin/grub-mknetdir") + (string-append "--net-directory=3D" net-dir) + (string-append "--subdir=3D" subdir)) + (catch 'system-error + (lambda () (delete-file efi-bootloader-link)) + (lambda _ #f)) + (symlink #$efi-bootloader + efi-bootloader-link) + (catch 'system-error + (lambda () (delete-file store-link)) + (lambda _ #f)) + (symlink store + store-link))))) + ^L =20 ;;; @@ -464,6 +515,16 @@ fi~%")))) (name 'grub-efi) (package grub-efi))) =20 +(define* (grub-efi-net-bootloader #:key (target #f) (efi-subdir #f)) + (let ((target (or target "boot")) + (efi-subdir (or efi-subdir "efi/boot"))) + (bootloader + (inherit grub-bootloader) + (name 'grub-efi-net-bootloader) + (package grub-efi) + (installer (install-grub-efi-net efi-subdir)) + (configuration-file (string-append target "/" efi-subdir = "/grub.cfg"))))) + (define* grub-mkrescue-bootloader (bootloader (inherit grub-efi-bootloader) diff --git a/gnu/system.scm b/gnu/system.scm index 29e622872d..540f0e4a9e 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -297,7 +297,8 @@ file system labels." ((? string? device) ;; It used to be that we would not distinguish between labels = and ;; device names. Try to infer the right thing here. - (if (string-prefix? "/dev/" device) + (if (or (string-prefix? "/dev/" device) + (string-contains device ":/")) ; nfs device (file-system-label device))))) =20 --=20 2.26.0 ------------=_1601207882-12955-1--