summaryrefslogtreecommitdiff
path: root/gnu/build
diff options
context:
space:
mode:
authorJanneke Nieuwenhuizen <janneke@gnu.org>2026-05-14 10:34:41 +0200
committerJanneke Nieuwenhuizen <janneke@gnu.org>2026-05-19 18:34:56 +0200
commitc62a39174e2cdc5d4efaa9c4940ea010d6dba184 (patch)
treef1efbeb791d7cfe6251a57cea07345fc6ff5c876 /gnu/build
parentb8f6ad67504ccb29effab431778e592c81632f11 (diff)
system: hurd-boot: Prepare for runsystem in Guile.
Fo guile to run, it needs pipe support: without pipe support it aborts at startup. Pipe support is currently createn in runsystem by creating a passive translator settrans --create /servers/socket/1 /hurd/pflocal However, this needs a writable root file-system, and runsystem is started with a readonly root file-system. This patch enables running guile early in runsystem, and thus prepares for replacing the runsystem shell script with a guile program, by embedding the servers/socket/1 passive translator into the hurd system image using xattr. * gnu/build/hurd-boot.scm (make-hurd-device-nodes): Change optional root parameter to keyword #:root. Add #:hurd keyword parameter. Use it to create servers/socket/1 (pipe) and proc passive xattr translators. * gnu/build/image.scm (initialize-root-partition): Update caller. * gnu/system/image.scm (with-imported-modules*): Include (ice-9 optargs). * gnu/system/images/hurd.scm (hurd-initialize-root-partition): Use it to update caller. * guix/scripts/system.scm (install): Update caller. Change-Id: Ib3a672ae78bd969a2a4c0e33db8e38ccf71238ba Merges: #8609
Diffstat (limited to 'gnu/build')
-rw-r--r--gnu/build/hurd-boot.scm42
-rw-r--r--gnu/build/image.scm2
2 files changed, 36 insertions, 8 deletions
diff --git a/gnu/build/hurd-boot.scm b/gnu/build/hurd-boot.scm
index ce198cce961..578378bb208 100644
--- a/gnu/build/hurd-boot.scm
+++ b/gnu/build/hurd-boot.scm
@@ -74,10 +74,18 @@ Return the value associated with OPTION, or #f on failure."
74 (loop (absolute target) (+ depth 1)) 74 (loop (absolute target) (+ depth 1))
75 file)))))) 75 file))))))
76 76
77(define* (make-hurd-device-nodes #:optional (root "/")) 77(define* (make-hurd-device-nodes #:key (root "/") (hurd "/hurd"))
78 "Make some of the nodes needed on GNU/Hurd." 78 "Make some of the nodes needed on GNU/Hurd."
79 (define (scope dir) 79 (define (scope dir)
80 (string-append root (if (string-suffix? "/" root) "" "/") dir)) 80 (in-vicinity root dir))
81
82 (define scope-set-translator
83 (match-lambda
84 ((file-name command)
85 (scope-set-translator (list file-name command #o600)))
86 ((file-name command mode)
87 (let ((mount-point (scope file-name)))
88 (set-translator mount-point command mode)))))
81 89
82 (mkdir-p (scope "dev")) 90 (mkdir-p (scope "dev"))
83 ;; XXX: We must have `/dev/console` otherwise `console-run` tries to 91 ;; XXX: We must have `/dev/console` otherwise `console-run` tries to
@@ -114,12 +122,32 @@ Return the value associated with OPTION, or #f on failure."
114 "suspend")) 122 "suspend"))
115 123
116 (mkdir-p (scope "servers/socket")) 124 (mkdir-p (scope "servers/socket"))
125 (mkdir-p (scope "servers/bus/pci"))
117 126
118 ;; Don't create /servers/socket/1 & co: runsystem does that on first boot. 127 ;; Set the 'gnu.translator' extended attribute for passive translator
128 ;; settings for pipes (servers/socet/1) and mount information (proc/mounts).
129 ;; Pipes are needed for guile-3.0.11 to startup, this enables moving
130 ;; "runsystem" to guile.
131 ;; XXX TODO: Set more passive xattr translators?
132 (define servers
133 `(
134 ;; ("servers/bus/pci" ("/hurd/pci-arbiter"))
135 ;; ("servers/crash-dump-core" ("/hurd/crash" "--dump-core"))
136 ;; ("servers/crash-kill" ("/hurd/crash" "--kill"))
137 ;; ("servers/crash-suspend" ("/hurd/crash" "--suspend"))
138 ;; ("servers/password" ("/hurd/password"))
139 ;; PIPE -- for running runsystem as Guile
140 ("servers/socket/1" (,(in-vicinity hurd "pflocal")))
141 ;; /servers/socket/2 and /26 are created by 'static-networking-service'.
142 ;; XXX: Spawn pfinet without arguments on these nodes so that a DHCP
143 ;; client has someone to talk to?
144 ("proc" (,(in-vicinity hurd "procfs") "--stat-mode=444"))))
119 145
120 ;; TODO: Set the 'gnu.translator' extended attribute for passive translator 146 (for-each scope-set-translator servers)
121 ;; settings? 147
122 (mkdir-p (scope "servers/bus/pci"))) 148 (define devices
149 '())
150 (for-each scope-set-translator devices))
123 151
124(define (passive-translator-xattr? file-name) 152(define (passive-translator-xattr? file-name)
125 "Return true if FILE-NAME has an extended @code{gnu.translator} attribute 153 "Return true if FILE-NAME has an extended @code{gnu.translator} attribute
@@ -190,7 +218,7 @@ needed."
190 "Make some of the device nodes needed on GNU/Hurd." 218 "Make some of the device nodes needed on GNU/Hurd."
191 219
192 (define (scope dir) 220 (define (scope dir)
193 (string-append root (if (string-suffix? "/" root) "" "/") dir)) 221 (in-vicinity root dir))
194 222
195 (define scope-set-translator 223 (define scope-set-translator
196 (match-lambda 224 (match-lambda
diff --git a/gnu/build/image.scm b/gnu/build/image.scm
index dbb87103daf..820dfe202fb 100644
--- a/gnu/build/image.scm
+++ b/gnu/build/image.scm
@@ -322,7 +322,7 @@ register-closure."
322 322
323 ;; Populate /dev. 323 ;; Populate /dev.
324 (when make-device-nodes 324 (when make-device-nodes
325 (make-device-nodes root)) 325 (make-device-nodes #:root root))
326 326
327 (when register-closures? 327 (when register-closures?
328 (unless copy-closures? 328 (unless copy-closures?