]> rtime.felk.cvut.cz Git - coffee/buildroot.git/commitdiff
skeleton: add /dev/fd, /dev/std{in, out, err} symlinks for static /dev on readonly...
authorPeter Korsgaard <peter@korsgaard.com>
Tue, 1 May 2018 19:41:56 +0000 (21:41 +0200)
committerPeter Korsgaard <peter@korsgaard.com>
Tue, 1 May 2018 19:53:45 +0000 (21:53 +0200)
Some applications, e.g. bashs process subsitution feature, rely on the
convention of `/dev/fd` being a symbolic link to `/proc/self/fd`.

When a static /dev is used on a readonly rootfs then the runtime ln
invocations in the inittab will fail, so we need to add the symlinks at
build time.  Makedevs doesn't support creating symlinks, so instead add the
symlinks to the default skeleton.

For non-static /dev setups, the kernel will mount devtmpfs which shadows the
/dev of the rootfs, but then the runtime ln invocations in inittab will
create the symlinks.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
system/skeleton/dev/fd [new symlink]
system/skeleton/dev/stderr [new symlink]
system/skeleton/dev/stdin [new symlink]
system/skeleton/dev/stdout [new symlink]

diff --git a/system/skeleton/dev/fd b/system/skeleton/dev/fd
new file mode 120000 (symlink)
index 0000000..10e8ab7
--- /dev/null
@@ -0,0 +1 @@
+../proc/self/fd
\ No newline at end of file
diff --git a/system/skeleton/dev/stderr b/system/skeleton/dev/stderr
new file mode 120000 (symlink)
index 0000000..c67586e
--- /dev/null
@@ -0,0 +1 @@
+../proc/self/fd/2
\ No newline at end of file
diff --git a/system/skeleton/dev/stdin b/system/skeleton/dev/stdin
new file mode 120000 (symlink)
index 0000000..2825dc0
--- /dev/null
@@ -0,0 +1 @@
+../proc/self/fd/0
\ No newline at end of file
diff --git a/system/skeleton/dev/stdout b/system/skeleton/dev/stdout
new file mode 120000 (symlink)
index 0000000..35e0f62
--- /dev/null
@@ -0,0 +1 @@
+../proc/self/fd/1
\ No newline at end of file