#!/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 if [ -e /opt/etc/.coredump ]; then # enable coredump echo "/opt/usr/share/crash/core/%p_%s_%e.core" > /proc/sys/kernel/core_pattern ulimit -c unlimited else 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" # 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