Skip to content

Commit a9bec87

Browse files
committed
feature/runtime: Check and create the necessary device files
After dropping gen_init_cpio, core devices are no longer created when creating an image. It is necessary to check their availability and create them at runtime. Fixes: aab9b26 ("Replace gen_init_cpio by cpio") Signed-off-by: Alexey Gladkov <[email protected]>
1 parent 965f62a commit a9bec87

File tree

1 file changed

+21
-0
lines changed
  • features/runtime/data

1 file changed

+21
-0
lines changed

features/runtime/data/init

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,27 @@ export PATH=/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/usr/local/bin
1212
# Create storage for init environment
1313
:> /.initrd/initenv
1414

15+
# Check and create the necessary device files
16+
[ -d /dev ] ||
17+
mkdir /dev
18+
while read -r d_name d_type d_maj d_min; do
19+
[ -e "/dev/$d_name" ] ||
20+
mknod "/dev/$d_name" "$d_type" "$d_maj" "$d_min"
21+
done <<EOF
22+
ram b 1 1
23+
null c 1 3
24+
zero c 1 5
25+
full c 1 7
26+
random c 1 8
27+
kmsg c 1 11
28+
systty c 4 0
29+
tty0 c 4 0
30+
tty1 c 4 1
31+
tty c 5 0
32+
console c 5 1
33+
ptmx c 5 2
34+
EOF
35+
1536
# Backward compatibility
1637
x=/sbin/init-bin
1738
[ ! -x "$x" ] || exec "$x"

0 commit comments

Comments
 (0)