aboutsummaryrefslogtreecommitdiff
path: root/init/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'init/main.c')
-rw-r--r--init/main.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/init/main.c b/init/main.c
index 4d4d1659795..2deae100e2a 100644
--- a/init/main.c
+++ b/init/main.c
@@ -113,6 +113,11 @@ EXPORT_SYMBOL(system_state);
*/
#define MAX_INIT_ARGS CONFIG_INIT_ENV_ARG_LIMIT
#define MAX_INIT_ENVS CONFIG_INIT_ENV_ARG_LIMIT
+#ifdef CONFIG_INIT_PASS_ALL_PARAMS
+#define INIT_PASS_FUNCTION pass_all_bootoptions
+#else
+#define INIT_PASS_FUNCTION pass_unknown_bootoptions
+#endif
extern void time_init(void);
/* Default late time init is NULL. archs can override this later. */
@@ -227,7 +232,7 @@ static int __init loglevel(char *str)
early_param("loglevel", loglevel);
/* Change NUL term back to "=", to make "param" the whole string. */
-static int __init repair_env_string(char *param, char *val, const char *unused)
+static int __init repair_env_string(char *param, char *val, const char *unused, int known)
{
if (val) {
/* param=val or param="val"? */
@@ -244,19 +249,20 @@ static int __init repair_env_string(char *param, char *val, const char *unused)
}
/*
- * Unknown boot options get handed to init, unless they look like
- * unused parameters (modprobe will find them in /proc/cmdline).
+ * Select boot options to hand to init. If all is set hand off them all
+ * otherwise only hand off unused ones which do not apply to modules
+ * (modprobe will find them in /proc/cmdline).
*/
-static int __init unknown_bootoption(char *param, char *val, const char *unused)
+static int __init pass_bootoption(char *param, char *val, const char *unused, int all)
{
- repair_env_string(param, val, unused);
+ repair_env_string(param, val, unused, all);
/* Handle obsolete-style parameters */
- if (obsolete_checksetup(param))
+ if (obsolete_checksetup(param) && !all)
return 0;
/* Unused module parameter. */
- if (strchr(param, '.') && (!val || strchr(param, '.') < val))
+ if (!all && strchr(param, '.') && (!val || strchr(param, '.') < val))
return 0;
if (panic_later)
@@ -287,6 +293,16 @@ static int __init unknown_bootoption(char *param, char *val, const char *unused)
}
return 0;
}
+static int __init pass_unknown_bootoptions(char *param, char *val, const char *unused, int known)
+{
+ if (known)
+ return 0;
+ return pass_bootoption(param, val, unused, 0);
+}
+static int __init pass_all_bootoptions(char *param, char *val, const char *unused, int known)
+{
+ return pass_bootoption(param, val, unused, 1);
+}
static int __init init_setup(char *str)
{
@@ -386,10 +402,13 @@ static noinline void __init_refok rest_init(void)
}
/* Check for early params. */
-static int __init do_early_param(char *param, char *val, const char *unused)
+static int __init do_early_param(char *param, char *val, const char *unused, int known)
{
const struct obs_kernel_param *p;
+ if (known)
+ return 0;
+
for (p = __setup_start; p < __setup_end; p++) {
if ((p->early && parameq(param, p->str)) ||
(strcmp(param, "console") == 0 &&
@@ -513,7 +532,7 @@ asmlinkage void __init start_kernel(void)
parse_early_param();
parse_args("Booting kernel", static_command_line, __start___param,
__stop___param - __start___param,
- -1, -1, &unknown_bootoption);
+ -1, -1, &INIT_PASS_FUNCTION);
jump_label_init();