From: Jan Nieuwenhuizen <janneke@gnu.org>
To: Mathieu Othacehe <othacehe@gnu.org>
Cc: 41541@debbugs.gnu.org
Subject: bug#41541: merge wip-hurd-vm
Date: Tue, 02 Jun 2020 14:23:54 +0200 [thread overview]
Message-ID: <87mu5ly7tx.fsf@gnu.org> (raw)
In-Reply-To: <87r1uxwz5q.fsf@gnu.org> (Mathieu Othacehe's message of "Tue, 02 Jun 2020 12:16:33 +0200")
[-- Attachment #1: Type: text/plain, Size: 1352 bytes --]
Mathieu Othacehe writes:
Hi Mathieu,
> Having an RC argument passed directly by the bootloader seems like a
> good way to proceed for me. This is somehow remotely similar to what we
> are doing with the "initrd" on Linux (pointing to some piece of code
> that needs to be loaded before starting the init process).
>
> You would also need to store this RC argument in the <boot-parameters>
> record, by adding a new field or stuffing it in the "initrd"
> field. Then, we wouldn't need an extra service I guess.
Hmm...I don't understand...probably I'm missing something.
I was thinking to just extend boot-parameters with
--rc-file=%hurd-rc-script, and then add %hurd-rc-script to the SYSTEM
service...How would I get the RC script into SYSTEM without a service?
Anyway...see working prototype attached! To get rid of the extra sevice
that I added I'd need some help. Please feel free to just rework it if
you like!
> If we are going that way, the procedures in (gnu build hurd-boot) could
> be passed the "hurd" package to install, and we could maybe get rig of
> the "/hurd" symlink?
Hehe, that would be nice...but IME /hurd isn't easy to get rid of. The
Hurd code uses it "everywhere" and I seem to remember that a simple
substitute* on the Hurd archive was not enough...sadly I do not remember
the details, so maybe...
Greetings,
Janneke
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-services-Add-hurd-startup-service.patch --]
[-- Type: text/x-patch, Size: 8200 bytes --]
From e11e59cbcd9165e3b885c1019e19aaab471f5498 Mon Sep 17 00:00:00 2001
From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
Date: Thu, 30 Apr 2020 15:40:07 +0200
Subject: [PATCH] gnu: services: Add %hurd-startup-service.
This decouples startup of the Hurd from the "hurd" package, moving the RC
script into SYSTEM.
* gnu/packages/hurd.scm (hurd)[inputs]: Remove hurd-rc-script.
[arguments]: Do not substitute it. Update "runsystem.sh" to parse
kernel arguments and exec into --rc-file=RC-FILE.
(hurd-rc-script): Move to...
* gnu/services.scm (%hurd-rc-file): ...this new variable.
(bootable-kernel-arguments): Use it.
(%hurd-bare-metal-service): New variable.
* gnu/system.scm (hurd-default-essential-services): Use it.
---
gnu/packages/hurd.scm | 52 ++++++++++---------------------------------
gnu/services.scm | 40 +++++++++++++++++++++++++++++++++
gnu/system.scm | 21 ++++++++++-------
3 files changed, 65 insertions(+), 48 deletions(-)
diff --git a/gnu/packages/hurd.scm b/gnu/packages/hurd.scm
index 5de4acb1c5..542ca1e229 100644
--- a/gnu/packages/hurd.scm
+++ b/gnu/packages/hurd.scm
@@ -310,32 +310,6 @@ Hurd-minimal package which are needed for both glibc and GCC.")
(base32
"0p2vhnc18cnbmb39vq4m7hzv4mhnm2l0a2s7gx3ar277fwng3hys"))))
-(define (hurd-rc-script)
- "Return a script to be installed as /libexec/rc in the 'hurd' package. The
-script takes care of installing the relevant passive translators on the first
-boot, since this cannot be done from GNU/Linux. Then, it runs system
-activation; starting the Shepherd."
-
- (define rc
- (with-imported-modules '((guix build utils)
- (gnu build hurd-boot)
- (guix build syscalls))
- #~(begin
- (use-modules (guix build utils)
- (gnu build hurd-boot)
- (guix build syscalls)
- (ice-9 match)
- (system repl repl)
- (srfi srfi-1)
- (srfi srfi-26))
-
- (boot-hurd-system))))
-
- ;; FIXME: We want the program to use the cross-compiled Guile when
- ;; cross-compiling. But why do we need to be explicit here?
- (with-parameters ((%current-target-system "i586-pc-gnu"))
- (program-file "rc" rc)))
-
(define dde-sources
;; This is the current tip of the dde branch
(let ((commit "ac1c7eb7a8b24b7469bed5365be38a968d59a136"))
@@ -417,11 +391,19 @@ PATH=@PATH@
fsck --yes --force /
fsysopts / --writable
settrans -c /servers/socket/1 /hurd/pflocal
-echo Starting /libexec/rc ...
-exec /libexec/rc \"$@\"
-")))
- ))
+# parse multiboot arguments
+for i in \"$@\"; do
+ case $i in
+ (--rc-file=*)
+ rc=${i#--rc-file=}
+ ;;
+ esac
+done
+
+echo Starting ${rc}...
+exec ${rc} \"$@\"
+")))))
(add-before 'build 'set-file-names
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
@@ -483,15 +465,6 @@ exec /libexec/rc \"$@\"
(mkdir-p datadir)
(copy-file "unifont"
(string-append datadir "/vga-system.bdf"))
- #t)))
- (add-after 'install 'install-rc-file
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (file (string-append out "/libexec/rc"))
- (rc (assoc-ref inputs "hurd-rc"))
- (coreutils (assoc-ref inputs "coreutils")))
- (delete-file file)
- (copy-file rc file)
#t))))
#:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
%output "/lib")
@@ -506,7 +479,6 @@ exec /libexec/rc \"$@\"
(build-system gnu-build-system)
(inputs
`(("glibc-hurd-headers" ,glibc/hurd-headers)
- ("hurd-rc" ,(hurd-rc-script))
("libgcrypt" ,libgcrypt) ;for /hurd/random
("libdaemon" ,libdaemon) ;for /bin/console --daemonize
diff --git a/gnu/services.scm b/gnu/services.scm
index 4e0bbc0249..b21520eafc 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -94,6 +94,8 @@
activation-service-type
activation-service->script
%linux-bare-metal-service
+ %hurd-rc-script
+ %hurd-startup-service
special-files-service-type
extra-special-file
etc-service-type
@@ -630,6 +632,44 @@ ACTIVATION-SCRIPT-TYPE."
activation-service-type
%linux-kernel-activation))
+;; XXX this won't go into SYSTEM (as system-service); the result is fine
+;; though and it gets picked-up well by --rc-file=%hurd-rc-script
+(define %hurd-rc-script
+ ;; The RC script to be started upon boot.
+ (program-file "rc"
+ (with-imported-modules '((guix build utils)
+ (gnu build hurd-boot)
+ (guix build syscalls))
+ #~(begin
+ (use-modules (guix build utils)
+ (gnu build hurd-boot)
+ (guix build syscalls)
+ (ice-9 match)
+ (system repl repl)
+ (srfi srfi-1)
+ (srfi srfi-26))
+ (boot-hurd-system)))))
+
+(define (hurd-rc-entry mrc)
+ "Return, as a monadic value, an entry for the RC script in the system
+directory."
+ (mlet %store-monad ((rc mrc))
+ (return `(("rc" ,rc)))))
+
+(define hurd-startup-service-type
+ ;; The service that creates the initial RC startup file.
+ (service-type (name 'startup)
+ (extensions
+ (list (service-extension system-service-type hurd-rc-entry)))
+ (compose identity)
+ (extend (const (lower-object %hurd-rc-script)))
+ (description
+ "Produce the operating system's RC script, which is executed
+by RUNSYSTEM.")))
+
+(define %hurd-startup-service
+ ;; The service that produces the RC script.
+ (service hurd-startup-service-type #t))
(define special-files-service-type
;; Service to install "special files" such as /bin/sh and /usr/bin/env.
diff --git a/gnu/system.scm b/gnu/system.scm
index 41c551af0b..09ab574278 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -170,14 +170,18 @@
(define (bootable-kernel-arguments system root-device)
"Return a list of kernel arguments (gexps) to boot SYSTEM from ROOT-DEVICE."
- (list (string-append "--root="
- ;; Note: Always use the DCE format because that's what
- ;; (gnu build linux-boot) expects for the '--root'
- ;; kernel command-line option.
- (file-system-device->string root-device
- #:uuid-type 'dce))
- #~(string-append "--system=" #$system)
- #~(string-append "--load=" #$system "/boot")))
+ (append
+ (if (hurd-target?)
+ (list #~(string-append "--rc-file=" #$%hurd-rc-script))
+ '())
+ (list (string-append "--root="
+ ;; Note: Always use the DCE format because that's what
+ ;; (gnu build linux-boot) expects for the '--root'
+ ;; kernel command-line option.
+ (file-system-device->string root-device
+ #:uuid-type 'dce))
+ #~(string-append "--system=" #$system)
+ #~(string-append "--load=" #$system "/boot"))))
;; System-wide configuration.
;; TODO: Add per-field docstrings/stexi.
@@ -610,6 +614,7 @@ bookkeeping."
(define (hurd-default-essential-services os)
(list (service system-service-type '())
%boot-service
+ %hurd-startup-service
%activation-service
%shepherd-root-service
(service user-processes-service-type)
--
2.26.2
[-- Attachment #3: Type: text/plain, Size: 152 bytes --]
--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com
next prev parent reply other threads:[~2020-06-02 12:25 UTC|newest]
Thread overview: 36+ 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 [this message]
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-04 13:59 ` bug#41541: [PATCH 2/8] bootloader: Extend `<menu-entry>' for multiboot Jan (janneke) Nieuwenhuizen
2020-06-04 13:59 ` bug#41541: [PATCH 3/8] system: Add 'multiboot-modules' field to <boot-parameters> Jan (janneke) Nieuwenhuizen
2020-06-06 7:32 ` Mathieu Othacehe
2020-06-06 10:13 ` 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-04 13:59 ` bug#41541: [PATCH 5/8] system: Use 'hurd' package in label Jan (janneke) Nieuwenhuizen
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-04 13:59 ` bug#41541: [PATCH 7/8] services: hurd: Add `hurd-etc-service' Jan (janneke) 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
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=87mu5ly7tx.fsf@gnu.org \
--to=janneke@gnu.org \
--cc=41541@debbugs.gnu.org \
--cc=othacehe@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 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).