diff options
author | Eric Andersen | 2001-10-24 05:00:29 +0000 |
---|---|---|
committer | Eric Andersen | 2001-10-24 05:00:29 +0000 |
commit | bdfd0d78bc44e73d693510e70087857785b3b521 (patch) | |
tree | 153a573095afac8d8d0ea857759ecabd77fb28b7 /init | |
parent | 9260fc5552a3ee52eb95823aa6689d52a1ffd33c (diff) | |
download | busybox-bdfd0d78bc44e73d693510e70087857785b3b521.zip busybox-bdfd0d78bc44e73d693510e70087857785b3b521.tar.gz |
Major rework of the directory structure and the entire build system.
-Erik
Diffstat (limited to 'init')
-rw-r--r-- | init/Makefile | 39 | ||||
-rw-r--r-- | init/config.in | 25 | ||||
-rw-r--r-- | init/halt.c | 2 | ||||
-rw-r--r-- | init/init.c | 32 | ||||
-rw-r--r-- | init/poweroff.c | 2 | ||||
-rw-r--r-- | init/reboot.c | 2 |
6 files changed, 83 insertions, 19 deletions
diff --git a/init/Makefile b/init/Makefile new file mode 100644 index 0000000..472fb02 --- /dev/null +++ b/init/Makefile @@ -0,0 +1,39 @@ +# Makefile for busybox +# +# Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +TOPDIR :=.. +L_TARGET := init.a + +obj-y := +obj-n := +obj- := + +obj-$(CONFIG_HALT) += halt.o +obj-$(CONFIG_INIT) += init.o +obj-$(CONFIG_POWEROFF) += poweroff.o +obj-$(CONFIG_REBOOT) += reboot.o +obj-$(CONFIG_START_STOP_DAEMON) += start_stop_daemon.o + + +# Hand off to toplevel Rules.mak +include $(TOPDIR)/Rules.mak + +clean: + rm -f $(L_TARGET) *.o core + diff --git a/init/config.in b/init/config.in new file mode 100644 index 0000000..1d4760c --- /dev/null +++ b/init/config.in @@ -0,0 +1,25 @@ +# +# For a description of the syntax of this configuration file, +# see scripts/kbuild/config-language.txt. +# + +mainmenu_option next_comment +comment 'Init Utilities' + + +bool 'init' CONFIG_INIT +if [ "$CONFIG_INIT" = "y" ]; then + bool ' Support reading an inittab file?' CONFIG_FEATURE_USE_INITTAB + bool ' Support running init from within an initrd?' CONFIG_FEATURE_INITRD + bool ' Support dumping core for child processes (debugging only)?' CONFIG_FEATURE_INIT_COREDUMPS + bool ' Should init be _extra_ quiet on boot?' CONFIG_FEATURE_EXTRA_QUIET + + # Some more apps that are meaningless without BusyBox running as init + bool 'halt' CONFIG_HALT + bool 'poweroff' CONFIG_POWEROFF + bool 'reboot' CONFIG_REBOOT + bool 'start-stop-daemon' CONFIG_START_STOP_DAEMON +fi + +endmenu + diff --git a/init/halt.c b/init/halt.c index d66e28d..307c102 100644 --- a/init/halt.c +++ b/init/halt.c @@ -26,7 +26,7 @@ extern int halt_main(int argc, char **argv) { -#ifdef BB_FEATURE_LINUXRC +#ifdef CONFIG_FEATURE_INITRD /* don't assume init's pid == 1 */ pid_t *pid = find_pid_by_name("init"); if (!pid || *pid<=0) { diff --git a/init/init.c b/init/init.c index 068e1df..b6eaa46 100644 --- a/init/init.c +++ b/init/init.c @@ -43,7 +43,7 @@ #include <sys/types.h> #include <sys/wait.h> #include "busybox.h" -#ifdef BB_SYSLOGD +#ifdef CONFIG_SYSLOGD # include <sys/syslog.h> #endif @@ -96,7 +96,7 @@ static const int RB_AUTOBOOT = 0x01234567; #endif -#if defined BB_FEATURE_INIT_COREDUMPS +#if defined CONFIG_FEATURE_INIT_COREDUMPS /* * When a file named CORE_ENABLE_FLAG_FILE exists, setrlimit is called * before processes are spawned to set core file size as unlimited. @@ -194,7 +194,7 @@ static void message(int device, char *fmt, ...) va_list arguments; int fd; -#ifdef BB_SYSLOGD +#ifdef CONFIG_SYSLOGD /* Log the message to syslogd */ if (device & LOG) { @@ -546,7 +546,7 @@ static pid_t run(char *command, char *terminal, int get_enter) getpid(), terminal, command); #endif -#if defined BB_FEATURE_INIT_COREDUMPS +#if defined CONFIG_FEATURE_INIT_COREDUMPS if (stat (CORE_ENABLE_FLAG_FILE, &sb) == 0) { struct rlimit limit; limit.rlim_cur = RLIM_INFINITY; @@ -701,7 +701,7 @@ static void ctrlaltdel_signal(int sig) static void new_initAction(initActionEnum action, char *process, char *cons) { initAction *newAction; -#ifdef BB_FEATURE_INIT_NORMAL_ORDER +#ifdef CONFIG_FEATURE_INIT_NORMAL_ORDER initAction *a; #endif @@ -723,7 +723,7 @@ static void new_initAction(initActionEnum action, char *process, char *cons) message(LOG | CONSOLE, "Memory allocation failure\n"); loop_forever(); } -#ifdef BB_FEATURE_INIT_NORMAL_ORDER +#ifdef CONFIG_FEATURE_INIT_NORMAL_ORDER for (a = initActionList; a && a->nextPtr; a = a->nextPtr) ; if (a) { a->nextPtr = newAction; @@ -759,16 +759,16 @@ static void delete_initAction(initAction * action) } } -/* NOTE that if BB_FEATURE_USE_INITTAB is NOT defined, +/* NOTE that if CONFIG_FEATURE_USE_INITTAB is NOT defined, * then parse_inittab() simply adds in some default * actions(i.e., runs INIT_SCRIPT and then starts a pair - * of "askfirst" shells). If BB_FEATURE_USE_INITTAB + * of "askfirst" shells). If CONFIG_FEATURE_USE_INITTAB * _is_ defined, but /etc/inittab is missing, this * results in the same set of default behaviors. * */ static void parse_inittab(void) { -#ifdef BB_FEATURE_USE_INITTAB +#ifdef CONFIG_FEATURE_USE_INITTAB FILE *file; char buf[256], lineAsRead[256], tmpConsole[256]; char *id, *runlev, *action, *process, *eol; @@ -782,7 +782,7 @@ static void parse_inittab(void) #endif /* Reboot on Ctrl-Alt-Del */ new_initAction(CTRLALTDEL, "/sbin/reboot", console); -#ifdef BB_FEATURE_INIT_NORMAL_ORDER +#ifdef CONFIG_FEATURE_INIT_NORMAL_ORDER /* Umount all filesystems on halt/reboot */ new_initAction(SHUTDOWN, "/bin/umount -a -r", console); /* Swapoff on halt/reboot */ @@ -808,7 +808,7 @@ static void parse_inittab(void) new_initAction(SYSINIT, INIT_SCRIPT, console); return; -#ifdef BB_FEATURE_USE_INITTAB +#ifdef CONFIG_FEATURE_USE_INITTAB } while (fgets(buf, 255, file) != NULL) { @@ -880,7 +880,7 @@ static void parse_inittab(void) } } return; -#endif /* BB_FEATURE_USE_INITTAB */ +#endif /* CONFIG_FEATURE_USE_INITTAB */ } @@ -894,7 +894,7 @@ extern int init_main(int argc, char **argv) #ifndef DEBUG_INIT /* Expect to be invoked as init with PID=1 or be invoked as linuxrc */ if (getpid() != 1 -#ifdef BB_FEATURE_LINUXRC +#ifdef CONFIG_FEATURE_INITRD && strstr(applet_name, "linuxrc") == NULL #endif ) @@ -933,14 +933,14 @@ extern int init_main(int argc, char **argv) /* Hello world */ #ifndef DEBUG_INIT message( -#if ! defined BB_FEATURE_EXTRA_QUIET +#if ! defined CONFIG_FEATURE_EXTRA_QUIET CONSOLE| #endif LOG, "init started: %s\r\n", full_version); #else message( -#if ! defined BB_FEATURE_EXTRA_QUIET +#if ! defined CONFIG_FEATURE_EXTRA_QUIET CONSOLE| #endif LOG, @@ -966,7 +966,7 @@ extern int init_main(int argc, char **argv) } else { /* Not in single user mode -- see what inittab says */ - /* NOTE that if BB_FEATURE_USE_INITTAB is NOT defined, + /* NOTE that if CONFIG_FEATURE_USE_INITTAB is NOT defined, * then parse_inittab() simply adds in some default * actions(i.e., runs INIT_SCRIPT and then starts a pair * of "askfirst" shells */ diff --git a/init/poweroff.c b/init/poweroff.c index db20a45..cec2d6d 100644 --- a/init/poweroff.c +++ b/init/poweroff.c @@ -26,7 +26,7 @@ extern int poweroff_main(int argc, char **argv) { -#ifdef BB_FEATURE_LINUXRC +#ifdef CONFIG_FEATURE_INITRD /* don't assume init's pid == 1 */ pid_t *pid = find_pid_by_name("init"); if (!pid || *pid<=0) { diff --git a/init/reboot.c b/init/reboot.c index 35afd74..a13d424 100644 --- a/init/reboot.c +++ b/init/reboot.c @@ -26,7 +26,7 @@ extern int reboot_main(int argc, char **argv) { -#ifdef BB_FEATURE_LINUXRC +#ifdef CONFIG_FEATURE_INITRD /* don't assume init's pid == 1 */ pid_t *pid = find_pid_by_name("init"); if (!pid || *pid<=0) { |