guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

24/24: system: hurd: Remove bash from boot process.


From: guix-commits
Subject: 24/24: system: hurd: Remove bash from boot process.
Date: Sun, 17 May 2020 06:00:56 -0400 (EDT)

janneke pushed a commit to branch wip-hurd-vm
in repository guix.

commit e4e1876c678c129e04f56f40d59c08e406bc8541
Author: Jan (janneke) Nieuwenhuizen <address@hidden>
AuthorDate: Sun May 10 20:34:39 2020 +0200

    system: hurd: Remove bash from boot process.
    
    Guile needs pipe support for its finalizer thread, to start.  Previously
    a Bash script was used to do so, only to run
    
        settrans -c /servers/socket/1 /hurd/plfocal
    
    This translator can also be stored in the file system, however.
    
    If the Hurd is booted using the "--x-xattr-translator-records" option it 
will
    use translators stored using the xattr extension for the Hurd, as
    "gnu.translator" attributes.  Translators can then also be created by using
    the generic `setfattr' tool, like so
    
        touch /servers/socket/1
        setfattr --name=gnu.translator --value='"/hurd/pflocal\0"' 
/servers/socket/1
    
    Although Linux has already reserved an xattr index for the Hurd, it still
    needs a patch like this
    
        274a93a904 gnu: linux-libre: Add support for gnu.* namespace.
    
    one provided to support setting "gnu.translator" extended attributes.  The
    Hurd needs only a trivial patch (already upstream)
    
        a3f5850bd3 gnu: hurd: Update to upstream Hurd-reserved xattr index.
    
    See also
    
        https://lists.gnu.org/archive/html/bug-hurd/2020-05/msg00016.html
        
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3980bd3b406addb327d858aebd19e229ea340b9a
        https://lists.gnu.org/archive/html/bug-hurd/2016-08/msg00075.html
    
    * gnu/bootloader/grub.scm (grub-configuration-file): Use
    -x-xattr-translator-records when booting the Hurd.
    * gnu/build/linux-boot.scm (make-hurd-device-nodes): Use setxattr to add
    pflocal translator.
    * gnu/packages/hurd.scm (hurd): Remove runsystem.sh from boot proces, boot
    straight into `RC".
---
 gnu/bootloader/grub.scm  |  1 +
 gnu/build/linux-boot.scm |  9 ++++++---
 gnu/packages/hurd.scm    | 33 +++------------------------------
 gnu/system/vm.scm        |  2 +-
 4 files changed, 11 insertions(+), 34 deletions(-)

diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index 894e0dc..c3eb3e6 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -381,6 +381,7 @@ menuentry ~s {
     --device-master-port='${device-port}' \\
     --exec-server-task='${exec-task}' \\
     --store-type=typed \\
+    --x-xattr-translator-records \\
     '${root}' '$(task-create)' '$(task-resume)'
   module ~a/lib/ld.so.1 exec ~a/hurd/exec '$(exec-task=task-create)'
 }~%"
diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm
index c6f9df5..d47d1a2 100644
--- a/gnu/build/linux-boot.scm
+++ b/gnu/build/linux-boot.scm
@@ -348,10 +348,13 @@ one specific hardware device. These we have to create."
 
   (mkdir (scope "servers"))
   (mkdir (scope "servers/socket"))
-  ;; Don't create /servers/socket/1 & co: runsystem does that on first boot.
 
-  ;; TODO: Set the 'gnu.translator' extended attribute for passive translator
-  ;; settings?
+  ;; Guile's finalizer thread needs pipe support
+  (with-output-to-file (scope "servers/socket/1")
+    (lambda _ (display "")))
+
+  (setxattr (scope "servers/socket/1") "gnu.translator" "/hurd/pflocal\0")
+  ;; Don't create other /servers/socket/; RC does that upon boot
   )
 
 (define %host-qemu-ipv4-address
diff --git a/gnu/packages/hurd.scm b/gnu/packages/hurd.scm
index 9f3e945..d8b12fc 100644
--- a/gnu/packages/hurd.scm
+++ b/gnu/packages/hurd.scm
@@ -33,6 +33,7 @@
   #:use-module (guix build-system trivial)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages attr)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages gawk)
   #:use-module (gnu packages gnupg)
@@ -318,7 +319,6 @@ boot, since this cannot be done from GNU/Linux."
       ("/servers/crash-kill" ("/hurd/crash" "--kill"))
       ("/servers/crash-suspend" ("/hurd/crash" "--suspend"))
       ("/servers/password" ("/hurd/password"))
-      ("/servers/socket/1" ("/hurd/pflocal"))
       ("/servers/socket/2" ("/hurd/pfinet" "--interface" "eth0"
                             "--address" "10.0.2.15" ;the default QEMU guest IP
                             "--netmask" "255.255.255.0"
@@ -346,11 +346,6 @@ boot, since this cannot be done from GNU/Linux."
           (unless (zero? (system* "fsysopts" "/" "--update" "--writable"))
             (format #t "FAILED...Good luck!\n"))
 
-          (format #t "settrans pflocal...\n")
-          (mkdir-p "/servers/socket")
-          (unless (zero? (system* "settrans" "-c" "/servers/socket/1" 
"/hurd/pflocal"))
-            (format #t "FAILED...Good luck!\n"))
-
           (for-each (match-lambda
                       ((node command)
                        (unless (translated? node)
@@ -364,7 +359,6 @@ boot, since this cannot be done from GNU/Linux."
             (invoke "MAKEDEV" "--devdir=/dev" "vcs")
             (invoke "MAKEDEV" "--devdir=/dev" "tty1""tty2" "tty3" "tty4" 
"tty5" "tty6")
             (invoke "MAKEDEV" "--devdir=/dev" "ptyp0" "ptyp1" "ptyp2")
-            (invoke "MAKEDEV" "--devdir=/dev" "std")
             (invoke "MAKEDEV" "--devdir=/dev" "console"))
 
           ;; Setting current system
@@ -479,26 +473,6 @@ boot, since this cannot be done from GNU/Linux."
              (substitute* '("daemons/Makefile" "utils/Makefile")
                (("-o root -m 4755") ""))
              #t))
-         (add-after 'unpack 'create-runsystem
-           (lambda _
-             ;; XXX Work towards having startup.c invoke the Guile rc
-             (delete-file "daemons/runsystem.sh")
-             (with-output-to-file "daemons/runsystem.sh"
-               (lambda _
-                 (display "#! /bin/bash
-
-# XXX Guile needs pipe support for its finalizer thread, to start.
-# Remove this script when Linux and the Hurd have xattr patches.
-PATH=@PATH@
-
-fsck --yes --force /
-fsysopts / --writable
-settrans -c /servers/socket/1 /hurd/pflocal
-echo Starting /libexec/rc ...
-exec /libexec/rc
-")))
-             ))
-
          (add-before 'build 'set-file-names
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((out  (assoc-ref outputs "out"))
@@ -519,8 +493,7 @@ exec /libexec/rc
                (substitute* "daemons/console-run.c"
                  (("/hurd/")
                   (string-append out "/hurd/")))
-               (substitute* '("daemons/runsystem.sh"
-                              "sutils/MAKEDEV.sh")
+               (substitute* "sutils/MAKEDEV.sh"
                  (("^PATH=.*")
                   (string-append "PATH=" out "/bin"
                                  ":" out "/sbin"
@@ -564,7 +537,7 @@ exec /libexec/rc
          (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"))
+                    (file (string-append out "/libexec/runsystem"))
                     (rc   (assoc-ref inputs "hurd-rc"))
                     (coreutils (assoc-ref inputs "coreutils")))
                (delete-file file)
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 4c41011..9bdc39d 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -292,7 +292,7 @@ substitutable."
                      (disk-image-format "qcow2")
                      (file-system-type (if (hurd-target?) "ext2" "ext4"))
                      (file-system-options
-                      (if (hurd-target?) '("-o" "hurd") '()))
+                      (if (hurd-target?) '("-o" "hurd" "-O" "ext_attr") '()))
                      (device-nodes (if (hurd-target?) 'hurd 'linux))
                      (extra-directives '())
                      file-system-label



reply via email to

[Prev in Thread] Current Thread [Next in Thread]