Tizen 2.0 Release
[adaptation/system-plugin-slp.git] / etc / rc.d / rc.sysinit
index 9f7c1f6..d49044d 100755 (executable)
@@ -11,23 +11,52 @@ 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 tmpfs tmpfs /var
 mount -t sysfs none /sys
-mount -t tmpfs tmpfs /dev  # remount dev to make it writable
+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
 
-echo -e "[${_G}prepare device node${C_}]"
-if [ ! -e /dev/snd ]; then
-       mkdir /dev/snd
+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
 
-mdev -s
-mknod /dev/ttySAC1 c 204 65 # UART1 device node for GPS (requested by youngae.kang)
-mknod /dev/ttySAC2 c 204 66
+mount /var
 
 # check special booting mode.
 /bin/check-booting-mode.sh
@@ -40,30 +69,17 @@ if [ $? -eq 0 ]; then
        exit 0
 fi
 
-# mount
+# mount all partitions
 mount -a
-
-echo -e "[${_G}udev start${C_}]"
-/sbin/udevd --daemon
-/sbin/udevadm trigger --subsystem-match=iio
+mount --bind /run/ /var/run/
 
 echo -e "[${_G}create base directory in /opt, /var${C_}]"
 # construct directory hierarchy
 mkdir -p /opt/var/log/apt
-ln -s /opt/var/log /var/log
 mkdir -p /opt/var/lib
-ln -s /opt/var/lib /var/lib            # for apt
 mkdir -p /opt/var/cache
-ln -s /opt/var/cache /var/cache                # for apt
-mkdir -p /var/run
 
 
-if [ ! -e /opt/etc/.firstboot ]; then
-       echo -e "[${_Y}rc.firstboot${C_}]"
-       /etc/rc.d/rc.firstboot
-       touch /opt/etc/.firstboot
-fi
-
 echo -e "[${_G}set device node perm & security${C_}]"
 # Set device node permissions for security
 chown 0:6501 /dev/video1
@@ -84,7 +100,7 @@ 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/s5p-mfc
+chown 0:6510 /dev/s3c-mfc
 chown 0:6510 /dev/video5
 chown 0:6510 /dev/video6
 chmod 666 /dev/random
@@ -93,6 +109,7 @@ 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
@@ -101,6 +118,7 @@ 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
@@ -115,26 +133,24 @@ 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/xmm6260-boot &
+/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
+if [ -e /opt/etc/.coredump ]; then
        # enable coredump
-       echo "/opt/bs/core/core.%p" > /proc/sys/kernel/core_pattern
+       echo "/opt/usr/share/crash/core/%p_%s_%e.core" > /proc/sys/kernel/core_pattern
        ulimit -c unlimited
 else
-       echo "debug mode disabled"
+       echo "core dump disabled"
+       ulimit -c 0
 fi
 
+echo -e "[${_G}run profile${C_}]"
+# Run profile
+. /etc/profile
+
 /usr/bin/press 1 # wait input to stop running scripts
 if [ $? -eq 0 ]; then
        echo "script is stopped"
@@ -157,6 +173,9 @@ else
        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