diff options
Diffstat (limited to 'init/init.c')
-rw-r--r-- | init/init.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/init/init.c b/init/init.c index 25bfaec8c..6eb76b80e 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -16,10 +16,21 @@ | |||
16 | //config: help | 16 | //config: help |
17 | //config: init is the first program run when the system boots. | 17 | //config: init is the first program run when the system boots. |
18 | //config: | 18 | //config: |
19 | //config:config LINUXRC | ||
20 | //config: bool "Support running init from within an initrd (not initramfs)" | ||
21 | //config: default y | ||
22 | //config: select FEATURE_SYSLOG | ||
23 | //config: help | ||
24 | //config: Legacy support for running init under the old-style initrd. Allows | ||
25 | //config: the name linuxrc to act as init, and it doesn't assume init is PID 1. | ||
26 | //config: | ||
27 | //config: This does not apply to initramfs, which runs /init as PID 1 and | ||
28 | //config: requires no special support. | ||
29 | //config: | ||
19 | //config:config FEATURE_USE_INITTAB | 30 | //config:config FEATURE_USE_INITTAB |
20 | //config: bool "Support reading an inittab file" | 31 | //config: bool "Support reading an inittab file" |
21 | //config: default y | 32 | //config: default y |
22 | //config: depends on INIT | 33 | //config: depends on INIT || LINUXRC |
23 | //config: help | 34 | //config: help |
24 | //config: Allow init to read an inittab file when the system boot. | 35 | //config: Allow init to read an inittab file when the system boot. |
25 | //config: | 36 | //config: |
@@ -46,7 +57,7 @@ | |||
46 | //config:config FEATURE_INIT_SCTTY | 57 | //config:config FEATURE_INIT_SCTTY |
47 | //config: bool "Run commands with leading dash with controlling tty" | 58 | //config: bool "Run commands with leading dash with controlling tty" |
48 | //config: default y | 59 | //config: default y |
49 | //config: depends on INIT | 60 | //config: depends on INIT || LINUXRC |
50 | //config: help | 61 | //config: help |
51 | //config: If this option is enabled, init will try to give a controlling | 62 | //config: If this option is enabled, init will try to give a controlling |
52 | //config: tty to any command which has leading hyphen (often it's "-/bin/sh"). | 63 | //config: tty to any command which has leading hyphen (often it's "-/bin/sh"). |
@@ -61,40 +72,29 @@ | |||
61 | //config:config FEATURE_INIT_SYSLOG | 72 | //config:config FEATURE_INIT_SYSLOG |
62 | //config: bool "Enable init to write to syslog" | 73 | //config: bool "Enable init to write to syslog" |
63 | //config: default y | 74 | //config: default y |
64 | //config: depends on INIT | 75 | //config: depends on INIT || LINUXRC |
65 | //config: | 76 | //config: |
66 | //config:config FEATURE_EXTRA_QUIET | 77 | //config:config FEATURE_EXTRA_QUIET |
67 | //config: bool "Be _extra_ quiet on boot" | 78 | //config: bool "Be _extra_ quiet on boot" |
68 | //config: default y | 79 | //config: default y |
69 | //config: depends on INIT | 80 | //config: depends on INIT || LINUXRC |
70 | //config: help | 81 | //config: help |
71 | //config: Prevent init from logging some messages to the console during boot. | 82 | //config: Prevent init from logging some messages to the console during boot. |
72 | //config: | 83 | //config: |
73 | //config:config FEATURE_INIT_COREDUMPS | 84 | //config:config FEATURE_INIT_COREDUMPS |
74 | //config: bool "Support dumping core for child processes (debugging only)" | 85 | //config: bool "Support dumping core for child processes (debugging only)" |
75 | //config: default y | 86 | //config: default y |
76 | //config: depends on INIT | 87 | //config: depends on INIT || LINUXRC |
77 | //config: help | 88 | //config: help |
78 | //config: If this option is enabled and the file /.init_enable_core | 89 | //config: If this option is enabled and the file /.init_enable_core |
79 | //config: exists, then init will call setrlimit() to allow unlimited | 90 | //config: exists, then init will call setrlimit() to allow unlimited |
80 | //config: core file sizes. If this option is disabled, processes | 91 | //config: core file sizes. If this option is disabled, processes |
81 | //config: will not generate any core files. | 92 | //config: will not generate any core files. |
82 | //config: | 93 | //config: |
83 | //config:config FEATURE_INITRD | ||
84 | //config: bool "Support running init from within an initrd (not initramfs)" | ||
85 | //config: default y | ||
86 | //config: depends on INIT | ||
87 | //config: help | ||
88 | //config: Legacy support for running init under the old-style initrd. Allows | ||
89 | //config: the name linuxrc to act as init, and it doesn't assume init is PID 1. | ||
90 | //config: | ||
91 | //config: This does not apply to initramfs, which runs /init as PID 1 and | ||
92 | //config: requires no special support. | ||
93 | //config: | ||
94 | //config:config INIT_TERMINAL_TYPE | 94 | //config:config INIT_TERMINAL_TYPE |
95 | //config: string "Initial terminal type" | 95 | //config: string "Initial terminal type" |
96 | //config: default "linux" | 96 | //config: default "linux" |
97 | //config: depends on INIT | 97 | //config: depends on INIT || LINUXRC |
98 | //config: help | 98 | //config: help |
99 | //config: This is the initial value set by init for the TERM environment | 99 | //config: This is the initial value set by init for the TERM environment |
100 | //config: variable. This variable is used by programs which make use of | 100 | //config: variable. This variable is used by programs which make use of |
@@ -106,7 +106,7 @@ | |||
106 | //config:config FEATURE_INIT_MODIFY_CMDLINE | 106 | //config:config FEATURE_INIT_MODIFY_CMDLINE |
107 | //config: bool "Modify the command-line to \"init\"" | 107 | //config: bool "Modify the command-line to \"init\"" |
108 | //config: default y | 108 | //config: default y |
109 | //config: depends on INIT | 109 | //config: depends on INIT || LINUXRC |
110 | //config: help | 110 | //config: help |
111 | //config: When launched as PID 1 and after parsing its arguments, init | 111 | //config: When launched as PID 1 and after parsing its arguments, init |
112 | //config: wipes all the arguments but argv[0] and rewrites argv[0] to | 112 | //config: wipes all the arguments but argv[0] and rewrites argv[0] to |
@@ -119,9 +119,10 @@ | |||
119 | //config: retrieved in /proc/1/cmdline on Linux, for example. | 119 | //config: retrieved in /proc/1/cmdline on Linux, for example. |
120 | 120 | ||
121 | //applet:IF_INIT(APPLET(init, BB_DIR_SBIN, BB_SUID_DROP)) | 121 | //applet:IF_INIT(APPLET(init, BB_DIR_SBIN, BB_SUID_DROP)) |
122 | //applet:IF_FEATURE_INITRD(APPLET_ODDNAME(linuxrc, init, BB_DIR_ROOT, BB_SUID_DROP, linuxrc)) | 122 | //applet:IF_LINUXRC(APPLET_ODDNAME(linuxrc, init, BB_DIR_ROOT, BB_SUID_DROP, linuxrc)) |
123 | 123 | ||
124 | //kbuild:lib-$(CONFIG_INIT) += init.o | 124 | //kbuild:lib-$(CONFIG_INIT) += init.o |
125 | //kbuild:lib-$(CONFIG_LINUXRC) += init.o | ||
125 | 126 | ||
126 | #define DEBUG_SEGV_HANDLER 0 | 127 | #define DEBUG_SEGV_HANDLER 0 |
127 | 128 | ||
@@ -1057,7 +1058,7 @@ int init_main(int argc UNUSED_PARAM, char **argv) | |||
1057 | if (!DEBUG_INIT) { | 1058 | if (!DEBUG_INIT) { |
1058 | /* Expect to be invoked as init with PID=1 or be invoked as linuxrc */ | 1059 | /* Expect to be invoked as init with PID=1 or be invoked as linuxrc */ |
1059 | if (getpid() != 1 | 1060 | if (getpid() != 1 |
1060 | && (!ENABLE_FEATURE_INITRD || applet_name[0] != 'l') /* not linuxrc? */ | 1061 | && (!ENABLE_LINUXRC || applet_name[0] != 'l') /* not linuxrc? */ |
1061 | ) { | 1062 | ) { |
1062 | bb_error_msg_and_die("must be run as PID 1"); | 1063 | bb_error_msg_and_die("must be run as PID 1"); |
1063 | } | 1064 | } |