blob: 1439a3f5e4e45056bca49eeb86947a97170d88eb [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001--- a/inittab.c
2+++ b/inittab.c
3@@ -16,6 +16,7 @@
4 #include <sys/types.h>
5 #include <sys/stat.h>
6 #include <sys/ioctl.h>
7+#include <sys/wait.h>
8
9 #include <fcntl.h>
10 #include <stdio.h>
11@@ -385,3 +386,28 @@ void procd_inittab(void)
12 free(a);
13 regfree(&pat_inittab);
14 }
15+
16+/*Implementation of Marvell Fast Boot routine*/
17+void mrvl_fast_boot()
18+{
19+ char *init[] = { "/etc/telinit", NULL };
20+ int i, pid;
21+
22+ pid = fork();
23+ if (!pid) {
24+ execvp(init[0], init);
25+ ERROR("Failed to start telinit\n");
26+ exit(-1);
27+ }
28+ if (pid <= 0) {
29+ ERROR("Failed to start new telinit instance\n");
30+ return;
31+ } else {
32+ for (i = 0; i < 200; i++) {
33+ if (waitpid(pid, NULL, WNOHANG) > 0)
34+ break;
35+ usleep(10 * 1000);
36+ }
37+ }
38+}
39+
40--- a/procd.h
41+++ b/procd.h
42@@ -46,6 +46,7 @@ void procd_inittab(void);
43 void procd_inittab_run(const char *action);
44 void procd_inittab_kill(void);
45 void procd_bcast_event(char *event, struct blob_attr *msg);
46+void mrvl_fast_boot(void);
47
48 struct trigger;
49 void trigger_event(const char *type, struct blob_attr *data);
50--- a/state.c
51+++ b/state.c
52@@ -137,6 +137,8 @@ static void state_enter(void)
53 break;
54
55 case STATE_UBUS:
56+ LOG("- telinit -\n");
57+ mrvl_fast_boot();
58 // try to reopen incase the wdt was not available before coldplug
59 watchdog_init(0);
60 set_stdio("console");