all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#59619] [PATCH] grub-configfile
@ 2022-11-26 21:12 Stefan Karrmann
  2022-11-26 21:14 ` ( via Guix-patches via
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Stefan Karrmann @ 2022-11-26 21:12 UTC (permalink / raw)
  To: 59619

[-- Attachment #1: Type: text/plain, Size: 440 bytes --]

Dear all,

somehow ~git send-mail~ seems not to work as expected. Therefore, I send
this patch manually.

The patch allows us to use the menuentry configfile for grub. As I'm still
a newbie with regard to guix, I was not able to test it.

My next step will be:
- patch guix, such that grub can work with btrfs subvolumes

Kind regards,
--
Stefan Karrmann
secure communication? GPG: 0x8C3260C01550B612E4C5730D22E42112094CE53F

[-- Attachment #2: patches/0001 --]
[-- Type: text/x-diff, Size: 12076 bytes --]

From 34a4849d7023ff7756c048246bc9d7c303170748 Mon Sep 17 00:00:00 2001
From: "S.Karrmann" <S.Karrmann@web.de>
Date: Sun, 20 Nov 2022 21:12:52 +0100
Subject: [PATCH] grub-configfile

---
 doc/guix.texi             | 42 +++++++++++++++++++++++++++++----------
 gnu/bootloader.scm        | 29 +++++++++++++++++++++++----
 gnu/bootloader/grub.scm   | 10 ++++++++++
 tests/boot-parameters.scm | 11 ++++++++++
 4 files changed, 78 insertions(+), 14 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index eaecfd0daa..c30880b8bc 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -109,6 +109,7 @@ Copyright @copyright{} 2022 Reily Siegel@*
 Copyright @copyright{} 2022 Simon Streit@*
 Copyright @copyright{} 2022 (@*
 Copyright @copyright{} 2022 John Kehayias@*
+Copyright @copyright{} 2022 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
@@ -6127,7 +6128,7 @@ Transformation Options}) so it should be lossless.

 @item --profile=@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.

@@ -6573,7 +6574,7 @@ interpreted as packages that will be added to the environment directly.

 @item --profile=@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.

@@ -12512,7 +12513,7 @@ candidates, and even to test their impact on packages that depend on
 them:

 @example
-guix build elogind --with-source=@dots{}/shepherd-0.9.0rc1.tar.gz
+guix build elogind --with-source=@dots{}/shepherd-0.9.0rc1.tar.gz
 @end example

 @dots{} or to build from a checkout in a pristine environment:
@@ -23294,7 +23295,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
@@ -38229,6 +38230,27 @@ The list of commands for loading Multiboot modules.  For example:
              @dots{}))
 @end lisp

+                    (device (uuid "5cbb9a70-a3c8-4384-a085-9e6896058343"))
+                    (configfile "/boot/grub/grub.cfg"))))))
+
+@item @code{configfile} (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
+@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"))
+     (configfile "/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
@@ -40116,7 +40138,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}
@@ -40165,7 +40187,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
@@ -40183,7 +40205,7 @@ manually specify a custom @var{serializer} for every field.

 (define (bar-serialize-string field-name value)
   @dots{})
-
+
 (define-configuration foo-configuration
   (label
    (string)
@@ -40215,7 +40237,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}
@@ -42708,7 +42730,7 @@ down in its dependency graph.  As it turns out, GLib 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=<optimized out>, argc=argc@@entry=1, argv=argv@@entry=0x7fffffffcfd8,
+#2  0x00007ffff7fe275a in call_init (l=<optimized out>, argc=argc@@entry=1, argv=argv@@entry=0x7fffffffcfd8,
     env=env@@entry=0x7fffffffcfe8) at dl-init.c:72
 #3  0x00007ffff7fe2866 in call_init (env=0x7fffffffcfe8, argv=0x7fffffffcfd8, argc=1, l=<optimized out>)
     at dl-init.c:118
@@ -42737,7 +42759,7 @@ Starting program: /gnu/store/@dots{}-profile/bin/sh -c exec\ inkscape
 #0  g_getenv (variable=variable@@entry=0x7ffff60c7a2e "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=<optimized out>, argc=argc@@entry=3, argv=argv@@entry=0x7fffffffd088,
+#3  0x00007ffff7fe275a in call_init (l=<optimized out>, argc=argc@@entry=3, argv=argv@@entry=0x7fffffffd088,
     env=env@@entry=0x7fffffffd0a8) at dl-init.c:72
 @dots{}
 @end example
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index da65b9d5d5..f34d222f69 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2022 Josselin Poiret <dev@jpoiret.xyz>
 ;;; Copyright © 2022 Reza Alizadeh Majd <r.majd@pantherx.org>
+;;; Copyright © 2022 Dr. Stefan Karrmann <S.Karrmann@web.de>
 ;;;
 ;;; 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-configfile

             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 <string>
+  (configfile       menu-entry-configfile
+                    (default #f))          ; string, path of grub.cfg file
   (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 configfile by specifying field @code{configfile}.
 @item chain-loader by specifying field @code{chain-loader}.
 @end enumerate"))))))

@@ -141,7 +146,7 @@
   (match entry
     (($ <menu-entry> label device mount-point
                      (? identity linux) linux-arguments (? identity initrd)
-                     #f () () #f)
+                     #f () () #f #f)
      `(menu-entry (version 0)
                   (label ,label)
                   (device ,(device->sexp device))
@@ -151,7 +156,7 @@
                   (initrd ,initrd)))
     (($ <menu-entry> 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)))
-    (($ <menu-entry> label device mount-point #f () #f #f () ()
+    (($ <menu-entry> 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)))
+    (($ <menu-entry> label device mount-point #f () #f #f () ()
+                     (? identity configfile) #f)
+     `(menu-entry (version 0)
+                  (label ,label)
+                  (device ,(device->sexp device))
+                  (device-mount-point ,mount-point)
+                  (configfile ,configfile)))
     (_ (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)
+                  ('configfile configfile) _ ...)
+     (menu-entry
+      (label label)
+      (device (sexp->device device))
+      (device-mount-point mount-point)
+      (configfile configfile)))
     (('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 7283257354..2afc1e0b09 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2020 Stefan <stefan-guix@vodafonemail.de>
 ;;; Copyright © 2022 Karl Hallsby <karl@hallsby.com>
 ;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
+;;; Copyright © 2022 Dr. Stefan Karrmann <S.Karrmann@web.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -416,6 +417,15 @@ menuentry ~s {
                     #$root-index (string-join (list #$@arguments) " " 'prefix)
                     (string-join (map string-join '#$modules)
                                  "\n  module " 'prefix))))
+       (configfile
+        #~(format port "
+menuentry ~s {
+  ~a
+  configfile ~a
+}~%
+                  #$label
+                  #$(grub-root-search device configfile)
+                  #$configfile"))
        (chain-loader
         #~(format port "
 menuentry ~s {
diff --git a/tests/boot-parameters.scm b/tests/boot-parameters.scm
index 03a1d01aff..028cffc73c 100644
--- a/tests/boot-parameters.scm
+++ b/tests/boot-parameters.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2019, 2020 Miguel Ángel Arruga Vivas <rosen644835@gmail.com>
 ;;; Copyright © 2022 Josselin Poiret <dev@jpoiret.xyz>
+;;; Copyright © 2022 Dr. Stefan Karrmann <S.Karrmann@web.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -318,6 +319,12 @@
    (linux "/boot/bzImage")
    (initrd "/boot/initrd.cpio.gz")))

+(define %configfile-menu-entry
+  (menu-entry
+   (label "test-configfile")
+   (device (uuid "6d5b13d4-6092-46d0-8be4-073dc07413cc"))
+   (configfile "/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, configfile"
+  %configfile-menu-entry
+  (sexp->menu-entry (menu-entry->sexp %configfile-menu-entry)))
+
 (test-end "boot-parameters")
--
2.30.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [bug#59619] [PATCH] grub-configfile
  2022-11-26 21:12 [bug#59619] [PATCH] grub-configfile Stefan Karrmann
@ 2022-11-26 21:14 ` ( via Guix-patches via
       [not found] ` <handler.59619.B.166949718928090.ack@debbugs.gnu.org>
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: ( via Guix-patches via @ 2022-11-26 21:14 UTC (permalink / raw)
  To: Stefan Karrmann, 59619

[-- Attachment #1: Type: text/plain, Size: 196 bytes --]

On Sat Nov 26, 2022 at 9:12 PM GMT, Stefan Karrmann wrote:
> somehow ~git send-mail~ seems not to work as expected. Therefore, I send
> this patch manually.

What's the error? :)

    -- (

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [bug#59619] Acknowledgement ([PATCH] grub-configfile)
       [not found] ` <handler.59619.B.166949718928090.ack@debbugs.gnu.org>
@ 2022-11-26 21:23   ` Stefan Karrmann
  2022-11-26 21:25     ` ( via Guix-patches via
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Karrmann @ 2022-11-26 21:23 UTC (permalink / raw)
  To: 59619; +Cc: paren

Dear paren,

all seems to work, but nothing got through to debbugs.gnu.org. Here is the
output:

====================================================================
$ git send-email --subject='grub configfile' --to='guix-patches@gnu.org' patches/0001-grub-configfile.patch --compose
patches/0001-grub-configfile.patch
E-Mail mit Zusammenfassung ist leer, wird ausgelassen
Die folgenden Dateien sind 8-Bit, aber deklarieren kein
Content-Transfer-Encoding.
    patches/0001-grub-configfile.patch
Welches 8-Bit-Encoding soll deklariert werden [UTF-8]?
(mbox) Füge cc: hinzu: "S.Karrmann" <S.Karrmann@web.de> von Zeile 'From: "S.Karrmann" <S.Karrmann@web.de>'

From: "S.Karrmann" <S.Karrmann@web.de>
To: guix-patches@gnu.org
Cc: "S.Karrmann" <S.Karrmann@web.de>
Subject: [PATCH] grub-configfile
Date: Sat, 26 Nov 2022 22:02:33 +0100
Message-Id: <20221126210233.84924-1-S.Karrmann@web.de>
X-Mailer: git-send-email 2.30.2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

    Die Cc-Liste oberhalb wurde um zusätzliche Adressen erweitert, die in der
    Commit-Beschreibung des Patches gefunden wurden. Wenn dies passiert, werden
    Sie von send-email zu einer Eingabe aufgefordert. Dieses Verhalten wird
    durch die Konfigurationseinstellung sendemail.confirm gesteuert.

    Für weitere Informationen, führen Sie 'git send-email --help' aus.
    Um das aktuelle Verhalten beizubehalten, aber diese Meldung zu unterdrücken,
    führen Sie 'git config --global sendemail.confirm auto' aus.

Diese E-Mail versenden? (Ja [y]|Nein [n]|Bearbeiten [e]|Beenden [q]|Alle [a]): y
OK. Log enthält:
Sendmail: /usr/sbin/sendmail -i guix-patches@gnu.org S.Karrmann@web.de
From: "S.Karrmann" <S.Karrmann@web.de>
To: guix-patches@gnu.org
Cc: "S.Karrmann" <S.Karrmann@web.de>
Subject: [PATCH] grub-configfile
Date: Sat, 26 Nov 2022 22:02:33 +0100
Message-Id: <20221126210233.84924-1-S.Karrmann@web.de>
X-Mailer: git-send-email 2.30.2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Ergebnis: OK
====================================================================

Sorry, for LANG=de

Kind regards,
--
Stefan Karrmann






^ permalink raw reply	[flat|nested] 10+ messages in thread

* [bug#59619] Acknowledgement ([PATCH] grub-configfile)
  2022-11-26 21:23   ` [bug#59619] Acknowledgement ([PATCH] grub-configfile) Stefan Karrmann
@ 2022-11-26 21:25     ` ( via Guix-patches via
  0 siblings, 0 replies; 10+ messages in thread
From: ( via Guix-patches via @ 2022-11-26 21:25 UTC (permalink / raw)
  To: Stefan Karrmann, 59619

[-- Attachment #1: Type: text/plain, Size: 346 bytes --]

On Sat Nov 26, 2022 at 9:23 PM GMT, Stefan Karrmann wrote:
> all seems to work, but nothing got through to debbugs.gnu.org. Here is the
> output:

I'm not really sure what the problem is, but you might have more success following
these instructions:

  <https://guix.gnu.org/manual/devel/en/html_node/Submitting-Patches.html>

    -- (

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [bug#59619] [PATCH] grub-configfile
  2022-11-26 21:12 [bug#59619] [PATCH] grub-configfile Stefan Karrmann
  2022-11-26 21:14 ` ( via Guix-patches via
       [not found] ` <handler.59619.B.166949718928090.ack@debbugs.gnu.org>
@ 2022-11-26 21:32 ` Julien Lepiller
  2023-01-29 18:33 ` [bug#59619] [PATCH] grub-configfile - guix shell ... ./pre-inst-env Stefan Karrmann
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Julien Lepiller @ 2022-11-26 21:32 UTC (permalink / raw)
  To: 59619, S.Karrmann

[-- Attachment #1: Type: text/plain, Size: 1375 bytes --]

If it's your first submission, it gets delayed for manual review, which might be what's happening with send-email. However this email should also have been delayed, so not sure what's happening.

Regarding your patch, tomething seems to have gone wrong. I don't have the tool right now to figure it out, but you have quite a few lines that seem to be identical but marked as changed. What happened there?

One way to test it is to use pre-inst-env to use that new version of guix and build a system (you wouldn't be able to use sudo, so you can't boot it, but you can build and inspect). Something like:

guix gc -R $(./pre-inst-env guix system build example.scm) | grep grub.cfg

Will give you the name of the config file. For less builds, you could use -n and build the derivation for grub.cfg only, manually.

HTH!

Le 26 novembre 2022 22:12:54 GMT+01:00, Stefan Karrmann <S.Karrmann@web.de> a écrit :
>Dear all,
>
>somehow ~git send-mail~ seems not to work as expected. Therefore, I send
>this patch manually.
>
>The patch allows us to use the menuentry configfile for grub. As I'm still
>a newbie with regard to guix, I was not able to test it.
>
>My next step will be:
>- patch guix, such that grub can work with btrfs subvolumes
>
>Kind regards,
>--
>Stefan Karrmann
>secure communication? GPG: 0x8C3260C01550B612E4C5730D22E42112094CE53F

[-- Attachment #2: Type: text/html, Size: 1669 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [bug#59619] [PATCH] grub-configfile - guix shell ... ./pre-inst-env
  2022-11-26 21:12 [bug#59619] [PATCH] grub-configfile Stefan Karrmann
                   ` (2 preceding siblings ...)
  2022-11-26 21:32 ` [bug#59619] [PATCH] grub-configfile Julien Lepiller
@ 2023-01-29 18:33 ` Stefan Karrmann
  2023-01-31 17:33 ` [bug#59619] [PATCH] grub-configfile tested successfully S.Karrmann
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Stefan Karrmann @ 2023-01-29 18:33 UTC (permalink / raw)
  To: 59619

Dear all,

I managed to run guix directly in my guix git-clone. A peek shows that the
new menu-entry works initially. Later, it runs into an
record-abi-mismatch-error. I suspect, that this happens on the side of the
guix-daemon. Is this really the problem? How can we handle it?

$ ./pre-inst-env ~/guix-clone/scripts/guix system vm /home/sk/guix/system-initial.scm --share=/ --full-boot --root=/home/sk/guix/vm
;;; (#<<menu-entry> label: "Grub config" device: #<<uuid> type: dce bv: #vu8(92 187 154 112 163 200 67 132 160 133 158 104 150 5 131 67)> device-mount-point: #f linux: #f linux-arguments: () initrd: #f multiboot-kernel: #f multiboot-arguments: () multiboot-modules: () config-file: "/boot/grub/grub.cfg" chain-loader: #f>)
Backtrace:
In guix/store.scm:
   1300:8 19 (call-with-build-handler #<procedure 7fc711da4960 at g?> ?)
  2170:25 18 (run-with-store #<store-connection 256.99 7fc711aac4b0> ?)
In guix/scripts/system.scm:
    850:2 17 (_ _)
In guix/gexp.scm:
   1180:2 16 (_ _)
   1046:2 15 (_ _)
    892:4 14 (_ _)
In guix/store.scm:
  2055:12 13 (_ #<store-connection 256.99 7fc711aac4b0>)
  1382:11 12 (map/accumulate-builds #<store-connection 256.99 7fc71?> ?)
   1300:8 11 (call-with-build-handler #<procedure 7fc71026d9f0 at g?> ?)
  2170:25 10 (run-with-store #<store-connection 256.99 7fc711aac4b0> ?)
In guix/gexp.scm:
   897:13  9 (_ _)
In guix/store.scm:
  1998:13  8 (_ #<store-connection 256.99 7fc711aac4b0>)
In guix/gexp.scm:
   299:51  7 (_)
In unknown file:
           6 (with-fluids* (#<fluid 7fc726ac1220>) (#f) #<procedure ?>)
In guix/gexp.scm:
   733:29  5 (_)
In gnu/system/image.scm:
   938:21  4 (_)
In gnu/system.scm:
  1448:26  3 (operating-system-bootcfg #<<operating-system> kernel:?> ?)
    521:4  2 (boot-parameters->menu-entry _)
In ice-9/boot-9.scm:
  1685:16  1 (raise-exception _ #:continuable? _)
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Throw to key `record-abi-mismatch-error' with args `(abi-check "~a: record ABI mismatch; recompilation needed" (#<record-type <menu-entry>>) ())'.

---- system-config.scm
;; this is based on znavko's Dual Boot config
;; with the second OS in GRUB on the separate hdd /dev/sda9 ( grub: (hd1,gpt8) )

(use-modules (gnu)
             (gnu system nss)
             (gnu system locale)       ;;for locale-definition
             (gnu services desktop)
             (gnu services networking) ;;for remove ntp
             (gnu services avahi)      ;;for remove avahi - an dns?
             (gnu services xorg)
             (gnu services admin)      ;;for unattended-upgrades
             (gnu packages admin)      ;;for wpa_supplicant
             (gnu packages suckless)
             (gnu packages networking)  ;; iwd
             (srfi srfi-1)             ;;for remove function
             )

(use-modules (system vm inspect)
             (ice-9 pretty-print))      ;; debugging$

(use-modules (gnu packages linux))     ;; free/libre linux

(use-service-modules desktop networking base xorg)
(use-package-modules certs wm suckless)

(define (peek . stuff)
  (newline)
  (display ";;; ")
  (write stuff)
  (newline)
  (car (last-pair stuff)))

(define pk peek)

(define guix-ext-root
  (file-system (device (file-system-label "guix-ext"))
               (mount-point "/")
               (type "btrfs")
               ; (options "subvol=guix-root/work,noatime")
               (needed-for-boot? #t)))
(define guix-ext-boot
  (file-system (device (file-system-label "guix-ext-boot"))
               (mount-point "/boot")
               (options "subvol=boot/work")
               (type "btrfs")
               (needed-for-boot? #f))) ; only by grub upto initrd
(define guix-ext-efi
  (file-system (device (file-system-label "GUIX-EXT-EF"))
               (mount-point "/boot/efi")
               #;(mount-point "/sys/firmware/efi/efivars")
               (type "vfat")))

(operating-system
 (host-name "johann") (timezone "Europe/Berlin") (locale "de_DE.utf8")
 (keyboard-layout (keyboard-layout "de"))
 (initrd-modules (cons*
                  "btrfs"
                  %base-initrd-modules))

 (kernel linux-libre) ; gnu libre
 (firmware (cons* %base-firmware))
 (kernel-arguments (cons*
                    "rootdelay=3"
                    ; now default subvol: "rootflags=subvol=/guix-ext/work"
                    (remove (lambda (option) (string=? option "quiet")) %default-kernel-arguments)))
 (bootloader (bootloader-configuration
              (bootloader
               (bootloader
                (inherit grub-bootloader) (installer #~(const #t))))
              ; (bootloader grub-bootloader)
              (targets (list "/dev/sdb"))
              (keyboard-layout keyboard-layout)
              (menu-entries (list
                             (pk (menu-entry
                              (label "Grub config")
                              (device (uuid "5cbb9a70-a3c8-4384-a085-9e6896058343"))
                              (config-file "/boot/grub/grub.cfg")))
                             (menu-entry
                                   (label "Debian")
                                   (linux "(hd1,gpt8)/boot/vmlinuz") ; generates nonsens: search --file --set /guix-root/work(hd1,gpt8)/boot/vmlinuz
                                   (linux-arguments '("root=/dev/sda9")) ; dito dito
                                   (initrd "(hd1,gpt8)/boot/initrd.img"))))))

 (file-systems (cons*
                guix-ext-root
                guix-ext-boot
                guix-ext-efi
                %base-file-systems))
 (swap-devices
  (list (swap-space (target (uuid "d48bfe0f-9715-4267-81c9-b1503144fab6")))))

 (users (cons* (user-account
                (name "sk") (uid 1000) (group "sk")
                (supplementary-groups '("users" "wheel" "netdev" "audio" "video"))
                (home-directory "/home/sk"))
               %base-user-accounts))

 (groups (cons* (user-group (name "sk") (id 1000))
                %base-groups))

 ;; This is where we specify system-wide packages.
 (packages (cons* nss-certs ;for HTTPS access
                  i3-wm i3status dmenu
                  dwm
                  iwd ; needs dbus...
                  slock st
                  %base-packages))

 (locale-definitions (list (locale-definition (name "de_DE.utf8") (source "de_DE"))
                           (locale-definition (name "en_US.utf8") (source "en_US"))))

 (services (cons*
            (set-xorg-configuration
             (xorg-configuration             ;for Xorg
              (keyboard-layout keyboard-layout)))
            (screen-locker-service slock)
            (modify-services
             ;; removing unnecessary services
             (remove (lambda (service)
                       (member (service-kind service)
                               (list ntp-service-type avahi-service-type
                                     bluetooth-service
                                     gdm-service-type)))
                     %desktop-services) ;end of remove lambda services
             ) ;;end of modify-services
            )) ;;end of services

 ;; Allow resolution of '.local' host names with mDNS.
 (name-service-switch %mdns-host-lookup-nss)

 ;;blacklist ugly sound speaker, blacklist
 #;(kernel-arguments '("modprobe.blacklist=pcspkr,snd_pcsp,bluetooth"))

 ) ;;end of operating-system
----

--
Stefan Karrmann
Sichere Kommunikation? GPG: 0x8C3260C01550B612E4C5730D22E42112094CE53F

An sich ist nichts weder gut noch böse. Erst das Denken mach es dazu.
		-- William Shakespeare (Hamlet)




^ permalink raw reply	[flat|nested] 10+ messages in thread

* [bug#59619] [PATCH] grub-configfile tested successfully
  2022-11-26 21:12 [bug#59619] [PATCH] grub-configfile Stefan Karrmann
                   ` (3 preceding siblings ...)
  2023-01-29 18:33 ` [bug#59619] [PATCH] grub-configfile - guix shell ... ./pre-inst-env Stefan Karrmann
@ 2023-01-31 17:33 ` S.Karrmann
  2023-02-02 13:38   ` Julien Lepiller
  2023-02-02 19:04 ` [bug#59619] [PATCH] grub-configfile tested S.Karrmann
  2023-02-07  6:35 ` [bug#59619] [PATCH] grub-configfile Stefan Karrmann
  6 siblings, 1 reply; 10+ messages in thread
From: S.Karrmann @ 2023-01-31 17:33 UTC (permalink / raw)
  To: 59619

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 install
Guix in parallel to another OS. So more people can test it and will fall in
love with Guix, hopefully.

Kind regards,
Dr. Stefan Karrmann

---
 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
--- 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=@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 environment directly.

 @item --profile=@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 packages that depend on
 them:

 @example
-guix build elogind --with-source=@dots{}/shepherd-0.9.0rc1.tar.gz
+guix build elogind --with-source=@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 modules.  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 every 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, GLib 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=<optimized out>, argc=argc@@entry=1, argv=argv@@entry=0x7fffffffcfd8,
+#2  0x00007ffff7fe275a in call_init (l=<optimized out>, argc=argc@@entry=1, argv=argv@@entry=0x7fffffffcfd8,
     env=env@@entry=0x7fffffffcfe8) at dl-init.c:72
 #3  0x00007ffff7fe2866 in call_init (env=0x7fffffffcfe8, argv=0x7fffffffcfd8, argc=1, l=<optimized out>)
     at dl-init.c:118
@@ -43182,7 +43201,7 @@ Starting program: /gnu/store/@dots{}-profile/bin/sh -c exec\ inkscape
 #0  g_getenv (variable=variable@@entry=0x7ffff60c7a2e "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=<optimized out>, argc=argc@@entry=3, argv=argv@@entry=0x7fffffffd088,
+#3  0x00007ffff7fe275a in call_init (l=<optimized out>, argc=argc@@entry=3, argv=argv@@entry=0x7fffffffd088,
     env=env@@entry=0x7fffffffd0a8) at dl-init.c:72
 @dots{}
 @end example
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index 2c36d8c6cf..7c24fd2ebf 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2022 Josselin Poiret <dev@jpoiret.xyz>
 ;;; Copyright © 2022 Reza Alizadeh Majd <r.majd@pantherx.org>
+;;; Copyright © 2022 Dr. Stefan Karrmann <S.Karrmann@web.de>
 ;;;
 ;;; 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 <string>
+  (config-file      menu-entry-config-file
+                    (default #f))          ; string, path of grub.cfg file
   (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
     (($ <menu-entry> label device mount-point
                      (? identity linux) linux-arguments (? identity initrd)
-                     #f () () #f)
+                     #f () () #f #f)
      `(menu-entry (version 0)
                   (label ,label)
                   (device ,(device->sexp device))
@@ -151,7 +156,7 @@
                   (initrd ,initrd)))
     (($ <menu-entry> 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)))
-    (($ <menu-entry> label device mount-point #f () #f #f () ()
+    (($ <menu-entry> 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)))
+    (($ <menu-entry> 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
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2020 Stefan <stefan-guix@vodafonemail.de>
 ;;; Copyright © 2022 Karl Hallsby <karl@hallsby.com>
 ;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
+;;; Copyright © 2022 Dr. Stefan Karrmann <S.Karrmann@web.de>
 ;;;
 ;;; 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) " " 'prefix)
                     (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
--- a/tests/boot-parameters.scm
+++ b/tests/boot-parameters.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2019, 2020 Miguel Ángel Arruga Vivas <rosen644835@gmail.com>
 ;;; Copyright © 2022 Josselin Poiret <dev@jpoiret.xyz>
+;;; Copyright © 2022 Dr. Stefan Karrmann <S.Karrmann@web.de>
 ;;;
 ;;; 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")
--
2.30.2





^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [bug#59619] [PATCH] grub-configfile tested successfully
  2023-01-31 17:33 ` [bug#59619] [PATCH] grub-configfile tested successfully S.Karrmann
@ 2023-02-02 13:38   ` Julien Lepiller
  0 siblings, 0 replies; 10+ messages in thread
From: Julien Lepiller @ 2023-02-02 13:38 UTC (permalink / raw)
  To: S.Karrmann; +Cc: 59619

thanks for the patch!

I was not able to apply it, and it contains unchanged lines, which is
weird. Could you rebase the patch on top of master before sending it
again? I wasn't able to test it yet, but it looks good :)

Le Tue, 31 Jan 2023 18:33:38 +0100,
"S.Karrmann" <S.Karrmann@web.de> a écrit :

> 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
> install Guix in parallel to another OS. So more people can test it
> and will fall in love with Guix, hopefully.
> 
> Kind regards,
> Dr. Stefan Karrmann
> 
> ---
>  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
> --- 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=@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 environment directly.
> 
>  @item --profile=@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
> packages that depend on them:
> 
>  @example
> -guix build elogind --with-source=@dots{}/shepherd-0.9.0rc1.tar.gz
> +guix build elogind --with-source=@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
> modules.  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 every 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, GLib 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=<optimized out>,
> argc=argc@@entry=1, argv=argv@@entry=0x7fffffffcfd8, +#2
> 0x00007ffff7fe275a in call_init (l=<optimized out>,
> argc=argc@@entry=1, argv=argv@@entry=0x7fffffffcfd8,
> env=env@@entry=0x7fffffffcfe8) at dl-init.c:72 #3  0x00007ffff7fe2866
> in call_init (env=0x7fffffffcfe8, argv=0x7fffffffcfd8, argc=1,
> l=<optimized out>) at dl-init.c:118 @@ -43182,7 +43201,7 @@ Starting
> program: /gnu/store/@dots{}-profile/bin/sh -c exec\ inkscape #0
> g_getenv (variable=variable@@entry=0x7ffff60c7a2e "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=<optimized out>,
> argc=argc@@entry=3, argv=argv@@entry=0x7fffffffd088, +#3
> 0x00007ffff7fe275a in call_init (l=<optimized out>,
> argc=argc@@entry=3, argv=argv@@entry=0x7fffffffd088,
> env=env@@entry=0x7fffffffd0a8) at dl-init.c:72 @dots{} @end example
> diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index
> 2c36d8c6cf..7c24fd2ebf 100644 --- a/gnu/bootloader.scm +++
> b/gnu/bootloader.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2020 Jan
> (janneke) Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2022
> Josselin Poiret <dev@jpoiret.xyz> ;;; Copyright © 2022 Reza Alizadeh
> Majd <r.majd@pantherx.org> +;;; Copyright © 2022 Dr. Stefan Karrmann
> <S.Karrmann@web.de> ;;; ;;; 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 <string>
> +  (config-file      menu-entry-config-file
> +                    (default #f))          ; string, path of
> grub.cfg file (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
>      (($ <menu-entry> label device mount-point
>                       (? identity linux) linux-arguments (? identity
> initrd)
> -                     #f () () #f)
> +                     #f () () #f #f)
>       `(menu-entry (version 0)
>                    (label ,label)
>                    (device ,(device->sexp device))
> @@ -151,7 +156,7 @@
>                    (initrd ,initrd)))
>      (($ <menu-entry> 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)))
> -    (($ <menu-entry> label device mount-point #f () #f #f () ()
> +    (($ <menu-entry> 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)))
> +    (($ <menu-entry> 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
> --- a/gnu/bootloader/grub.scm
> +++ b/gnu/bootloader/grub.scm
> @@ -9,6 +9,7 @@
>  ;;; Copyright © 2020 Stefan <stefan-guix@vodafonemail.de>
>  ;;; Copyright © 2022 Karl Hallsby <karl@hallsby.com>
>  ;;; Copyright © 2022 Denis 'GNUtoo' Carikli
> <GNUtoo@cyberdimension.org> +;;; Copyright © 2022 Dr. Stefan Karrmann
> <S.Karrmann@web.de> ;;;
>  ;;; 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) "
> " 'prefix) (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
> --- a/tests/boot-parameters.scm
> +++ b/tests/boot-parameters.scm
> @@ -1,6 +1,7 @@
>  ;;; GNU Guix --- Functional package management for GNU
>  ;;; Copyright © 2019, 2020 Miguel Ángel Arruga Vivas
> <rosen644835@gmail.com> ;;; Copyright © 2022 Josselin Poiret
> <dev@jpoiret.xyz> +;;; Copyright © 2022 Dr. Stefan Karrmann
> <S.Karrmann@web.de> ;;;
>  ;;; 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")
> --
> 2.30.2
> 
> 
> 
> 





^ permalink raw reply	[flat|nested] 10+ messages in thread

* [bug#59619] [PATCH] grub-configfile tested
  2022-11-26 21:12 [bug#59619] [PATCH] grub-configfile Stefan Karrmann
                   ` (4 preceding siblings ...)
  2023-01-31 17:33 ` [bug#59619] [PATCH] grub-configfile tested successfully S.Karrmann
@ 2023-02-02 19:04 ` S.Karrmann
  2023-02-07  6:35 ` [bug#59619] [PATCH] grub-configfile Stefan Karrmann
  6 siblings, 0 replies; 10+ messages in thread
From: S.Karrmann @ 2023-02-02 19:04 UTC (permalink / raw)
  To: 59619

now I generated this patch by:

git pull
git format-patch -o patches --ignore-space-at-eol origin/master..HEAD

My Emacs deletes intentionally all space at eol. Therefore, the other patch
may work with:
git apply --whitespace=warn grub-configfile.patch


---
 doc/guix.texi             | 19 +++++++++++++++++++
 gnu/bootloader.scm        | 29 +++++++++++++++++++++++++----
 gnu/bootloader/grub.scm   | 11 +++++++++++
 tests/boot-parameters.scm | 11 +++++++++++
 4 files changed, 66 insertions(+), 4 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 64873db00b..937f7c54cb 100644
--- 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
@@ -38666,6 +38667,24 @@ The list of commands for loading Multiboot modules.  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
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index 2c36d8c6cf..7c24fd2ebf 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2022 Josselin Poiret <dev@jpoiret.xyz>
 ;;; Copyright © 2022 Reza Alizadeh Majd <r.majd@pantherx.org>
+;;; Copyright © 2022 Dr. Stefan Karrmann <S.Karrmann@web.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -49,6 +50,7 @@ (define-module (gnu bootloader)
             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 @@ (define-record-type* <menu-entry>
   (multiboot-modules menu-entry-multiboot-modules
                      (default '()))        ; list of multiboot commands, where
                                            ; a command is a list of <string>
+  (config-file      menu-entry-config-file
+                    (default #f))          ; string, path of grub.cfg file
   (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 @@ (define (report-menu-entry-error menu-entry)
 @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 @@ (define (device->sexp device)
   (match entry
     (($ <menu-entry> label device mount-point
                      (? identity linux) linux-arguments (? identity initrd)
-                     #f () () #f)
+                     #f () () #f #f)
      `(menu-entry (version 0)
                   (label ,label)
                   (device ,(device->sexp device))
@@ -151,7 +156,7 @@ (define (device->sexp device)
                   (initrd ,initrd)))
     (($ <menu-entry> 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 @@ (define (device->sexp device)
                   (multiboot-kernel ,multiboot-kernel)
                   (multiboot-arguments ,multiboot-arguments)
                   (multiboot-modules ,multiboot-modules)))
-    (($ <menu-entry> label device mount-point #f () #f #f () ()
+    (($ <menu-entry> 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)))
+    (($ <menu-entry> 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 @@ (define (sexp->device device-sexp)
       (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
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2020 Stefan <stefan-guix@vodafonemail.de>
 ;;; Copyright © 2022 Karl Hallsby <karl@hallsby.com>
 ;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
+;;; Copyright © 2022 Dr. Stefan Karrmann <S.Karrmann@web.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -377,6 +378,7 @@ (define (menu-entry->gexp entry)
           (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 @@ (define (menu-entry->gexp entry)
                     #$root-index (string-join (list #$@arguments) " " 'prefix)
                     (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
--- a/tests/boot-parameters.scm
+++ b/tests/boot-parameters.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2019, 2020 Miguel Ángel Arruga Vivas <rosen644835@gmail.com>
 ;;; Copyright © 2022 Josselin Poiret <dev@jpoiret.xyz>
+;;; Copyright © 2022 Dr. Stefan Karrmann <S.Karrmann@web.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -318,6 +319,12 @@ (define %file-system-label-menu-entry
    (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 @@ (define %file-system-label-menu-entry
   %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")
--
2.39.1





^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [bug#59619] [PATCH] grub-configfile
  2022-11-26 21:12 [bug#59619] [PATCH] grub-configfile Stefan Karrmann
                   ` (5 preceding siblings ...)
  2023-02-02 19:04 ` [bug#59619] [PATCH] grub-configfile tested S.Karrmann
@ 2023-02-07  6:35 ` Stefan Karrmann
  6 siblings, 0 replies; 10+ messages in thread
From: Stefan Karrmann @ 2023-02-07  6:35 UTC (permalink / raw)
  To: 59619

[-- Attachment #1: Type: text/plain, Size: 260 bytes --]

Dear Julien,

now I generated the diff by ~git diff > configfile.diff-patch~ and tested
it on commit ~a582d863465990642d331bc05bf073f47fb80908~ by
~git apply configfile.diff-patch~. I hope you can apply it now, even on an
updated origin.

Kind regards,
Stefan

[-- Attachment #2: configfile.diff-patch --]
[-- Type: text/plain, Size: 12173 bytes --]

diff --git a/doc/guix.texi b/doc/guix.texi
index 359c9b7a47..8fb5e0eaa3 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -113,6 +113,7 @@ Copyright @copyright{} 2022 Bruno Victal@*
 Copyright @copyright{} 2022 Ivan Vilata-i-Balaguer@*
 Copyright @copyright{} 2023 Giacomo Leidi@*
 Copyright @copyright{} 2022 Antero Mejr@*
+Copyright @copyright{} 2023 Dr. Stefan Karrmann@*
 Copyright @copyright{} 2022 Bruno Victal@*

 Permission is granted to copy, distribute and/or modify this document
@@ -6161,7 +6162,7 @@ Transformation Options}) so it should be lossless.

 @item --profile=@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.

@@ -6607,7 +6608,7 @@ interpreted as packages that will be added to the environment directly.

 @item --profile=@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.

@@ -12566,7 +12567,7 @@ candidates, and even to test their impact on packages that depend on
 them:

 @example
-guix build elogind --with-source=@dots{}/shepherd-0.9.0rc1.tar.gz
+guix build elogind --with-source=@dots{}/shepherd-0.9.0rc1.tar.gz
 @end example

 @dots{} or to build from a checkout in a pristine environment:
@@ -23484,7 +23485,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
@@ -38946,6 +38947,24 @@ The list of commands for loading Multiboot modules.  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
@@ -40833,7 +40852,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}
@@ -40882,7 +40901,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
@@ -40900,7 +40919,7 @@ manually specify a custom @var{serializer} for every field.

 (define (bar-serialize-string field-name value)
   @dots{})
-
+
 (define-configuration foo-configuration
   (label
    (string)
@@ -40932,7 +40951,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}
@@ -43463,7 +43482,7 @@ down in its dependency graph.  As it turns out, GLib 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=<optimized out>, argc=argc@@entry=1, argv=argv@@entry=0x7fffffffcfd8,
+#2  0x00007ffff7fe275a in call_init (l=<optimized out>, argc=argc@@entry=1, argv=argv@@entry=0x7fffffffcfd8,
     env=env@@entry=0x7fffffffcfe8) at dl-init.c:72
 #3  0x00007ffff7fe2866 in call_init (env=0x7fffffffcfe8, argv=0x7fffffffcfd8, argc=1, l=<optimized out>)
     at dl-init.c:118
@@ -43492,7 +43511,7 @@ Starting program: /gnu/store/@dots{}-profile/bin/sh -c exec\ inkscape
 #0  g_getenv (variable=variable@@entry=0x7ffff60c7a2e "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=<optimized out>, argc=argc@@entry=3, argv=argv@@entry=0x7fffffffd088,
+#3  0x00007ffff7fe275a in call_init (l=<optimized out>, argc=argc@@entry=3, argv=argv@@entry=0x7fffffffd088,
     env=env@@entry=0x7fffffffd0a8) at dl-init.c:72
 @dots{}
 @end example
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index 2c36d8c6cf..7c24fd2ebf 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2022 Josselin Poiret <dev@jpoiret.xyz>
 ;;; Copyright © 2022 Reza Alizadeh Majd <r.majd@pantherx.org>
+;;; Copyright © 2022 Dr. Stefan Karrmann <S.Karrmann@web.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -49,6 +50,7 @@ (define-module (gnu bootloader)
             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 @@ (define-record-type* <menu-entry>
   (multiboot-modules menu-entry-multiboot-modules
                      (default '()))        ; list of multiboot commands, where
                                            ; a command is a list of <string>
+  (config-file      menu-entry-config-file
+                    (default #f))          ; string, path of grub.cfg file
   (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 @@ (define (report-menu-entry-error menu-entry)
 @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 @@ (define (device->sexp device)
   (match entry
     (($ <menu-entry> label device mount-point
                      (? identity linux) linux-arguments (? identity initrd)
-                     #f () () #f)
+                     #f () () #f #f)
      `(menu-entry (version 0)
                   (label ,label)
                   (device ,(device->sexp device))
@@ -151,7 +156,7 @@ (define (device->sexp device)
                   (initrd ,initrd)))
     (($ <menu-entry> 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 @@ (define (device->sexp device)
                   (multiboot-kernel ,multiboot-kernel)
                   (multiboot-arguments ,multiboot-arguments)
                   (multiboot-modules ,multiboot-modules)))
-    (($ <menu-entry> label device mount-point #f () #f #f () ()
+    (($ <menu-entry> 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)))
+    (($ <menu-entry> 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 @@ (define (sexp->device device-sexp)
       (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
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2020 Stefan <stefan-guix@vodafonemail.de>
 ;;; Copyright © 2022 Karl Hallsby <karl@hallsby.com>
 ;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
+;;; Copyright © 2022 Dr. Stefan Karrmann <S.Karrmann@web.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -377,6 +378,7 @@ (define (menu-entry->gexp entry)
           (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 @@ (define (menu-entry->gexp entry)
                     #$root-index (string-join (list #$@arguments) " " 'prefix)
                     (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
--- a/tests/boot-parameters.scm
+++ b/tests/boot-parameters.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2019, 2020 Miguel Ángel Arruga Vivas <rosen644835@gmail.com>
 ;;; Copyright © 2022 Josselin Poiret <dev@jpoiret.xyz>
+;;; Copyright © 2022 Dr. Stefan Karrmann <S.Karrmann@web.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -318,6 +319,12 @@ (define %file-system-label-menu-entry
    (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 @@ (define %file-system-label-menu-entry
   %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")

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-02-07  6:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-26 21:12 [bug#59619] [PATCH] grub-configfile Stefan Karrmann
2022-11-26 21:14 ` ( via Guix-patches via
     [not found] ` <handler.59619.B.166949718928090.ack@debbugs.gnu.org>
2022-11-26 21:23   ` [bug#59619] Acknowledgement ([PATCH] grub-configfile) Stefan Karrmann
2022-11-26 21:25     ` ( via Guix-patches via
2022-11-26 21:32 ` [bug#59619] [PATCH] grub-configfile Julien Lepiller
2023-01-29 18:33 ` [bug#59619] [PATCH] grub-configfile - guix shell ... ./pre-inst-env Stefan Karrmann
2023-01-31 17:33 ` [bug#59619] [PATCH] grub-configfile tested successfully S.Karrmann
2023-02-02 13:38   ` Julien Lepiller
2023-02-02 19:04 ` [bug#59619] [PATCH] grub-configfile tested S.Karrmann
2023-02-07  6:35 ` [bug#59619] [PATCH] grub-configfile Stefan Karrmann

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.