summaryrefslogtreecommitdiffstats
path: root/sources/target_skeleton/etc/init.d/S05ramdisk1
diff options
context:
space:
mode:
Diffstat (limited to 'sources/target_skeleton/etc/init.d/S05ramdisk1')
-rwxr-xr-xsources/target_skeleton/etc/init.d/S05ramdisk151
1 files changed, 51 insertions, 0 deletions
diff --git a/sources/target_skeleton/etc/init.d/S05ramdisk1 b/sources/target_skeleton/etc/init.d/S05ramdisk1
new file mode 100755
index 000000000..b8a6d70ad
--- /dev/null
+++ b/sources/target_skeleton/etc/init.d/S05ramdisk1
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+# Build a ramdisk to overlay on /dev so we can scribble on it
+# all we want without needing rw access to the underlying filesystem
+
+SIZE=140
+INODES=1000
+
+echo -n "Building device ramdisk: "
+
+/bin/umount /dev/ram1 >/dev/null 2>&1
+
+/bin/dd if=/dev/zero of=/dev/ram1 bs=1k count=$SIZE >/dev/null 2>&1
+if [ $? != 0 ] ; then
+ echo "failed."
+ exit 1;
+fi
+
+/sbin/mkfs.minix -n30 -i$INODES /dev/ram1 $SIZE >/dev/null 2>&1
+if [ $? != 0 ] ; then
+ echo "failed."
+ exit 1;
+fi
+
+/bin/mount /dev/ram1 /mnt -t minix -o rw >/dev/null 2>&1
+if [ $? != 0 ] ; then
+ echo "failed."
+ exit 1;
+fi
+
+/bin/cp -a /dev/* /mnt >/dev/null 2>&1
+if [ $? != 0 ] ; then
+ echo "failed."
+ exit 1;
+fi
+
+/bin/umount /mnt >/dev/null 2>&1
+if [ $? != 0 ] ; then
+ echo "failed."
+ exit 1;
+fi
+
+/bin/mount /dev/ram1 /dev -t minix -o rw >/dev/null 2>&1
+if [ $? != 0 ] ; then
+ echo "failed."
+ exit 1;
+else
+ echo "done."
+fi
+
+exit 0