path: root/kernel
diff options
authorAndy Whitcroft <apw@canonical.com>2010-06-17 10:46:47 +0100
committerJohn Rigby <john.rigby@linaro.org>2011-11-16 14:22:45 -0700
commit2d8746e0f0215f9b929fd32375b7e746dcc2690a (patch)
tree03053abacbb981b219d904b731d291de3b200c45 /kernel
parent422557e41bb52a42de41b32d5254f44fa648f469 (diff)
UBUNTU: SAUCE: add option to hand off all kernel parameters to init
BugLink: http://bugs.launchpad.net/bugs/586386 Some init packages such as upstart find having all of the kernel parameters passed in useful. Currently they have to open up /proc/cmdline and reparse that to obtain this information. Add a kernel configuration option to enable passing of all options. Note, enabling this option will reduce the chances that a fallback from /sbin/init to /bin/bash or /bin/sh will succeed. Though it should be noted that there are commonly unknown options present which would already break this fallback. init=/bin/foo provides explicit control over options which is unaffected by this change. Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
Diffstat (limited to 'kernel')
1 files changed, 14 insertions, 6 deletions
diff --git a/kernel/params.c b/kernel/params.c
index 22df3e0d142..f7cae95b7a9 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -87,7 +87,7 @@ static int parse_one(char *param,
char *val,
const struct kernel_param *params,
unsigned num_params,
- int (*handle_unknown)(char *param, char *val))
+ int (*handle_arg)(char *param, char *val, int known))
unsigned int i;
int err;
@@ -98,6 +98,14 @@ static int parse_one(char *param,
/* No one handled NULL, so do it here. */
if (!val && params[i].ops->set != param_set_bool)
return -EINVAL;
+ if (handle_arg) {
+ int ret;
+ DEBUGP("Valid argument: calling %p\n",
+ handle_arg);
+ ret = handle_arg(param, val, 1);
+ if (ret)
+ return ret;
+ }
DEBUGP("They are equal! Calling %p\n",
@@ -107,9 +115,9 @@ static int parse_one(char *param,
- if (handle_unknown) {
- DEBUGP("Unknown argument: calling %p\n", handle_unknown);
- return handle_unknown(param, val);
+ if (handle_arg) {
+ DEBUGP("Unknown argument: calling %p\n", handle_arg);
+ return handle_arg(param, val, 0);
DEBUGP("Unknown argument `%s'\n", param);
@@ -173,7 +181,7 @@ int parse_args(const char *name,
char *args,
const struct kernel_param *params,
unsigned num,
- int (*unknown)(char *param, char *val))
+ int (*handle_arg)(char *param, char *val, int arg))
char *param, *val;
@@ -188,7 +196,7 @@ int parse_args(const char *name,
args = next_arg(args, &param, &val);
irq_was_disabled = irqs_disabled();
- ret = parse_one(param, val, params, num, unknown);
+ ret = parse_one(param, val, params, num, handle_arg);
if (irq_was_disabled && !irqs_disabled()) {
printk(KERN_WARNING "parse_args(): option '%s' enabled "
"irq's!\n", param);