Change default reboot to SOC reset from WDT reset

Fixes #460

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2025-12-07 09:38:13 +01:00
1 parent 4e18affa9b
commit 178301baf2
5 files changed
+44 -12

No files matched your search

+6
View File
@@ -60,6 +60,7 @@ int single = 0; /* single user mode from kernel cmdline */
int bootstrap = 1; /* set while bootstrapping (for TTYs) */
int kerndebug = 0; /* set if /proc/sys/kernel/printk > 7 */
int syncsec = 0; /* reboot delay */
int wdtreboot = 0; /* reboot via watchdog, default: SOC */
int readiness = SVC_NOTIFY_PID;
char *finit_conf= NULL;
char *finit_rcsd= NULL;
@@ -1034,6 +1035,11 @@ static int parse_static(char *line, int is_rcsd)
return 0;
}
if (MATCH_CMD(line, "reboot-watchdog ", x)) {
wdtreboot = get_bool(strip_line(x), 0);
return 0;
}
/*
* Periodic check and instability index leveler, seconds
*/
+1
View File
@@ -37,6 +37,7 @@ extern int single;
extern int bootstrap;
extern int kerndebug;
extern int syncsec;
extern int wdtreboot;
extern int readiness;
extern char *fstab;
extern char *sdown;
+4 -4
View File
@@ -358,7 +358,7 @@ void do_shutdown(shutop_t op)
return;
}
if (wdog) {
if (wdtreboot && wdog) {
print(kill(wdog->pid, SIGPWR) == 1, "Advising watchdog, system going down");
do_sleep(2);
}
@@ -405,17 +405,17 @@ void do_shutdown(shutop_t op)
/* Reboot via watchdog or kernel, or shutdown? */
if (op == SHUT_REBOOT) {
print(0, "Rebooting ...");
if (wdog && wdog->pid > 1) {
if (wdtreboot && wdog && wdog->pid > 1) {
int timeout = 10;
/* Wait here until the WDT reboots, or timeout with fallback */
print(0, "Rebooting using WDT, please wait ...");
print(kill(wdog->pid, SIGTERM) == 1, "Pending watchdog reboot");
while (timeout--)
do_sleep(1);
}
dbg("Rebooting ...");
print(0, "Rebooting ...");
reboot(RB_AUTOBOOT);
} else if (op == SHUT_OFF) {
print(0, "Powering down ...");