summaryrefslogtreecommitdiff
path: root/filesystem/etc/rc.d/rc.emul
blob: 3ef8415d5ebb1e25bd15ddecaedb69227887050e (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/sh

# Color set for ANSI TERM
_R='\033[0;31;1m'	#Red
_G='\033[0;32;1m'	#Green
_Y='\033[0;33;1m'	#Yellow
C_='\033[0m'		#Color off

echo -e "[${_G}rc.emul : script start ${C_}]"

echo -e "[${_G}sshd start ${C_}]"
/etc/init.d/ssh start

echo -e "[${_G}chmod +x /opt/media for various apps ${C_}]"
chmod -R 777 /opt/media

echo -e "[${_G}make symbolic link ${C_}]"
ln -sf /mnt/mmc /sdcard
ln -sf /proc/mounts /etc/mtab

echo -e "[${_G}Setting power manager state value ${C_}]"
/usr/bin/vconftool set -t int memory/pwrmgr/state 1

echo -e "[${_G}Initialize battery level ${C_}]"
/usr/bin/vconftool set -t int memory/Battery/Level 5 
/usr/bin/vconftool set -t int memory/Battery/Status/Low 4

echo -e "[${_G}Mount SD card ${C_}]"
mount -o umask=000 /dev/mmcblk0 /mnt/mmc
chmod 777 /opt/storage/sdcard

MMC_MOUNT=`/bin/mount | grep mmc`
if [ -n "$MMC_MOUNT" ]; then
	echo -e "[${_G}MMC storage detected ${C_}]"
	/usr/bin/vconftool set -t int memory/Device/Mmc 1
	/usr/bin/vconftool set -t int memory/filemanager/Mmc 2
fi 

echo -e "[${_G}Mount host directory${C_}]"
test -d "/mnt/host" || mkdir "/mnt/host"
if grep "cifs=" /proc/cmdline ; then
        cifs=`sed 's/^.*cifs=\([^, ]*\).*$/\1/g' /proc/cmdline`
        opts=`sed 's/^.*cifs=\([^, ]*\),username=\([^, ]*\),password=\([^, ]*\).*$/username=\2,password=\3/g' /proc/cmdline`
        cifs=`echo $cifs | tr [a-z] [A-Z]`
        if mount -t cifs //10.0.2.2/$cifs /mnt/host -o $opts,file_mode=0777,dir_mode=0777; then
		echo -e "[${_Y}Mount.cifs succeed${C_}]"
	else
		echo -e "[${_R}Mount.cifs fail!!!!${C_}]"
	fi
fi
if grep "virtio-9p" /proc/cmdline ; then
	if mount -t 9p -o trans=virtio fileshare /mnt/host -oversion=9p2000.L -o msize=65536; then
		echo -e "[${_Y}Mount.9pfs succeed${C_}]"
	else
		echo -e "[${_R}Mount.9pfs fail!!!!${C_}]"
	fi
fi

echo -e "[${_G}to generate modules.dep and map files${C_}]"
depmod -a

echo -e "[${_G}to change brightness's group${C_}]"
chgrp system_bklight /sys/class/backlight/emulator/brightness
chmod g+w /sys/class/backlight/emulator/brightness

echo -e "[${_G}to change lcd_power's group${C_}]"
chown -R root:system_bklight /sys/devices/virtual/lcd/emulator/lcd_power

echo -e "[${_G}Initialize display setting value${C_}]"
/usr/bin/vconftool set -t int db/setting/Brightness "24"
/usr/bin/vconftool set -t int db/MainLCD/Backlight/Normal "600"

echo -e "[${_G} Opengl-es acceleration module setting. ${C_}]"
if grep "gles=0" /proc/cmdline ; then
        echo -e "[${_G} Emulator does not support gles acceleration. Backup egl library. ${C_}]"
        mkdir "/usr/lib/gles"
        mv /usr/lib/libEGL.* /usr/lib/gles/
else
        echo -e "[${_G} Emulator support gles acceleration. ${C_}]"
		echo -e "[${_G} Change permission of /dev/glmem and restore egl library. ${C_}]"
        chmod 666 /dev/glmem
        if test -d "/usr/lib/gles" ; then
                mv /usr/lib/gles/* /usr/lib/
                rm -rf /usr/lib/gles
        fi
fi

echo -e "[${_G}rc.emul : script end ${C_}]"