[PATCHv2] Create /dev/* symlinks after we mount tmpfs on /dev

Vratislav Podzimek vpodzime at redhat.com
Mon Sep 17 11:10:17 UTC 2012


Creating them in mk-images results in these files missing after
we mount tmpfs on /dev in our init.

Resolves: rhbz#784159
---
 loader2/init.c    | 12 ++++++++++++
 scripts/mk-images |  7 -------
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/loader2/init.c b/loader2/init.c
index 782526b..e7435fe 100644
--- a/loader2/init.c
+++ b/loader2/init.c
@@ -482,6 +482,18 @@ static void createDevices(void) {
                     strerror(errno));
     }
 
+    if (symlink("/proc/self/fd/0", "/dev/stdin"))
+        printf("failed to create /dev/stdin symlink to /proc/self/fd/0");
+
+    if (symlink("/proc/self/fd/1", "/dev/stdout"))
+        printf("failed to create /dev/stdout symlink to /proc/self/fd/1");
+
+    if (symlink("/proc/self/fd/2", "/dev/stderr"))
+        printf("failed to create /dev/stderr symlink to /proc/self/fd/2");
+
+    if (symlink("/proc/self/fd", "/dev/fd"))
+        printf("failed to create /dev/fd symlink to /proc/self/fd");
+
     /* Restore umask for minimal side affects */
     umask(previous_umask); 
 }
diff --git a/scripts/mk-images b/scripts/mk-images
index 4823ad0..ce3beb6 100755
--- a/scripts/mk-images
+++ b/scripts/mk-images
@@ -606,13 +606,6 @@ makeinitrd() {
     mkdir -p $MBD_DIR/var/run/rhsm
     mkdir -p $MBD_DIR/var/lock/rpm
 
-    ( cd $MBD_DIR/dev
-      ln -sf /proc/self/fd/0 stdin
-      ln -sf /proc/self/fd/1 stdout
-      ln -sf /proc/self/fd/2 stderr
-      ln -sf /proc/self/fd fd
-    )
-
     if [ "$BUILDARCH" = "ppc" -o "$BUILDARCH" = "ppc64" ]; then
 	mkdir -p $MBD_DIR/dev/iseries
     fi
-- 
1.7.11.4



More information about the anaconda-patches mailing list