ASR_BASE

Change-Id: Icf3719cc0afe3eeb3edc7fa80a2eb5199ca9dda1
diff --git a/package/system/procd/patches/0003-Marvell-fast-boot-solution.patch b/package/system/procd/patches/0003-Marvell-fast-boot-solution.patch
new file mode 100644
index 0000000..1439a3f
--- /dev/null
+++ b/package/system/procd/patches/0003-Marvell-fast-boot-solution.patch
@@ -0,0 +1,60 @@
+--- a/inittab.c
++++ b/inittab.c
+@@ -16,6 +16,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/ioctl.h>
++#include <sys/wait.h>
+ 
+ #include <fcntl.h>
+ #include <stdio.h>
+@@ -385,3 +386,28 @@ void procd_inittab(void)
+ 	free(a);
+ 	regfree(&pat_inittab);
+ }
++
++/*Implementation of Marvell Fast Boot routine*/
++void mrvl_fast_boot()
++{
++	char *init[] = { "/etc/telinit", NULL };
++	int i, pid;
++
++	pid = fork();
++	if (!pid) {
++		execvp(init[0], init);
++		ERROR("Failed to start telinit\n");
++		exit(-1);
++	}
++	if (pid <= 0) {
++		ERROR("Failed to start new telinit instance\n");
++		return;
++	} else {
++                for (i = 0; i < 200; i++) {
++                        if (waitpid(pid, NULL, WNOHANG) > 0)
++                                break;
++                        usleep(10 * 1000);
++                }
++	}
++}
++
+--- a/procd.h
++++ b/procd.h
+@@ -46,6 +46,7 @@ void procd_inittab(void);
+ void procd_inittab_run(const char *action);
+ void procd_inittab_kill(void);
+ void procd_bcast_event(char *event, struct blob_attr *msg);
++void mrvl_fast_boot(void);
+ 
+ struct trigger;
+ void trigger_event(const char *type, struct blob_attr *data);
+--- a/state.c
++++ b/state.c
+@@ -137,6 +137,8 @@ static void state_enter(void)
+ 		break;
+ 
+ 	case STATE_UBUS:
++		LOG("- telinit -\n");
++		mrvl_fast_boot();
+ 		// try to reopen incase the wdt was not available before coldplug
+ 		watchdog_init(0);
+ 		set_stdio("console");