summaryrefslogtreecommitdiff
path: root/sources/target_skeleton/etc/init.d/S05ramdisk1
blob: b8a6d70ad045b90338894a3271d178a5725b26a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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