[Feature][ZXW-452]merge P54U02 version

Only Configure: No
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No

Change-Id: I17e6795ab66e2b9d1cbbfec4b7c0028d666e177d
diff --git a/ap/os/linux/linux-3.4.x/init/main.c b/ap/os/linux/linux-3.4.x/init/main.c
old mode 100644
new mode 100755
index 482385f..8570e3a
--- a/ap/os/linux/linux-3.4.x/init/main.c
+++ b/ap/os/linux/linux-3.4.x/init/main.c
@@ -81,6 +81,11 @@
 #include <asm/smp.h>
 #endif
 
+#ifdef CONFIG_FLAGS_UTILS
+#include <linux/reboot.h>
+#include "pub_flags.h"
+#endif
+
 static int kernel_init(void *);
 
 extern void init_IRQ(void);
@@ -867,6 +872,17 @@
 	run_init_process("/bin/init");
 	run_init_process("/bin/sh");
 #endif
+#ifdef CONFIG_FLAGS_UTILS
+{
+	extern int flags_sys_switch(void);
+	printk(KERN_EMERG "No init found.  Try passing init= option to kernel. "
+	      "See Linux Documentation/init.txt for guidance.");
+	if (flags_sys_switch() < 0)
+		panic("init: flags_sys_switch fail");
+	else
+		kernel_restart("init: Switch to another system, please reset machine");
+}
+#endif
 	panic("No init found.  Try passing init= option to kernel. "
 	      "See Linux Documentation/init.txt for guidance.");
 }