From 289773c1d852a716d44aecbc03316f0c119387a8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 9 Apr 2014 17:50:37 +0200 Subject: [PATCH] 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. --- guix/build/linux-initrd.scm | 23 ++++++++++++++++++----- 1 file 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")) -- 2.20.1