summaryrefslogtreecommitdiffstats
path: root/target/device/Atmel/atstk100x/target_skeleton/etc/init.d/S00mountvirtfs
blob: d9e5c9249f0e47d76df7c0a1921b1af83fecf8a4 (plain) (blame)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/sh

MOUNT=/bin/mount
MKDIR=/bin/mkdir

retval=0

mount_fs()
{
	if [ "$1" = "" -o "$2" = "" -o "$3" = "" ]; then
		return;
	fi

	if [ "$4" = "" ]; then
		if ! ${MOUNT} -t $3 $1 $2; then
			echo "  mount $2 failed"
			retval=1
			return 1
		else
			echo "  $2 mounted"
		fi
	else
		if ! ${MOUNT} -t $3 -o $4 $1 $2; then
			echo "  mount $2 failed"
			retval=1
			return 1
		else
			echo "  $2 mounted"
		fi
	fi

	return 0
}

mkdir_fs()
{
	if [ "$1" = "" ]; then
		return;
	fi

	if ! ${MKDIR} $1; then
		echo "  mkdir $1 failed"
		retval=1
		return 1
	else
		echo "  $1 directory made"
	fi

	return 0
}

echo "Mounting virtual filesystems:"

mount_fs proc /proc proc
mount_fs sys /sys sysfs

if mount_fs dev /dev tmpfs "size=512k,mode=0755"; then
	mkdir_fs /dev/pts
	mount_fs pts /dev/pts devpts
	mkdir_fs /dev/shm
	# g_serial is not detected by mdev.
	mknod /dev/ttygserial c 127 0
fi

mount_fs config /config configfs
mount_fs tmp /tmp tmpfs
mount_fs run /var/run tmpfs
mount_fs log /var/log tmpfs

if [ $retval -ne 0 ]; then
	echo "  WARNING: not able to mount all virtual file systems"
fi

exit $retval