From c00cec7bd1aeeea95ab8aaa2aaf37ada333edca7 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 26 Nov 2006 01:03:21 +0000 Subject: [PATCH] add reboot fix for mtd (thanks, wbx) SVN-Revision: 5645 --- openwrt/package/mtd/Makefile | 2 +- openwrt/package/mtd/mtd.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/openwrt/package/mtd/Makefile b/openwrt/package/mtd/Makefile index 75e6e7de48..4e0ac28671 100644 --- a/openwrt/package/mtd/Makefile +++ b/openwrt/package/mtd/Makefile @@ -3,7 +3,7 @@ include $(TOPDIR)/rules.mk PKG_NAME := mtd -PKG_RELEASE := 4 +PKG_RELEASE := 5 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) diff --git a/openwrt/package/mtd/mtd.c b/openwrt/package/mtd/mtd.c index 1e9d316e4c..37bd4edc80 100644 --- a/openwrt/package/mtd/mtd.c +++ b/openwrt/package/mtd/mtd.c @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include #include #include @@ -41,6 +43,7 @@ #include #include +#include #define TRX_MAGIC 0x30524448 /* "HDR0" */ #define BUFSIZE (16 * 1024) @@ -473,8 +476,9 @@ int main (int argc, char **argv) sync(); - if (boot) - kill(1, 15); // send SIGTERM to init for reboot - + if (boot) { + fflush(stdout); + syscall(SYS_reboot,LINUX_REBOOT_MAGIC1,LINUX_REBOOT_MAGIC2,LINUX_REBOOT_CMD_RESTART,NULL); + } return 0; } -- 2.30.2