summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2008-11-28 10:11:26 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2008-11-28 10:11:26 +1100
commit9d3c1c0980888b1543c31a922c73dcd5d8e7ad36 (patch)
tree06efa0a9b76076338cf5bdd2a7786f7046bf7497 /init
parent405ad8e9e3eb4e0b07562bdbbcfe5aee642b2f74 (diff)
param:core_param-really-really-early
As soon as we have command line, so even before early_param. They just set vars, so it makes sense to do them as early as possible. This allows them to replace early_param, and fixes a bug in the new cpu_alloc implementation patches which was a complete PITA to find. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'init')
-rw-r--r--init/main.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/init/main.c b/init/main.c
index 7e117a231af1..6245758dcfb1 100644
--- a/init/main.c
+++ b/init/main.c
@@ -256,12 +256,32 @@ static int __init loglevel(char *str)
early_param("loglevel", loglevel);
+static bool __init is_core_param(const char *param)
+{
+ const struct kernel_param *i;
+
+ for (i = __start___core_param; i < __stop___core_param; i++)
+ if (strcmp(param, i->name) == 0)
+ return true;
+ return false;
+}
+
+/* We can ignore options not found in core params. */
+static int __init unknown_core_ok(char *param, char *val)
+{
+ return 0;
+}
+
/*
* Unknown boot options get handed to init, unless they look like
* failed parameters
*/
static int __init unknown_bootoption(char *param, char *val)
{
+ /* Already handled as a core param? */
+ if (is_core_param(param))
+ return 0;
+
/* Change NUL term back to "=", to make "param" the whole string. */
if (val) {
/* param=val or param="val"? */
@@ -542,7 +562,6 @@ void __init __weak thread_info_cache_init(void)
asmlinkage void __init start_kernel(void)
{
char * command_line;
- extern struct kernel_param __start___param[], __stop___param[];
smp_setup_processor_id();
@@ -572,6 +591,10 @@ asmlinkage void __init start_kernel(void)
setup_arch(&command_line);
mm_init_owner(&init_mm, &init_task);
setup_command_line(command_line);
+ parse_args("Core params", command_line, __start___core_param,
+ __stop___core_param - __start___core_param,
+ unknown_core_ok);
+
unwind_setup();
setup_per_cpu_areas();
setup_nr_cpu_ids();