From: typ22@foxmail.com
To: 57496@debbugs.gnu.org
Cc: julien@lepiller.eu, tiantian <typ22@foxmail.com>
Subject: [bug#57496] [PATCH v3 2/3] gnu: bootloader: grub: Add support for chain-loader.
Date: Sun, 4 Sep 2022 22:04:28 +0800 [thread overview]
Message-ID: <tencent_43339AC453609C58C41910D4CC3FE408B90A@qq.com> (raw)
In-Reply-To: <849b9ddea2a18dc4b2fd05450f0c90e3e5a05421.1662298270.git.typ22@foxmail.com>
From: tiantian <typ22@foxmail.com>
* gnu/bootloader/grub.scm (grub-configuration-file): Add support for
chain-loader.
---
It is no different from v2 patch.
gnu/bootloader/grub.scm | 73 ++++++++++++++++++++++++-----------------
1 file changed, 43 insertions(+), 30 deletions(-)
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index 4f18c9b518..7283257354 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -374,44 +374,57 @@ (define* (grub-configuration-file config entries
(let ((label (menu-entry-label entry))
(linux (menu-entry-linux entry))
(device (menu-entry-device entry))
- (device-mount-point (menu-entry-device-mount-point entry)))
- (if linux
- (let ((arguments (menu-entry-linux-arguments entry))
- (linux (normalize-file linux
- device-mount-point
- store-directory-prefix))
- (initrd (normalize-file (menu-entry-initrd entry)
- device-mount-point
- store-directory-prefix)))
- ;; Here DEVICE is the store and DEVICE-MOUNT-POINT is its mount point.
- ;; Use the right file names for LINUX and INITRD in case
- ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a
- ;; separate partition.
-
- ;; When BTRFS-SUBVOLUME-FILE-NAME is defined, prepend it the linux and
- ;; initrd paths, to allow booting from a Btrfs subvolume.
- #~(format port "menuentry ~s {
+ (device-mount-point (menu-entry-device-mount-point entry))
+ (multiboot-kernel (menu-entry-multiboot-kernel entry))
+ (chain-loader (menu-entry-chain-loader entry)))
+ (cond
+ (linux
+ (let ((arguments (menu-entry-linux-arguments entry))
+ (linux (normalize-file linux
+ device-mount-point
+ store-directory-prefix))
+ (initrd (normalize-file (menu-entry-initrd entry)
+ device-mount-point
+ store-directory-prefix)))
+ ;; Here DEVICE is the store and DEVICE-MOUNT-POINT is its mount point.
+ ;; Use the right file names for LINUX and INITRD in case
+ ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a
+ ;; separate partition.
+
+ ;; When BTRFS-SUBVOLUME-FILE-NAME is defined, prepend it the linux and
+ ;; initrd paths, to allow booting from a Btrfs subvolume.
+ #~(format port "menuentry ~s {
~a
linux ~a ~a
initrd ~a
}~%"
- #$label
- #$(grub-root-search device linux)
- #$linux (string-join (list #$@arguments))
- #$initrd))
- (let ((kernel (menu-entry-multiboot-kernel entry))
- (arguments (menu-entry-multiboot-arguments entry))
- (modules (menu-entry-multiboot-modules entry))
- (root-index 1)) ; XXX EFI will need root-index 2
- #~(format port "
+ #$label
+ #$(grub-root-search device linux)
+ #$linux (string-join (list #$@arguments))
+ #$initrd)))
+ (multiboot-kernel
+ (let ((kernel (menu-entry-multiboot-kernel entry))
+ (arguments (menu-entry-multiboot-arguments entry))
+ (modules (menu-entry-multiboot-modules entry))
+ (root-index 1)) ; XXX EFI will need root-index 2
+ #~(format port "
menuentry ~s {
multiboot ~a root=device:hd0s~a~a~a
+}~%"
+ #$label
+ #$kernel
+ #$root-index (string-join (list #$@arguments) " " 'prefix)
+ (string-join (map string-join '#$modules)
+ "\n module " 'prefix))))
+ (chain-loader
+ #~(format port "
+menuentry ~s {
+ ~a
+ chainloader ~a
}~%"
#$label
- #$kernel
- #$root-index (string-join (list #$@arguments) " " 'prefix)
- (string-join (map string-join '#$modules)
- "\n module " 'prefix))))))
+ #$(grub-root-search device chain-loader)
+ #$chain-loader)))))
(define (crypto-devices)
(define (crypto-device->cryptomount dev)
--
2.37.2
next parent reply other threads:[~2022-09-04 14:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <849b9ddea2a18dc4b2fd05450f0c90e3e5a05421.1662298270.git.typ22@foxmail.com>
2022-09-04 14:04 ` typ22 [this message]
2022-09-04 14:04 ` [bug#57496] [PATCH v3 3/3] gnu: bootloader: Add a friendly error message of menu-entry typ22
2022-09-04 15:37 ` Julien Lepiller
[not found] ` <7x7d2jt5z0.fsf@foxmail.com>
2022-09-04 16:15 ` tiantian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tencent_43339AC453609C58C41910D4CC3FE408B90A@qq.com \
--to=typ22@foxmail.com \
--cc=57496@debbugs.gnu.org \
--cc=julien@lepiller.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).