Browse Source

implement makeCoreNodes()

master
belliash 7 years ago
parent
commit
b9a1efe4ef
1 changed files with 28 additions and 0 deletions
  1. 28
    0
      libraries/filesystem

+ 28
- 0
libraries/filesystem View File

@@ -105,6 +105,34 @@ function makeCoreDirectories() {
105 105
 	return 0
106 106
 }
107 107
 
108
+#-------------------------------------------------------------------------------
109
+# Creates base device nodes and symlinks in specified directory
110
+# Parameters: %directory%
111
+#-------------------------------------------------------------------------------
112
+function makeCoreNodes() {
113
+	local DIR="${1}"
114
+	makeNode ${DIR} 600 console c 5 1 || return 1
115
+	makeNode ${DIR} 600 kmsg c 1 11 || return 1
116
+	makeNode ${DIR} 777 null c 1 3 || return 1
117
+	makeNode ${DIR} 666 ptmx c 5 2 || return 1
118
+	makeNode ${DIR} 644 ptyp0 c 2 0 || return 1
119
+	makeNode ${DIR} 666 random c 1 8 || return 1
120
+	makeNode ${DIR} 666 tty c 5 0 || return 1
121
+	makeNode ${DIR} 666 tty0 c 4 0 || return 1
122
+	makeNode ${DIR} 644 ttyp0 c 3 0 || return 1
123
+	makeNode ${DIR} 666 urandom c 1 9 || return 1
124
+	makeNode ${DIR} 666 zero c 1 5 || return 1
125
+	for n in {0..3}; do
126
+		makeNode ${DIR} 600 ttyS${n} c 4 $(( 64 + $n )) || return 1
127
+	done
128
+	run "ln -sfv /proc/self/fd ${DIR}/fd" || return 1
129
+	run "ln -sfv /proc/self/fd/0 ${DIR}/stdin" || return 1
130
+	run "ln -sfv /proc/self/fd/1 ${DIR}/stdout" || return 1
131
+	run "ln -sfv /proc/self/fd/2 ${DIR}/stderr" || return 1
132
+	run "ln -sfv /proc/kcore ${DIR}/core" || return 1
133
+	return 0
134
+}
135
+
108 136
 #-------------------------------------------------------------------------------
109 137
 # Creates all components of the specified directories
110 138
 # Parameters: %directory%

Loading…
Cancel
Save