From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
To: 41541@debbugs.gnu.org
Subject: bug#41541: [PATCH 3/8] system: Add 'multiboot-modules' field to <boot-parameters>.
Date: Thu, 4 Jun 2020 15:59:09 +0200 [thread overview]
Message-ID: <20200604135914.4499-4-janneke@gnu.org> (raw)
In-Reply-To: <20200604135914.4499-1-janneke@gnu.org>
* gnu/system.scm (<boot-parameters>)[multiboot-modules]: New field.
(read-boot-parameters): Initialize it.
(operating-system-multiboot-modules, hurd-multiboot-modules): New procedure.
(operating-system-boot-parameters): Cater for multiboot the Hurd and
initialize it; avoid initrd in that case.
(operating-system-kernel-file): Cater for for Gnumach (the Hurd) besides Linux.
(boot-parameters->menu-entry): Use it to support a multiboot <menu-entry>.
---
gnu/system.scm | 92 +++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 73 insertions(+), 19 deletions(-)
diff --git a/gnu/system.scm b/gnu/system.scm
index 43dd2ec598..a96a6e6f2c 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -39,9 +39,11 @@
#:use-module (guix utils)
#:use-module (gnu packages base)
#:use-module (gnu packages bash)
+ #:use-module (gnu packages cross-base)
#:use-module (gnu packages guile)
#:use-module (gnu packages guile-xyz)
#:use-module (gnu packages admin)
+ #:use-module (gnu packages hurd)
#:use-module (gnu packages linux)
#:use-module (gnu packages pciutils)
#:use-module (gnu packages package-management)
@@ -142,6 +144,7 @@
boot-parameters-kernel
boot-parameters-kernel-arguments
boot-parameters-initrd
+ boot-parameters-multiboot-modules
read-boot-parameters
read-boot-parameters-file
boot-parameters->menu-entry
@@ -283,7 +286,8 @@ directly by the user."
(store-mount-point boot-parameters-store-mount-point)
(kernel boot-parameters-kernel)
(kernel-arguments boot-parameters-kernel-arguments)
- (initrd boot-parameters-initrd))
+ (initrd boot-parameters-initrd)
+ (multiboot-modules boot-parameters-multiboot-modules))
(define (ensure-not-/dev device)
"If DEVICE starts with a slash, return #f. This is meant to filter out
@@ -314,7 +318,7 @@ file system labels."
(match (read port)
(('boot-parameters ('version 0)
('label label) ('root-device root)
- ('kernel linux)
+ ('kernel kernel)
rest ...)
(boot-parameters
(label label)
@@ -330,12 +334,12 @@ file system labels."
((_ entries) (map sexp->menu-entry entries))
(#f '())))
- ;; In the past, we would store the directory name of the kernel instead
- ;; of the absolute file name of its image. Detect that and correct it.
- (kernel (if (string=? linux (direct-store-path linux))
- (string-append linux "/"
+ ;; In the past, we would store the directory name of linux instead of
+ ;; the absolute file name of its image. Detect that and correct it.
+ (kernel (if (string=? kernel (direct-store-path kernel))
+ (string-append kernel "/"
(system-linux-image-file-name))
- linux))
+ kernel))
(kernel-arguments
(match (assq 'kernel-arguments rest)
@@ -349,6 +353,8 @@ file system labels."
(('initrd (? string? file))
file)))
+ (multiboot-modules (or (assq 'multiboot-modules rest) '()))
+
(store-device
;; Linux device names like "/dev/sda1" are not suitable GRUB device
;; identifiers, so we just filter them out.
@@ -386,14 +392,25 @@ The object has its kernel-arguments extended in order to make it bootable."
(boot-parameters-kernel-arguments params))))))
(define (boot-parameters->menu-entry conf)
- (menu-entry
- (label (boot-parameters-label conf))
- (device (boot-parameters-store-device conf))
- (device-mount-point (boot-parameters-store-mount-point conf))
- (linux (boot-parameters-kernel conf))
- (linux-arguments (boot-parameters-kernel-arguments conf))
- (initrd (boot-parameters-initrd conf))))
-
+ (let* ((kernel (boot-parameters-kernel conf))
+ (multiboot-modules (boot-parameters-multiboot-modules conf))
+ (multiboot? (pair? multiboot-modules)))
+ (menu-entry
+ (label (boot-parameters-label conf))
+ (device (boot-parameters-store-device conf))
+ (device-mount-point (boot-parameters-store-mount-point conf))
+ (linux (and (not multiboot?) kernel))
+ (linux-arguments (if (not multiboot?) '
+ (boot-parameters-kernel-arguments conf)
+ '()))
+ (initrd (boot-parameters-initrd conf))
+ (multiboot-kernel (and multiboot? kernel))
+ (multiboot-arguments (if multiboot?
+ (boot-parameters-kernel-arguments conf)
+ '()))
+ (multiboot-modules (if multiboot?
+ (boot-parameters-multiboot-modules conf)
+ '())))))
\f
;;;
@@ -485,8 +502,17 @@ from the initrd."
(define (operating-system-kernel-file os)
"Return an object representing the absolute file name of the kernel image of
OS."
- (file-append (operating-system-kernel os)
- "/" (system-linux-image-file-name)))
+ (if (operating-system-hurd os)
+ (let* ((mach (operating-system-kernel os))
+ (mach (if (%current-target-system)
+ ;; A cross-built GNUmach does not work
+ (with-parameters ((%current-system "i686-linux")
+ (%current-target-system #f))
+ mach)
+ mach)))
+ (file-append mach "/boot/gnumach"))
+ (file-append (operating-system-kernel os)
+ "/" (system-linux-image-file-name))))
(define (package-for-kernel target-kernel module-package)
"Return a package like MODULE-PACKAGE, adapted for TARGET-KERNEL, if
@@ -1131,17 +1157,44 @@ a list of <menu-entry>, to populate the \"old entries\" menu."
#:store-directory-prefix
(btrfs-store-subvolume-file-name file-systems))))
+(define (operating-system-multiboot-modules os)
+ (if (operating-system-hurd os) (hurd-multiboot-modules os) '()))
+
+(define (hurd-multiboot-modules os)
+ (let* ((hurd (operating-system-hurd os))
+ (root-file-system-command
+ (list (file-append hurd "/hurd/ext2fs.static")
+ "ext2fs"
+ "--multiboot-command-line='${kernel-command-line}'"
+ "--host-priv-port='${host-port}'"
+ "--device-master-port='${device-port}'"
+ "--exec-server-task='${exec-task}'"
+ "--store-type=typed"
+ "--x-xattr-translator-records"
+ "'${root}'" "'$(task-create)'" "'$(task-resume)'"))
+ (target (%current-target-system))
+ (libc (if target
+ (with-parameters ((%current-target-system #f))
+ (cross-libc target))
+ glibc))
+ (exec-server-command
+ (list (file-append libc "/lib/ld.so.1") "exec"
+ (file-append hurd "/hurd/exec") "'$(exec-task=task-create)'")))
+ (list root-file-system-command exec-server-command)))
+
(define* (operating-system-boot-parameters os root-device
#:key system-kernel-arguments?)
"Return a monadic <boot-parameters> record that describes the boot
parameters of OS. When SYSTEM-KERNEL-ARGUMENTS? is true, add kernel arguments
such as '--root' and '--load' to <boot-parameters>."
- (let* ((initrd (operating-system-initrd-file os))
+ (let* ((initrd (and (not (hurd-target?))
+ (operating-system-initrd-file os)))
(store (operating-system-store-file-system os))
(bootloader (bootloader-configuration-bootloader
(operating-system-bootloader os)))
(bootloader-name (bootloader-name bootloader))
- (label (operating-system-label os)))
+ (label (operating-system-label os))
+ (multiboot-modules (operating-system-multiboot-modules os)))
(boot-parameters
(label label)
(root-device root-device)
@@ -1151,6 +1204,7 @@ such as '--root' and '--load' to <boot-parameters>."
(operating-system-kernel-arguments os root-device)
(operating-system-user-kernel-arguments os)))
(initrd initrd)
+ (multiboot-modules multiboot-modules)
(bootloader-name bootloader-name)
(bootloader-menu-entries
(bootloader-configuration-menu-entries (operating-system-bootloader os)))
--
2.26.2
next prev parent reply other threads:[~2020-06-04 14:00 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-26 14:21 bug#41541: merge wip-hurd-vm Jan Nieuwenhuizen
2020-05-27 10:01 ` Mathieu Othacehe
2020-05-27 11:11 ` Jan Nieuwenhuizen
2020-05-30 14:40 ` Jan Nieuwenhuizen
2020-06-02 8:48 ` Mathieu Othacehe
2020-06-02 9:24 ` Jan Nieuwenhuizen
2020-06-02 10:16 ` Mathieu Othacehe
2020-06-02 12:23 ` Jan Nieuwenhuizen
2020-06-02 12:40 ` Ludovic Courtès
2020-06-02 13:39 ` Jan Nieuwenhuizen
2020-06-03 9:18 ` Ludovic Courtès
2020-06-03 15:22 ` Jan Nieuwenhuizen
2020-06-03 15:38 ` Mathieu Othacehe
2020-06-03 20:27 ` Jan Nieuwenhuizen
2020-06-04 9:32 ` Ludovic Courtès
2020-06-04 11:33 ` Jan Nieuwenhuizen
2020-06-05 16:08 ` Ludovic Courtès
2020-06-05 16:24 ` Jan Nieuwenhuizen
2020-06-04 13:59 ` bug#41541: [PATCH 0/9] Merge wip-hurd-vm "last review round" Jan (janneke) Nieuwenhuizen
2020-06-04 13:59 ` bug#41541: [PATCH 1/8] system: Add 'hurd' field to <operating-system> Jan (janneke) Nieuwenhuizen
2020-06-06 7:21 ` Mathieu Othacehe
2020-06-06 8:26 ` Jan Nieuwenhuizen
2020-06-06 10:45 ` [bug#41541] " Ludovic Courtès
2020-06-06 11:14 ` Jan Nieuwenhuizen
2020-06-04 13:59 ` bug#41541: [PATCH 2/8] bootloader: Extend `<menu-entry>' for multiboot Jan (janneke) Nieuwenhuizen
2020-06-06 10:48 ` [bug#41541] " Ludovic Courtès
2020-06-06 12:00 ` Jan Nieuwenhuizen
2020-06-04 13:59 ` Jan (janneke) Nieuwenhuizen [this message]
2020-06-06 7:32 ` bug#41541: [PATCH 3/8] system: Add 'multiboot-modules' field to <boot-parameters> Mathieu Othacehe
2020-06-06 10:13 ` Jan Nieuwenhuizen
2020-06-06 10:55 ` [bug#41541] " Ludovic Courtès
2020-06-07 7:39 ` Jan Nieuwenhuizen
2020-06-04 13:59 ` bug#41541: [PATCH 4/8] bootloader: grub: Add support for multiboot Jan (janneke) Nieuwenhuizen
2020-06-06 7:47 ` Mathieu Othacehe
2020-06-06 8:46 ` Jan Nieuwenhuizen
2020-06-06 10:57 ` [bug#41541] " Ludovic Courtès
2020-06-06 12:08 ` Jan Nieuwenhuizen
2020-06-04 13:59 ` bug#41541: [PATCH 5/8] system: Use 'hurd' package in label Jan (janneke) Nieuwenhuizen
2020-06-06 10:57 ` [bug#41541] " Ludovic Courtès
2020-06-04 13:59 ` bug#41541: [PATCH 6/8] system: examples: Add bare-hurd.tmpl Jan (janneke) Nieuwenhuizen
2020-06-06 7:56 ` Mathieu Othacehe
2020-06-06 10:58 ` [bug#41541] " Jan Nieuwenhuizen
2020-06-06 16:49 ` Mathieu Othacehe
2020-06-06 22:44 ` Jan Nieuwenhuizen
2020-06-06 10:59 ` Ludovic Courtès
2020-06-06 12:34 ` Jan Nieuwenhuizen
2020-06-04 13:59 ` bug#41541: [PATCH 7/8] services: hurd: Add `hurd-etc-service' Jan (janneke) Nieuwenhuizen
2020-06-06 11:08 ` [bug#41541] " Ludovic Courtès
2020-06-06 14:31 ` Jan Nieuwenhuizen
2020-06-07 20:02 ` Ludovic Courtès
2020-06-07 20:31 ` Jan Nieuwenhuizen
2020-06-04 13:59 ` bug#41541: [PATCH 8/8] system: Add `hurd-activation' Jan (janneke) Nieuwenhuizen
2020-06-06 8:03 ` Mathieu Othacehe
2020-06-06 8:54 ` Jan Nieuwenhuizen
2020-06-06 11:05 ` [bug#41541] " Ludovic Courtès
2020-06-06 14:21 ` Jan Nieuwenhuizen
2020-06-08 12:57 ` [bug#41541] [PATCH 0/4] Final wip-hurd-vm batch Jan (janneke) Nieuwenhuizen
2020-06-08 12:57 ` [bug#41541] [PATCH 1/4] hurd-boot: Create individual translators instead of running MAKEDEV Jan (janneke) Nieuwenhuizen
2020-06-08 12:58 ` [bug#41541] [PATCH 2/4] system: hurd: Remove 'cross-hurd-image' hack Jan (janneke) Nieuwenhuizen
2020-06-13 10:49 ` Jan Nieuwenhuizen
2020-06-14 16:46 ` bug#41541: " Jan Nieuwenhuizen
2020-06-14 17:48 ` [bug#41541] " Mathieu Othacehe
2020-06-14 20:29 ` Ludovic Courtès
2020-06-08 12:58 ` [bug#41541] [PATCH 3/4] system: bare-hurd.tmpl: Add openssh client and service Jan (janneke) Nieuwenhuizen
2020-06-08 13:23 ` Jan Nieuwenhuizen
2020-06-13 7:24 ` Jan Nieuwenhuizen
2020-06-08 12:58 ` [bug#41541] [PATCH 4/4] hurd-boot: Use 'setxattr' instead of invoking settrans Jan (janneke) Nieuwenhuizen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200604135914.4499-4-janneke@gnu.org \
--to=janneke@gnu.org \
--cc=41541@debbugs.gnu.org \
/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 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.