| --- 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"); |