Hi,
I have studied how Openwrt's procd works including the /sbin/init process.
I would like to use procd's /sbin/init to mount the kernel filesystems and load modules. Then procd's init should exec the init of a debian installation (on a USB), instead of exec /sbin/procd.
Below patch allows me to use openwrt menuconfig for building an image for the above purpose. (I also support disabling procd's watchdog because I intend to use debian's.)
Where do I make a PR so that these procd configuration options can be supported in openwrt?
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4b3eebd..cde232e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,6 +35,14 @@ IF(EARLY_PATH)
ADD_DEFINITIONS(-DEARLY_PATH="${EARLY_PATH}")
ENDIF()
+IF(WATCHDOG_DISABLE)
+ ADD_DEFINITIONS(-DWATCHDOG_DISABLE)
+ENDIF()
+
+IF(PROCD_CUSTOM_SPAWN_PATH)
+ ADD_DEFINITIONS(-DPROCD_CUSTOM_SPAWN_PATH="${PROCD_CUSTOM_SPAWN_PATH}")
+ENDIF()
+
IF(ZRAM_TMPFS)
ADD_DEFINITIONS(-DZRAM_TMPFS)
SET(SOURCES_ZRAM initd/zram.c)
diff --git a/initd/init.c b/initd/init.c
index 0349e6e..80ff067 100644
--- a/initd/init.c
+++ b/initd/init.c
@@ -80,7 +80,11 @@ main(int argc, char **argv)
early();
cmdline();
+#ifndef WATCHDOG_DISABLE
watchdog_init(1);
+#endif
+ //watchdog_set_magicclose(true);
+ //watchdog_set_stopped(true);
pid = fork();
if (!pid) {
diff --git a/initd/preinit.c b/initd/preinit.c
index fbb36df..34952b2 100644
--- a/initd/preinit.c
+++ b/initd/preinit.c
@@ -91,7 +91,10 @@ static void
spawn_procd(struct uloop_process *proc, int ret)
{
char *wdt_fd = watchdog_fd();
- char *argv[] = { "/sbin/procd", NULL};
+#ifndef PROCD_CUSTOM_SPAWN_PATH
+#define PROCD_CUSTOM_SPAWN_PATH "/sbin/procd"
+#endif
+ char *argv[] = { PROCD_CUSTOM_SPAWN_PATH, NULL};
char dbg[2];
if (plugd_proc.pid > 0)
Thanks.