* [bug#57496] [PATCH 0/2] Add support for chain-loader
2022-08-31 5:23 [bug#57496] [PATCH 0/2] Add support for chain-loader typ22
@ 2022-08-31 19:52 ` Maxime Devos
[not found] ` <7xtu5r7nt9.fsf@foxmail.com>
2022-09-01 6:03 ` [bug#57496] [PATCH v2 1/2] gnu: bootloader: Extend `<menu-entry>' " typ22
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Maxime Devos @ 2022-08-31 19:52 UTC (permalink / raw)
To: typ22, 57496
[-- Attachment #1.1.1: Type: text/plain, Size: 1000 bytes --]
> Why do I want to use chainloader instead of linux and initrd?
>
> 1. guix system and archlinux are independent of each other in my computer.
> They are just on the same computer, but they have their own disk partitions.
> I also don't want them to interfere with each other.
> (I have no money to buy more computers. I just have one computer.)
Sounds a practical system to me.
On 31-08-2022 07:23, typ22@foxmail.com wrote:
> Is the chain-loader free?
>
> The chain-loader is a function of grub, and grub's protocol is GPL3.
> I think it is free. Although chain-loader can boot nonfree system like windows,
> it's like nonfree software can run on linux-libre, and linux-libre is free.
>
> If Guix think it's nonfree, I will only keep these changes in my computer.
I do believe it counts as free, especially given that it can be used to
boot into other free systems (e.g., Trisquel) and that you example usage
is for booting into a largely-free system.
Greetings,
Maxime.
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [bug#57496] [PATCH v2 1/2] gnu: bootloader: Extend `<menu-entry>' for chain-loader.
2022-08-31 5:23 [bug#57496] [PATCH 0/2] Add support for chain-loader typ22
2022-08-31 19:52 ` Maxime Devos
@ 2022-09-01 6:03 ` typ22
2022-09-04 14:04 ` [bug#57496] [PATCH v3 1/3] " typ22
2022-09-04 17:25 ` [bug#57496] [PATCH v4 " typ22
3 siblings, 0 replies; 6+ messages in thread
From: typ22 @ 2022-09-01 6:03 UTC (permalink / raw)
To: 57496; +Cc: Julien Lepiller, tiantian
From: tiantian <typ22@foxmail.com>
* gnu/bootloader.scm (<menu-entry>)[chain-loader]: New field.
(menu-entry->sexp, sexp->menu-entry): Support chain-loader.
* doc/guix.texi (Bootloader Configuration): Document it.
---
Correct the document and specify all fields of <menu-entry> in the pattern
of menu-entry->sexp.
Now still judge linux, multiboot-kernel and chain-loader. Because if don't
judge, the menu-entry that all of linux, linux-multiboot and chainloader
are #f will match the first one.
Then produce Error message:
guix system: error: #<unspecified>: invalid G-expression input
This error message does not help.
doc/guix.texi | 18 ++++++++++++++++++
gnu/bootloader.scm | 34 ++++++++++++++++++++++++++++------
2 files changed, 46 insertions(+), 6 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 957b9a668e..3f0317ba60 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -37536,6 +37536,24 @@ Bootloader Configuration
@dots{}))
@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
+@code{linux-multiboot} fields are specified. The following is an
+example of chainloading a different GNU/Linux system.
+
+@lisp
+(bootloader
+ (bootloader-configuration
+ ;; @dots{}
+ (menu-entries
+ (list
+ (menu-entry
+ (label "GNU/Linux")
+ (device (uuid "1C31-A17C" 'fat))
+ (chain-loader "/EFI/GNULinux/grubx64.efi"))))))
+@end lisp
+
@end table
@end deftp
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index 77c05e8946..03c18ad0c9 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -46,6 +46,7 @@ (define-module (gnu bootloader)
menu-entry-multiboot-kernel
menu-entry-multiboot-arguments
menu-entry-multiboot-modules
+ menu-entry-chain-loader
menu-entry->sexp
sexp->menu-entry
@@ -104,8 +105,11 @@ (define-record-type* <menu-entry>
(multiboot-arguments menu-entry-multiboot-arguments
(default '())) ; list of string-valued gexps
(multiboot-modules menu-entry-multiboot-modules
- (default '()))) ; list of multiboot commands, where
+ (default '())) ; list of multiboot commands, where
; a command is a list of <string>
+ (chain-loader menu-entry-chain-loader
+ (default #f))) ; string, path of efi file
+
(define (menu-entry->sexp entry)
"Return ENTRY serialized as an sexp."
@@ -117,8 +121,9 @@ (define (menu-entry->sexp entry)
`(label ,(file-system-label->string label)))
(_ device)))
(match entry
- (($ <menu-entry> label device mount-point linux linux-arguments initrd #f
- ())
+ (($ <menu-entry> label device mount-point
+ (? identity linux) linux-arguments initrd
+ #f () () #f)
`(menu-entry (version 0)
(label ,label)
(device ,(device->sexp device))
@@ -127,14 +132,22 @@ (define (menu-entry->sexp entry)
(linux-arguments ,linux-arguments)
(initrd ,initrd)))
(($ <menu-entry> label device mount-point #f () #f
- multiboot-kernel multiboot-arguments multiboot-modules)
+ (? identity multiboot-kernel) multiboot-arguments
+ multiboot-modules #f)
`(menu-entry (version 0)
(label ,label)
(device ,(device->sexp device))
(device-mount-point ,mount-point)
(multiboot-kernel ,multiboot-kernel)
(multiboot-arguments ,multiboot-arguments)
- (multiboot-modules ,multiboot-modules)))))
+ (multiboot-modules ,multiboot-modules)))
+ (($ <menu-entry> label device mount-point #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)))))
(define (sexp->menu-entry sexp)
"Turn SEXP, an sexp as returned by 'menu-entry->sexp', into a <menu-entry>
@@ -171,7 +184,16 @@ (define (sexp->menu-entry sexp)
(device-mount-point mount-point)
(multiboot-kernel multiboot-kernel)
(multiboot-arguments multiboot-arguments)
- (multiboot-modules multiboot-modules)))))
+ (multiboot-modules multiboot-modules)))
+ (('menu-entry ('version 0)
+ ('label label) ('device device)
+ ('device-mount-point mount-point)
+ ('chain-loader chain-loader) _ ...)
+ (menu-entry
+ (label label)
+ (device (sexp->device device))
+ (device-mount-point mount-point)
+ (chain-loader chain-loader)))))
\f
;;;
base-commit: 6beadc82df204f315d06ea35f2e232bb32f8e440
--
2.37.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [bug#57496] [PATCH v3 1/3] gnu: bootloader: Extend `<menu-entry>' for chain-loader.
2022-08-31 5:23 [bug#57496] [PATCH 0/2] Add support for chain-loader typ22
2022-08-31 19:52 ` Maxime Devos
2022-09-01 6:03 ` [bug#57496] [PATCH v2 1/2] gnu: bootloader: Extend `<menu-entry>' " typ22
@ 2022-09-04 14:04 ` typ22
2022-09-04 17:25 ` [bug#57496] [PATCH v4 " typ22
3 siblings, 0 replies; 6+ messages in thread
From: typ22 @ 2022-09-04 14:04 UTC (permalink / raw)
To: 57496; +Cc: julien, tiantian
From: tiantian <typ22@foxmail.com>
* gnu/bootloader.scm (<menu-entry>)[chain-loader]: New field.
(menu-entry->sexp, sexp->menu-entry): Support chain-loader.
* doc/guix.texi (Bootloader Configuration): Document it.
Co-Authored-By: Julien Lepiller <julien@lepiller.eu>
---
v2:
Correct the document and specify all fields of <menu-entry> in the pattern
of menu-entry->sexp.
Now still judge linux, multiboot-kernel and chain-loader. Because if don't
judge, the menu-entry that all of linux, linux-multiboot and chainloader
are #f will match the first one.
Then produce Error message:
guix system: error: #<unspecified>: invalid G-expression input
This error message does not help.
v3:
correct the document and delete an extra blank line.
all:
The documents are mainly corrected by Julien Lepiller.
Thank you here.
doc/guix.texi | 18 ++++++++++++++++++
gnu/bootloader.scm | 33 +++++++++++++++++++++++++++------
2 files changed, 45 insertions(+), 6 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 957b9a668e..cc64a7ed70 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -37536,6 +37536,24 @@ Bootloader Configuration
@dots{}))
@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
+@code{multiboot-kernel} fields are specified. The following is an
+example of chainloading a different GNU/Linux system.
+
+@lisp
+(bootloader
+ (bootloader-configuration
+ ;; @dots{}
+ (menu-entries
+ (list
+ (menu-entry
+ (label "GNU/Linux")
+ (device (uuid "1C31-A17C" 'fat))
+ (chain-loader "/EFI/GNULinux/grubx64.efi"))))))
+@end lisp
+
@end table
@end deftp
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index 77c05e8946..9e8b545d10 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -46,6 +46,7 @@ (define-module (gnu bootloader)
menu-entry-multiboot-kernel
menu-entry-multiboot-arguments
menu-entry-multiboot-modules
+ menu-entry-chain-loader
menu-entry->sexp
sexp->menu-entry
@@ -104,8 +105,10 @@ (define-record-type* <menu-entry>
(multiboot-arguments menu-entry-multiboot-arguments
(default '())) ; list of string-valued gexps
(multiboot-modules menu-entry-multiboot-modules
- (default '()))) ; list of multiboot commands, where
+ (default '())) ; list of multiboot commands, where
; a command is a list of <string>
+ (chain-loader menu-entry-chain-loader
+ (default #f))) ; string, path of efi file
(define (menu-entry->sexp entry)
"Return ENTRY serialized as an sexp."
@@ -117,8 +120,9 @@ (define (menu-entry->sexp entry)
`(label ,(file-system-label->string label)))
(_ device)))
(match entry
- (($ <menu-entry> label device mount-point linux linux-arguments initrd #f
- ())
+ (($ <menu-entry> label device mount-point
+ (? identity linux) linux-arguments initrd
+ #f () () #f)
`(menu-entry (version 0)
(label ,label)
(device ,(device->sexp device))
@@ -127,14 +131,22 @@ (define (menu-entry->sexp entry)
(linux-arguments ,linux-arguments)
(initrd ,initrd)))
(($ <menu-entry> label device mount-point #f () #f
- multiboot-kernel multiboot-arguments multiboot-modules)
+ (? identity multiboot-kernel) multiboot-arguments
+ multiboot-modules #f)
`(menu-entry (version 0)
(label ,label)
(device ,(device->sexp device))
(device-mount-point ,mount-point)
(multiboot-kernel ,multiboot-kernel)
(multiboot-arguments ,multiboot-arguments)
- (multiboot-modules ,multiboot-modules)))))
+ (multiboot-modules ,multiboot-modules)))
+ (($ <menu-entry> label device mount-point #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)))))
(define (sexp->menu-entry sexp)
"Turn SEXP, an sexp as returned by 'menu-entry->sexp', into a <menu-entry>
@@ -171,7 +183,16 @@ (define (sexp->menu-entry sexp)
(device-mount-point mount-point)
(multiboot-kernel multiboot-kernel)
(multiboot-arguments multiboot-arguments)
- (multiboot-modules multiboot-modules)))))
+ (multiboot-modules multiboot-modules)))
+ (('menu-entry ('version 0)
+ ('label label) ('device device)
+ ('device-mount-point mount-point)
+ ('chain-loader chain-loader) _ ...)
+ (menu-entry
+ (label label)
+ (device (sexp->device device))
+ (device-mount-point mount-point)
+ (chain-loader chain-loader)))))
\f
;;;
base-commit: 6beadc82df204f315d06ea35f2e232bb32f8e440
--
2.37.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [bug#57496] [PATCH v4 1/3] gnu: bootloader: Extend `<menu-entry>' for chain-loader.
2022-08-31 5:23 [bug#57496] [PATCH 0/2] Add support for chain-loader typ22
` (2 preceding siblings ...)
2022-09-04 14:04 ` [bug#57496] [PATCH v3 1/3] " typ22
@ 2022-09-04 17:25 ` typ22
3 siblings, 0 replies; 6+ messages in thread
From: typ22 @ 2022-09-04 17:25 UTC (permalink / raw)
To: 57496; +Cc: julien, tiantian
From: tiantian <typ22@foxmail.com>
* gnu/bootloader.scm (<menu-entry>)[chain-loader]: New field.
(menu-entry->sexp, sexp->menu-entry): Support chain-loader.
* doc/guix.texi (Bootloader Configuration): Document it.
Co-Authored-By: Julien Lepiller <julien@lepiller.eu>
---
v2:
Correct the document and specify all fields of <menu-entry> in the pattern
of menu-entry->sexp.
Now still judge linux, multiboot-kernel and chain-loader. Because if don't
judge, the menu-entry that all of linux, linux-multiboot and chainloader
are #f will match the first one.
Then produce Error message:
guix system: error: #<unspecified>: invalid G-expression input
This error message does not help.
v3:
correct the document and delete an extra blank line.
v4:
Add check for initrd in menu-entry->sexp, which is a change moved from the
third patch of v3.
all:
The documents are mainly corrected by Julien Lepiller.
Thank you here.
doc/guix.texi | 18 ++++++++++++++++++
gnu/bootloader.scm | 33 +++++++++++++++++++++++++++------
2 files changed, 45 insertions(+), 6 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 957b9a668e..cc64a7ed70 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -37536,6 +37536,24 @@ Bootloader Configuration
@dots{}))
@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
+@code{multiboot-kernel} fields are specified. The following is an
+example of chainloading a different GNU/Linux system.
+
+@lisp
+(bootloader
+ (bootloader-configuration
+ ;; @dots{}
+ (menu-entries
+ (list
+ (menu-entry
+ (label "GNU/Linux")
+ (device (uuid "1C31-A17C" 'fat))
+ (chain-loader "/EFI/GNULinux/grubx64.efi"))))))
+@end lisp
+
@end table
@end deftp
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index 77c05e8946..9fe6b65212 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -46,6 +46,7 @@ (define-module (gnu bootloader)
menu-entry-multiboot-kernel
menu-entry-multiboot-arguments
menu-entry-multiboot-modules
+ menu-entry-chain-loader
menu-entry->sexp
sexp->menu-entry
@@ -104,8 +105,10 @@ (define-record-type* <menu-entry>
(multiboot-arguments menu-entry-multiboot-arguments
(default '())) ; list of string-valued gexps
(multiboot-modules menu-entry-multiboot-modules
- (default '()))) ; list of multiboot commands, where
+ (default '())) ; list of multiboot commands, where
; a command is a list of <string>
+ (chain-loader menu-entry-chain-loader
+ (default #f))) ; string, path of efi file
(define (menu-entry->sexp entry)
"Return ENTRY serialized as an sexp."
@@ -117,8 +120,9 @@ (define (menu-entry->sexp entry)
`(label ,(file-system-label->string label)))
(_ device)))
(match entry
- (($ <menu-entry> label device mount-point linux linux-arguments initrd #f
- ())
+ (($ <menu-entry> label device mount-point
+ (? identity linux) linux-arguments (? identity initrd)
+ #f () () #f)
`(menu-entry (version 0)
(label ,label)
(device ,(device->sexp device))
@@ -127,14 +131,22 @@ (define (menu-entry->sexp entry)
(linux-arguments ,linux-arguments)
(initrd ,initrd)))
(($ <menu-entry> label device mount-point #f () #f
- multiboot-kernel multiboot-arguments multiboot-modules)
+ (? identity multiboot-kernel) multiboot-arguments
+ multiboot-modules #f)
`(menu-entry (version 0)
(label ,label)
(device ,(device->sexp device))
(device-mount-point ,mount-point)
(multiboot-kernel ,multiboot-kernel)
(multiboot-arguments ,multiboot-arguments)
- (multiboot-modules ,multiboot-modules)))))
+ (multiboot-modules ,multiboot-modules)))
+ (($ <menu-entry> label device mount-point #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)))))
(define (sexp->menu-entry sexp)
"Turn SEXP, an sexp as returned by 'menu-entry->sexp', into a <menu-entry>
@@ -171,7 +183,16 @@ (define (sexp->menu-entry sexp)
(device-mount-point mount-point)
(multiboot-kernel multiboot-kernel)
(multiboot-arguments multiboot-arguments)
- (multiboot-modules multiboot-modules)))))
+ (multiboot-modules multiboot-modules)))
+ (('menu-entry ('version 0)
+ ('label label) ('device device)
+ ('device-mount-point mount-point)
+ ('chain-loader chain-loader) _ ...)
+ (menu-entry
+ (label label)
+ (device (sexp->device device))
+ (device-mount-point mount-point)
+ (chain-loader chain-loader)))))
\f
;;;
base-commit: 6beadc82df204f315d06ea35f2e232bb32f8e440
--
2.37.2
^ permalink raw reply related [flat|nested] 6+ messages in thread