Add basic change for v1453

Change-Id: I9497a61bbc3717f66413794a4e7dee0347c0bc33
diff --git a/mbtk/rootfs/etc/init.d/mbtk_boot_eary b/mbtk/rootfs/etc/init.d/mbtk_boot_eary
new file mode 100755
index 0000000..e1ab3b6
--- /dev/null
+++ b/mbtk/rootfs/etc/init.d/mbtk_boot_eary
@@ -0,0 +1,109 @@
+#!/bin/sh
+
+#MBTK_ADB=`getprop persist.mbtk.adb 2> /dev/null`
+project=`cat /etc/mbtk_project`
+
+mbtk_start() {
+	echo "start : $1" > /dev/kmsg
+	
+	if [ -e $1 ];then
+		# stdout and stderr > /dev/null
+		#$@ &> /dev/null &
+		(while ! $@ &> /dev/null;           do echo "Restarting $@ ...";               done) &
+	fi
+}
+
+start_service() {
+	echo "--mbtk eary boot start--" > /dev/kmsg
+#	mbtk_start /bin/mbtk_test
+#	mbtk_start /bin/mbtk_test "eary" 123
+    # ɾ³ýÉÏ´Îgnss ÐÇÀú
+    if [ -f /etc/mbtk/rtm.bin ]
+    then
+	    echo "--mbtk eary boot rtm.bin " > /dev/kmsg
+        rm /etc/mbtk/rtm.bin
+    fi
+
+	mbtk_start /bin/mbtk_rild
+	
+	if [ -f /bin/mbtk_sdk_ready ]
+	then
+		mbtk_start /bin/mbtk_sdk_ready
+		echo "--mbtk platform mbtk_sdk_ready start--" > /dev/kmsg
+	fi
+	
+	if [ "$project" == "T108_2" ];then
+		i2cset -y -f 2 0x31 0x15 0x00
+		mbtk_start /bin/mbtk_gnssd 8122 /dev/ttyS3 0
+	elif [ "$project" == "L508_X6" ];then
+		mbtk_start /bin/mbtk_gnssd 5311 /dev/ttyS3 255
+	else
+		# Only auto open gnss but not open any port.
+		mbtk_start /bin/mbtk_gnssd 5311 /dev/ttyS2 255
+	fi
+
+	if [ "$project" == "L508_X6" -o "$project" == "L509" ]
+	then
+		#echo "$project"
+		i2cset -y -f 2 0x32 0x0d 0x00
+	fi
+
+	if [ "$project" == "T108_2" ]
+	then
+		i2cset -y -f 2 0x31 0x15 0x00
+	fi
+	echo "--mbtk eary boot end--" > /dev/kmsg
+}
+
+sleep_init()
+{
+	if [ -e /sys/devices/soc.0/d4000000.apb/mbtk-dev-op/gps_power ]
+	then
+		echo off  > /sys/devices/soc.0/d4000000.apb/mbtk-dev-op/gps_power
+	else
+		echo "/sys/devices/soc.0/d4000000.apb/mbtk-dev-op/gps_power can not write." > /dev/kmsg
+	fi
+	
+	if [ -e /sys/kernel/debug/spk_shdn_gpio ]
+	then
+		echo 0 > /sys/kernel/debug/spk_shdn_gpio
+	else
+		echo "/sys/kernel/debug/spk_shdn_gpio can not write." > /dev/kmsg
+	fi
+	
+	if [ -e /sys/devices/asr-rfkill.0/pwr_ctrl ]
+	then
+		echo 1 > /sys/devices/asr-rfkill.0/pwr_ctrl
+		sleep 1
+		echo 0 > /sys/devices/asr-rfkill.0/pwr_ctrl
+	else
+		echo "/sys/devices/asr-rfkill.0/pwr_ctrl can not write." > /dev/kmsg
+	fi
+
+	case "$project" in
+		PN1803)
+			echo 4 > /sys/class/gpio/export
+			echo out > /sys/class/gpio/gpio4/direction
+			echo 0 > /sys/class/gpio/gpio4/value
+			;;
+		L509)
+			echo 5 > /sys/class/gpio/export
+			echo out > /sys/class/gpio/gpio5/direction
+			echo 0 > /sys/class/gpio/gpio5/value
+			
+			echo 8 > /sys/class/gpio/export
+			echo out > /sys/class/gpio/gpio8/direction
+			echo 1 > /sys/class/gpio/gpio8/value
+			;;
+	esac
+	
+	if [ "$project" == "PN1803" -o "$project" == "L508" -o "$project" == "L509"]
+	then
+		echo 118 > /sys/class/gpio/export
+		echo out > /sys/class/gpio/gpio118/direction
+		echo 0 > /sys/class/gpio/gpio118/value
+	fi
+}
+
+start_service
+sleep_init
diff --git a/mbtk/rootfs/etc/init.d/mbtk_boot_last b/mbtk/rootfs/etc/init.d/mbtk_boot_last
new file mode 100755
index 0000000..e660b6c
--- /dev/null
+++ b/mbtk/rootfs/etc/init.d/mbtk_boot_last
@@ -0,0 +1,28 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=98
+USE_PROCD=1
+
+#MBTK_ADB=`getprop persist.mbtk.adb 2> /dev/null`
+
+mbtk_start() {
+	echo "start : $1" > /dev/kmsg
+
+	if [ -e $1 ];then
+		procd_open_instance
+		procd_set_param command $@
+		procd_close_instance
+	fi
+}
+
+start_service() {
+	echo "--mbtk last boot start--" > /dev/kmsg
+#	mbtk_start /bin/mbtk_test
+#	mbtk_start /bin/mbtk_test "last" 123
+	
+	[ -e /bin/mbtk_otad ] && mbtk_start /bin/mbtk_otad -a fota
+	
+	echo "--mbtk last boot end--" > /dev/kmsg
+}
+
diff --git a/mbtk/rootfs/etc/init.d/mbtk_boot_net_ready b/mbtk/rootfs/etc/init.d/mbtk_boot_net_ready
new file mode 100755
index 0000000..f00b0c2
--- /dev/null
+++ b/mbtk/rootfs/etc/init.d/mbtk_boot_net_ready
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+mbtk_start() {
+	echo "start : $1" > /dev/kmsg
+	
+	if [ -e $1 ];then
+		# stdout and stderr > /dev/null
+		#$@ &> /dev/null &
+		(while ! $@ &> /dev/null;           do echo "Restarting $@ ...";               done) &
+	fi
+}
+
+start_service() {
+	echo "--mbtk net ready boot start--" > /dev/kmsg
+
+	#mbtk_start /bin/mbtk_info_test
+
+
+	echo "--mbtk net ready boot end--" > /dev/kmsg
+}
+
+start_service
diff --git a/mbtk/rootfs/etc/init.d/mbtk_boot_normal b/mbtk/rootfs/etc/init.d/mbtk_boot_normal
new file mode 100755
index 0000000..5925837
--- /dev/null
+++ b/mbtk/rootfs/etc/init.d/mbtk_boot_normal
@@ -0,0 +1,36 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=15
+USE_PROCD=1
+
+#MBTK_ADB=`getprop persist.mbtk.adb 2> /dev/null`
+
+mbtk_start() {
+	echo "start : $1" > /dev/kmsg
+
+	procd_open_instance
+	procd_set_param command $@
+	procd_close_instance
+}
+
+mbtk_start_with_try() {
+	echo "start_with_try : $1" > /dev/kmsg
+
+	procd_open_instance
+	procd_set_param command $@
+	procd_set_param respawn 3600 3 0
+	procd_close_instance
+}
+
+start_service() {
+	echo "--mbtk normal boot start--" > /dev/kmsg
+#	mbtk_start /bin/mbtk_test
+#	mbtk_start /bin/mbtk_test "normal" 123
+	
+	[ -e /bin/mbtk_adbd ] && mbtk_start /bin/mbtk_adbd
+	[ -e /bin/mbtk_servicesd ] && mbtk_start_with_try /bin/mbtk_servicesd
+	
+	echo "--mbtk normal boot end--" > /dev/kmsg
+}
+
diff --git a/mbtk/rootfs/etc/init.d/mbtk_boot_server_ready b/mbtk/rootfs/etc/init.d/mbtk_boot_server_ready
new file mode 100755
index 0000000..7d50c92
--- /dev/null
+++ b/mbtk/rootfs/etc/init.d/mbtk_boot_server_ready
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+mbtk_start() {
+	echo "start : $1" > /dev/kmsg
+	
+	if [ -e $1 ];then
+		# stdout and stderr > /dev/null
+		#$@ &> /dev/null &
+		(while ! $@ &> /dev/null;           do echo "Restarting $@ ...";               done) &
+	fi
+}
+
+start_service() {
+	echo "--mbtk server ready boot start--" > /dev/kmsg
+
+	#mbtk_start /bin/mbtk_info_test
+	#mbtk_start /bin/mbtk_logd
+
+	echo "--mbtk server ready boot end--" > /dev/kmsg
+}
+
+start_service
diff --git a/mbtk/rootfs/etc/init.d/mbtk_platform_version b/mbtk/rootfs/etc/init.d/mbtk_platform_version
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/mbtk/rootfs/etc/init.d/mbtk_platform_version