From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 31 12:33:50 2023 Received: (at 59619) by debbugs.gnu.org; 31 Jan 2023 17:33:50 +0000 Received: from localhost ([127.0.0.1]:54895 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMuVx-0006Bd-T5 for submit@debbugs.gnu.org; Tue, 31 Jan 2023 12:33:50 -0500 Received: from mout.web.de ([217.72.192.78]:57145) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMuVu-0006BO-E1 for 59619@debbugs.gnu.org; Tue, 31 Jan 2023 12:33:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1675186420; bh=4CjD88McjXAzrZnnpoxPpxsonRj+NAQMyhLiHWOre8Q=; h=X-UI-Sender-Class:Date:From:To:Subject; b=i7ZAiEtmKXCfa5FGkgxNEbzaXIDgBqJjEiL+MEC6UJs83VUTO7eSv6O40vcXhaBBl jvj5SmcjIaevx8WBnES+q5Cr5WyUPDqRMrT2/uyzGiAJfh45y+PA5czkTnV1HhjcU2 Nj9p9TkWTnCukJYueQMT+HgHk+QVMlXVj383f9Pfad42OcS4tq14ahv6HjZf/RUXkj h58yJMhslu3xdYnYIWVJlIdCgoQnuAPf3vASafQz9SsKiYSmERUkhhDjlprlHlT3Td 4C6LxF3e5IspCHkgc0FBquaH4ThWZ77tZHN3DxwWnSaYRIHEzr/heDM2hiAnz+PFh8 1e8yTkRb7wWGA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from localhost ([188.98.113.9]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1Mvbn2-1oXq1l28FK-00sgw0 for <59619@debbugs.gnu.org>; Tue, 31 Jan 2023 18:33:39 +0100 Date: Tue, 31 Jan 2023 18:33:38 +0100 From: "S.Karrmann" To: 59619@debbugs.gnu.org Subject: [PATCH] grub-configfile tested successfully Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:LcBF5UTl6cI020bxJFcdg+n8JVP67GdZQEVYyyye1kT0Td92w8m 9basDkdd4HTvb0p2sFpJr0LAjHOJAyWlmZw0slUZs6O2LekSL71LSoFWXOM+7qTztxEDldL dUeu/wxn4aYq2siwBNzSB6Rz9UvSIxIFCa5RThTJaF2PKzZ/6xgE670CuA5qiGsCH1euq0e uFt3q5RHZfHyVYX6RiBHA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:3g1mBv4Kdlg=;YL6CiGFlcI0SQCV3bI7F/VebPy6 1Mg4lt2zvS8zrU4bu/SbcoD4j7JlvPYm+VRSWjB3e0XeuyeXyZZ2QXci90uC5ANrdEkaXTjBA GF1JXhz1FCQ1a51muNBanj7mFifW4CVoQrrLTENUkEL7AevPnMy6yHWvi6SzmfIr9/j6F0DuZ r+LEwL3z4zpFh0miDFXbiCXsHx7V6yumnn2hQG3Olv84p48LTOc2xoyfdh0GS+U/NBR398Ncc 0eiXK0eYulVdiQN+GD+tcXRSgjMk3Np0KZ5nHjj+vSGZA/l2w5Oc+szbkP2KSxLtinsdyz5Mc pmGrY1Ppls7JvVI979onW7qZhdxPrtEoKNU5587opSpiv2eBhuf/fA+dFj0yDB8Zz5SdhhNfa GNHeODwuf+e8p8IMAfvBSBOiaW+nsiee6CtwUgD4+RQAu6NFhTMc4KrTqhbzZTtfRYls69xJL aqOwtRVvnALKNF5zCFjHnZPPE51claS5KiPgr6buqlm0KqUJFfuksw/D0GtKoJRpiN3woWNAx y5KimWmeDc2BHAU7G7zl/r8jDAtwqUhbFmJ581xfRCads1tkcbGZFPGxGctZnZqAKMnzEm2CX OWQY9s3ydJXAzbcMFKrnt3QnqNCP+Ahhpae16eR8AUwcicVzxRbhFKwkSJzY0UcK4sBtM+HGG dAmb9Jp7MHfOTDShd//rrkKG71noQhgPVt7lZFmfMyM+iSM0bB085sHm64mg0kcumLOT1pbUq W74B10pNDmGjRa3K/TQqrH0jj2Ax9SsxBohcowANiMk+lme34Y1lZSC4ikMxtYQZNCaD8kP6C sIj7OlEOgXWiLenr7fxQ6AfYHV1NHYyd2Mu6+oBdpsWcMXdLfeDBj9QT9wJnDZE/wM3oWfXO2 +TUQX7956FWNxkIYkmL5EWtUG9TQYkDpJNFt4fCE536OZS4NaPsNba8kvpxT1v+b5h/3Xm/9r /hQSBwJtvnEZZqzIQtfkJJXgDxg= X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 59619 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 (-) Dear all, I tested my patch and generated a vm with configfile in its GRUB boot menu= , cf. ~system-config.scm~ in my last post. I needed ~make clean-go ; make make-go~ to get consistent compiled guile code. The guile manual suggested ~--fresh-auto-compile~, but for this I must call guile directly AFAICS. Some tool for guile-autocompile would be nice for such developments. I hope, this patch makes it into the master branch. It helps to test insta= ll Guix in parallel to another OS. So more people can test it and will fall i= n love with Guix, hopefully. Kind regards, Dr. Stefan Karrmann =2D-- doc/guix.texi | 39 +++++++++++++++++++++++++++++---------- gnu/bootloader.scm | 29 +++++++++++++++++++++++++---- gnu/bootloader/grub.scm | 11 +++++++++++ tests/boot-parameters.scm | 11 +++++++++++ 4 files changed, 76 insertions(+), 14 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 2b1ad77ba5..45f9ed23ed 100644 =2D-- a/doc/guix.texi +++ b/doc/guix.texi @@ -112,6 +112,7 @@ Copyright @copyright{} 2022 John Kehayias@* Copyright @copyright{} 2022 Ivan Vilata-i-Balaguer@* Copyright @copyright{} 2023 Giacomo Leidi@* Copyright @copyright{} 2022 Antero Mejr@* +Copyright @copyright{} 2023 Dr. Stefan Karrmann@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -6159,7 +6160,7 @@ Transformation Options}) so it should be lossless. @item --profile=3D@var{profile} @itemx -p @var{profile} -Create an environment containing the packages installed in @var{profile}. +Create an environment containing the packages installed in @var{profile}. Use @command{guix package} (@pxref{Invoking guix package}) to create and manage profiles. @@ -6605,7 +6606,7 @@ interpreted as packages that will be added to the en= vironment directly. @item --profile=3D@var{profile} @itemx -p @var{profile} -Create an environment containing the packages installed in @var{profile}. +Create an environment containing the packages installed in @var{profile}. Use @command{guix package} (@pxref{Invoking guix package}) to create and manage profiles. @@ -12564,7 +12565,7 @@ candidates, and even to test their impact on packa= ges that depend on them: @example -guix build elogind --with-source=3D@dots{}/shepherd-0.9.0rc1.tar.gz +guix build elogind --with-source=3D@dots{}/shepherd-0.9.0rc1.tar.gz @end example @dots{} or to build from a checkout in a pristine environment: @@ -23482,7 +23483,7 @@ created for. Restricts all controllers to the specified transport. @code{'dual} means = both BR/EDR and LE are enabled (if supported by the hardware). -Possible values are: +Possible values are: @itemize @bullet @item @@ -38666,6 +38667,24 @@ The list of commands for loading Multiboot module= s. For example: @dots{})) @end lisp +@item @code{config-file} (default: @code{#f}) +A string that can be accepted by @code{grub}'s @code{configfile} +directive. This has no effect if either @code{linux} or +@code{multiboot-kernel} fields are specified. The following is an +example of switching to a different GNU/GRUB menu. + +@lisp +(bootloader + (bootloader-configuration + ;; @dots{} + (menu-entries + (list + (menu-entry + (label "GNU/Linux") + (device (uuid "5cbb9a70-a3c8-4384-a085-9e6896058343")) + (config-file "/boot/grub/grub.cfg")))))) +@end lisp + @item @code{chain-loader} (default: @code{#f}) A string that can be accepted by @code{grub}'s @code{chainloader} directive. This has no effect if either @code{linux} or @@ -40553,7 +40572,7 @@ A clause can have one of the following forms: (@var{field-name} (@var{type} @var{default-value}) @var{documentation}) - + (@var{field-name} (@var{type} @var{default-value}) @var{documentation} @@ -40602,7 +40621,7 @@ A simple serializer procedure could look like this= : (define (serialize-boolean field-name value) (let ((value (if value "true" "false"))) #~(string-append #$field-name #$value))) -@end lisp +@end lisp In some cases multiple different configuration records might be defined in the same file, but their serializers for the same type might have to @@ -40620,7 +40639,7 @@ manually specify a custom @var{serializer} for eve= ry field. (define (bar-serialize-string field-name value) @dots{}) - + (define-configuration foo-configuration (label (string) @@ -40652,7 +40671,7 @@ macro which is a shorthand of this. (field (string "test") "Some documentation.")) -@end lisp +@end lisp @end deffn @deffn {Scheme Syntax} define-maybe @var{type} @@ -43153,7 +43172,7 @@ down in its dependency graph. As it turns out, GL= ib does not have a from /gnu/store/@dots{}-glib-2.62.6/lib/libglib-2.0.so.0 #1 0x00007ffff608a7d6 in gobject_init_ctor () from /gnu/store/@dots{}-glib-2.62.6/lib/libgobject-2.0.so.0 -#2 0x00007ffff7fe275a in call_init (l=3D, argc=3Dargc@@en= try=3D1, argv=3Dargv@@entry=3D0x7fffffffcfd8, +#2 0x00007ffff7fe275a in call_init (l=3D, argc=3Dargc@@en= try=3D1, argv=3Dargv@@entry=3D0x7fffffffcfd8, env=3Denv@@entry=3D0x7fffffffcfe8) at dl-init.c:72 #3 0x00007ffff7fe2866 in call_init (env=3D0x7fffffffcfe8, argv=3D0x7ffff= fffcfd8, argc=3D1, l=3D) at dl-init.c:118 @@ -43182,7 +43201,7 @@ Starting program: /gnu/store/@dots{}-profile/bin/s= h -c exec\ inkscape #0 g_getenv (variable=3Dvariable@@entry=3D0x7ffff60c7a2e "GOBJECT_DEBUG"= ) at ../glib-2.62.6/glib/genviron.c:252 #1 0x00007ffff608a7d6 in gobject_init () at ../glib-2.62.6/gobject/gtype= .c:4380 #2 gobject_init_ctor () at ../glib-2.62.6/gobject/gtype.c:4493 -#3 0x00007ffff7fe275a in call_init (l=3D, argc=3Dargc@@en= try=3D3, argv=3Dargv@@entry=3D0x7fffffffd088, +#3 0x00007ffff7fe275a in call_init (l=3D, argc=3Dargc@@en= try=3D3, argv=3Dargv@@entry=3D0x7fffffffd088, env=3Denv@@entry=3D0x7fffffffd0a8) at dl-init.c:72 @dots{} @end example diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index 2c36d8c6cf..7c24fd2ebf 100644 =2D-- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -6,6 +6,7 @@ ;;; Copyright =A9 2020 Jan (janneke) Nieuwenhuizen ;;; Copyright =A9 2022 Josselin Poiret ;;; Copyright =A9 2022 Reza Alizadeh Majd +;;; Copyright =A9 2022 Dr. Stefan Karrmann ;;; ;;; This file is part of GNU Guix. ;;; @@ -49,6 +50,7 @@ menu-entry-multiboot-arguments menu-entry-multiboot-modules menu-entry-chain-loader + menu-entry-config-file menu-entry->sexp sexp->menu-entry @@ -109,8 +111,10 @@ (multiboot-modules menu-entry-multiboot-modules (default '())) ; list of multiboot commands, = where ; a command is a list of + (config-file menu-entry-config-file + (default #f)) ; string, path of grub.cfg fil= e (chain-loader menu-entry-chain-loader - (default #f))) ; string, path of efi file + (default #f))) ; string, path of efi file (define (report-menu-entry-error menu-entry) (raise @@ -126,6 +130,7 @@ @code{linux-arguments} and @code{linux-modules}, @item multiboot by specifying fields @code{multiboot-kernel}, @code{multiboot-arguments} and @code{multiboot-modules}, +@item config-file by specifying field @code{config-file}. @item chain-loader by specifying field @code{chain-loader}. @end enumerate")))))) @@ -141,7 +146,7 @@ (match entry (($ label device mount-point (? identity linux) linux-arguments (? identity initr= d) - #f () () #f) + #f () () #f #f) `(menu-entry (version 0) (label ,label) (device ,(device->sexp device)) @@ -151,7 +156,7 @@ (initrd ,initrd))) (($ label device mount-point #f () #f (? identity multiboot-kernel) multiboot-arguments - multiboot-modules #f) + multiboot-modules #f #f) `(menu-entry (version 0) (label ,label) (device ,(device->sexp device)) @@ -159,13 +164,20 @@ (multiboot-kernel ,multiboot-kernel) (multiboot-arguments ,multiboot-arguments) (multiboot-modules ,multiboot-modules))) - (($ label device mount-point #f () #f #f () () + (($ label device mount-point #f () #f #f () () #f (? identity chain-loader)) `(menu-entry (version 0) (label ,label) (device ,(device->sexp device)) (device-mount-point ,mount-point) (chain-loader ,chain-loader))) + (($ label device mount-point #f () #f #f () () + (? identity config-file) #f) + `(menu-entry (version 0) + (label ,label) + (device ,(device->sexp device)) + (device-mount-point ,mount-point) + (config-file ,config-file))) (_ (report-menu-entry-error entry)))) (define (sexp->menu-entry sexp) @@ -204,6 +216,15 @@ record." (multiboot-kernel multiboot-kernel) (multiboot-arguments multiboot-arguments) (multiboot-modules multiboot-modules))) + (('menu-entry ('version 0) + ('label label) ('device device) + ('device-mount-point mount-point) + ('config-file config-file) _ ...) + (menu-entry + (label label) + (device (sexp->device device)) + (device-mount-point mount-point) + (config-file config-file))) (('menu-entry ('version 0) ('label label) ('device device) ('device-mount-point mount-point) diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index ecd44e7f3c..7ed0d155d8 100644 =2D-- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -9,6 +9,7 @@ ;;; Copyright =A9 2020 Stefan ;;; Copyright =A9 2022 Karl Hallsby ;;; Copyright =A9 2022 Denis 'GNUtoo' Carikli +;;; Copyright =A9 2022 Dr. Stefan Karrmann ;;; ;;; This file is part of GNU Guix. ;;; @@ -377,6 +378,7 @@ when booting a root file system on a Btrfs subvolume." (device (menu-entry-device entry)) (device-mount-point (menu-entry-device-mount-point entry)) (multiboot-kernel (menu-entry-multiboot-kernel entry)) + (config-file (menu-entry-config-file entry)) (chain-loader (menu-entry-chain-loader entry))) (cond (linux @@ -417,6 +419,15 @@ menuentry ~s { #$root-index (string-join (list #$@arguments) " " 'pr= efix) (string-join (map string-join '#$modules) "\n module " 'prefix)))) + (config-file + #~(format port " +menuentry ~s { + ~a + config-file ~a +}~%" + #$label + #$(grub-root-search device config-file) + #$config-file)) (chain-loader #~(format port " menuentry ~s { diff --git a/tests/boot-parameters.scm b/tests/boot-parameters.scm index 03a1d01aff..f2d1453b2c 100644 =2D-- a/tests/boot-parameters.scm +++ b/tests/boot-parameters.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =A9 2019, 2020 Miguel =C1ngel Arruga Vivas ;;; Copyright =A9 2022 Josselin Poiret +;;; Copyright =A9 2022 Dr. Stefan Karrmann ;;; ;;; This file is part of GNU Guix. ;;; @@ -318,6 +319,12 @@ (linux "/boot/bzImage") (initrd "/boot/initrd.cpio.gz"))) +(define %config-file-menu-entry + (menu-entry + (label "test-config-file") + (device (uuid "6d5b13d4-6092-46d0-8be4-073dc07413cc")) + (config-file "/boot/grub/grub.cfg"))) + (test-equal "menu-entry roundtrip, uuid" %uuid-menu-entry (sexp->menu-entry (menu-entry->sexp %uuid-menu-entry))) @@ -326,4 +333,8 @@ %file-system-label-menu-entry (sexp->menu-entry (menu-entry->sexp %file-system-label-menu-entry))) +(test-equal "menu-entry roundtrip, config-file" + %config-file-menu-entry + (sexp->menu-entry (menu-entry->sexp %config-file-menu-entry))) + (test-end "boot-parameters") =2D- 2.30.2