summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-04-09 17:50:37 +0200
committerLudovic Courtès <ludo@gnu.org>2014-04-09 17:50:37 +0200
commit289773c1d852a716d44aecbc03316f0c119387a8 (patch)
treeb0a5117e9d14be5e880f857de8c64bf13b608228
parentd69b35ee70543a98d1ce7c79e1ab970eb0eca5d2 (diff)
downloadguix-289773c1d852a716d44aecbc03316f0c119387a8.tar.gz
gnu: linux-initrd: Better populate /dev.
* guix/build/linux-initrd.scm (make-essential-device-nodes): Make
  /dev/{ptmx,tty} world-writable.  Build additional character devices.
-rw-r--r--guix/build/linux-initrd.scm23
1 files changed, 18 insertions, 5 deletions
diff --git a/guix/build/linux-initrd.scm b/guix/build/linux-initrd.scm
index 9a8ea0ed4f..d0e1cfc825 100644
--- a/guix/build/linux-initrd.scm
+++ b/guix/build/linux-initrd.scm
@@ -107,6 +107,7 @@
   ;; TTYs.
   (mknod (scope "dev/tty") 'char-special #o600
          (device-number 5 0))
+  (chmod (scope "dev/tty") #o666)
   (let loop ((n 0))
     (and (< n 50)
          (let ((name (format #f "dev/tty~a" n)))
@@ -117,6 +118,7 @@
   ;; Pseudo ttys.
   (mknod (scope "dev/ptmx") 'char-special #o666
          (device-number 5 2))
+  (chmod (scope "dev/ptmx") #o666)
 
   (unless (file-exists? (scope "dev/pts"))
     (mkdir (scope "dev/pts")))
@@ -126,11 +128,22 @@
   (mknod (scope "dev/log") 'socket #o666 0)
   (mknod (scope "dev/kmsg") 'char-special #o600 (device-number 1 11))
 
-  ;; Other useful nodes.
-  (mknod (scope "dev/null") 'char-special #o666 (device-number 1 3))
-  (mknod (scope "dev/zero") 'char-special #o666 (device-number 1 5))
-  (chmod (scope "dev/null") #o666)
-  (chmod (scope "dev/zero") #o666))
+  ;; Other useful nodes, notably relied on by guix-daemon.
+  (for-each (match-lambda
+             ((file major minor)
+              (mknod (scope file) 'char-special #o666
+                     (device-number major minor))
+              (chmod (scope file) #o666)))
+            '(("dev/null" 1 3)
+              ("dev/zero" 1 5)
+              ("dev/full" 1 7)
+              ("dev/random" 1 8)
+              ("dev/urandom" 1 9)))
+
+  (symlink "/proc/self/fd" (scope "dev/fd"))
+  (symlink "/proc/self/fd/0" (scope "dev/stdin"))
+  (symlink "/proc/self/fd/1" (scope "dev/stdout"))
+  (symlink "/proc/self/fd/2" (scope "dev/stderr")))
 
 (define %host-qemu-ipv4-address
   (inet-pton AF_INET "10.0.2.10"))