[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [BusyBox] CML2 configuration for BusyBox
From: Scott Murray <scottm () somanetworks ! com>
Date: 2001-05-29 15:27:07
[Download RAW message or body]
Tom Oehser wrote:
>
> Yes, I'm interested. I use busybox for many things on tomsrtbt, but I
> have stuck with sysvinit-2.60, so I don't want any of the other utilities
> to be dependent on the init. -Thanks! -Tom
Okay, I'm attaching my reboot without init patch. There are two caveats.
The first is that I've not built it against anything other than glibc, but
I think it should work with uClibc. The second is that my change to busybox.h
to define bb_reboot probably could be better. It would be cleaner to only
have one set of #ifdef logic by replacing the init_reboot stuff in init.c
with bb_reboot, and just define bb_reboot always. The reason it's not this
way is that I wrote my original patch before libbb existed, and I just kind
of followed the path of least resistance when merging with 0.51.
Scott
--
Scott Murray
SOMA Networks, Inc.
Toronto, Ontario
e-mail: scottm@somanetworks.com
["busybox-reboot-patches" (text/plain)]
diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet \
busybox-0.51/busybox.h trans-gate/src/npm/ramdisk/busybox/busybox.h
--- busybox-0.51/busybox.h Tue Mar 27 13:22:00 2001
+++ trans-gate/src/npm/ramdisk/busybox/busybox.h Mon Apr 30 17:37:37 2001
@@ -37,6 +37,22 @@
#include <features.h>
+/* Define bb_reboot for reboot related commands if init is not being used */
+#ifndef BB_INIT
+#include <linux/reboot.h>
+#if defined(__GLIBC__) || defined (__UCLIBC__)
+#include <sys/reboot.h>
+#define bb_reboot(flag) reboot(flag)
+#else
+#define bb_reboot(flag) reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, flag)
+#define RB_AUTOBOOT LINUX_REBOOT_CMD_RESTART
+#define RB_HALT_SYSTEM LINUX_REBOOT_CMD_HALT
+#endif
+#ifndef RB_POWER_OFF
+#define RB_POWER_OFF LINUX_REBOOT_CMD_POWER_OFF
+#endif
+#endif /* BB_INIT */
+
enum Location {
_BB_DIR_ROOT = 0,
diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet busybox-0.51/halt.c \
trans-gate/src/npm/ramdisk/busybox/halt.c
--- busybox-0.51/halt.c Thu Dec 7 14:56:48 2000
+++ trans-gate/src/npm/ramdisk/busybox/halt.c Mon Apr 30 17:37:37 2001
@@ -26,10 +26,14 @@
extern int halt_main(int argc, char **argv)
{
+#ifdef BB_INIT
#ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */
return(kill(*(find_pid_by_name("init")), SIGUSR1));
#else
return(kill(1, SIGUSR1));
+#endif
+#else
+ return(bb_reboot(RB_HALT_SYSTEM));
#endif
}
diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet \
busybox-0.51/poweroff.c trans-gate/src/npm/ramdisk/busybox/poweroff.c
--- busybox-0.51/poweroff.c Thu Dec 7 14:56:48 2000
+++ trans-gate/src/npm/ramdisk/busybox/poweroff.c Mon Apr 30 17:37:37 2001
@@ -26,10 +26,15 @@
extern int poweroff_main(int argc, char **argv)
{
+#ifdef BB_INIT
#ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */
return(kill(*(find_pid_by_name("init")), SIGUSR2));
#else
return(kill(1, SIGUSR2));
#endif
+#else
+ return(bb_reboot(RB_POWER_OFF));
+#endif
}
+
diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet \
busybox-0.51/reboot.c trans-gate/src/npm/ramdisk/busybox/reboot.c
--- busybox-0.51/reboot.c Tue Apr 3 14:01:51 2001
+++ trans-gate/src/npm/ramdisk/busybox/reboot.c Mon Apr 30 17:37:38 2001
@@ -26,11 +26,15 @@
extern int reboot_main(int argc, char **argv)
{
+#ifdef BB_INIT
#ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */
return(kill(*(find_pid_by_name("init")), SIGTERM));
#else
return(kill(1, SIGTERM));
+#endif
+#else
+ return(bb_reboot(RB_AUTOBOOT));
#endif
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic