blob: ee2c28630b6c8608088ffc7b200572b4baec993f (
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
|
#!/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.sysinit : script starts${C_}]"
echo -e "[${_G}mount...${C_}]"
mount -t proc none /proc
mount -t tmpfs tmpfs /tmp
mount -t sysfs none /sys
mount -t tmpfs runfs /run
mkdir -p /dev/pts
mkdir -p /dev/shm
mount -t tmpfs none /dev/shm
mount -t devpts devpts /dev/pts
mount -t debugfs none /sys/kernel/debug
mknod /dev/null c 1 3
mknod /dev/mmcblk0 b 179 0
mknod /dev/mmcblk0p6 b 179 6
# mount opt partition
mount -t ext4 /dev/mmcblk0p6 /opt
echo -e "[${_G}udev start${C_}]"
/sbin/udevd --daemon
/sbin/udevadm trigger
if [ ! -e /opt/etc/.firstboot ]; then
umount /opt
# find rootfs partition for resizing and remounting
for param in `cat /proc/cmdline`; do
if [ "${param:0:5}" = "root=" ]; then
rootfs_part=${param#root=}
break
fi
done
ext4_parts=`grep ext4 /etc/fstab | grep mmcblk0 | awk '{print $1};'`
for part in $ext4_parts; do
# check all RW partitions in order to resize it withtout mounting excepting rootfs.
if [ "$part" != "$rootfs_part" ]; then
e2fsck -y -f $part
fi
echo "resize $part"
resize2fs $part
done
mount -t ext4 /dev/mmcblk0p6 /opt
echo -e "[${_Y}rc.firstboot${C_}]"
/etc/rc.d/rc.firstboot
touch /opt/etc/.firstboot
sync
fi
mount /var
# check special booting mode.
/bin/check-booting-mode.sh
if [ $? -eq 0 ]; then
echo -e "${_R}[ Special Booting mode ]${C_}"
for i in /etc/rc.d/rc2.d/*; do
echo -e "${_G}[${i} start]${C_}"
$i start
done
exit 0
fi
# mount all partitions
mount -a
mount --bind /run/ /var/run/
echo -e "[${_G}create base directory in /opt, /var${C_}]"
# construct directory hierarchy
mkdir -p /opt/var/log/apt
mkdir -p /opt/var/lib
mkdir -p /opt/var/cache
echo -e "[${_G}set device node perm & security${C_}]"
# Set device node permissions for security
chown 0:6501 /dev/video1
chown 0:6501 /dev/s3c-jpg
#chmod 666 /dev/pvrsrvkm
chown 0:6509 /dev/log_main
chown 0:6509 /dev/log_events
chown 0:6509 /dev/log_radio
chown :audio /dev/snd/
chmod 775 /dev/snd/
chown :audio /dev/snd/controlC0
chown :audio /dev/snd/pcmC0D0p
chown :audio /dev/snd/pcmC0D1p
chown :audio /dev/snd/pcmC0D2p
chown :audio /dev/snd/pcmC0D3p
chown :audio /dev/snd/timer
chown 0:6508 /dev/snd/pcmC0D0c
chown 0:6508 /dev/snd/pcmC0D1c
chown 0:6508 /dev/snd/pcmC0D2c
chown 0:6508 /dev/snd/pcmC0D3c
chown 0:6510 /dev/s3c-mfc
chown 0:6510 /dev/video5
chown 0:6510 /dev/video6
chmod 666 /dev/random
chmod 666 /dev/urandom
chown :video /dev/fb0
chown :video /dev/video0
chown :video /dev/video2
chown :video /dev/video3
chown :video /dev/s3c-mem
chown :6512 /dev/radio0
chown :6702 /sys/class/backlight/*/brightness
# change node's owner for torch light
chown :6703 /sys/class/leds/leds-torch/brightness
chmod 664 /sys/class/backlight/*/brightness
# change files permission for 3D application
chmod 666 /dev/ump
chmod 666 /dev/mali
chmod 666 /dev/slp_global_lock
# Set gst-openmax configure file
export OMX_CONFIG=/opt/etc/gst-openmax.conf
echo -e "[${_G}make gstreamer registery${C_}]"
# Make gst registry
export GST_REGISTRY=/opt/etc/.gstreamer-0.10/registry.bin.arm
gst-inspect 1> /dev/null
chmod 655 /opt/etc/.gstreamer-0.10
chmod 644 /opt/etc/.gstreamer-0.10/registry.bin.arm
# Modem power on
echo -e "[${_Y}modem power on${C_}]"
ln -s /boot/modem.bin /modem/modem.bin
/usr/bin/xmm6262-boot &
#touch sensor start
echo 1 > /sys/class/i2c-adapter/i2c-2/2-004a/touchstart
echo -e "[${_G}run profile${C_}]"
# Run profile
. /etc/profile
if [ -e /opt/etc/.debugmode ]; then
echo "debug mode enabled"
# for bluescreen
export LD_PRELOAD=/usr/lib/libsys-assert.so
# enable coredump
echo "/opt/bs/core/core.%p" > /proc/sys/kernel/core_pattern
ulimit -c unlimited
else
echo "debug mode disabled"
fi
/usr/bin/press 1 # wait input to stop running scripts
if [ $? -eq 0 ]; then
echo "script is stopped"
# prepare usbnet before exit
insmod /usr/driver/g_ether.ko
sleep 1
ifconfig usb0 192.168.129.3 netmask 255.255.255.0
# Run all rc0 scripts
for i in /etc/rc.d/rc0.d/*; do
echo -e "[${_G}${i} start${C_}]"
$i start
done
else
# Run all rc3 scripts
echo -e "[${_G}run all rc3 scripts${C_}]"
echo "normal boot"
for i in /etc/rc.d/rc3.d/*; do
echo -e "[${_G}${i} start${C_}]"
$i start
done
fi
# change owner and group about /opt/media directory
chown 5000:5000 /opt/media
echo -e "[${_G}set cpufreq governor${C_}]"
# Set default cpufreq governor
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
# symbolic link
if [ ! -e /opt/apps ]; then
echo -e "[${_G}link /opt/apps -> /opt/media/apps${C_}]"
ln -s /opt/media/apps /opt/apps
fi
# inhouse home-directory
chown 5000:5000 /home/inhouse
|