Re: [PATCH] disable builtin modules
On Sun, 20 Mar 2005 10:51:41 +0100 (MET), Jan Engelhardt <[EMAIL PROTECTED]> wrote: > > >This patch makes it possible to disable built in code from the kernel > >command line. The patch is rather simple - it extends the compiled-in case > >of module_init() to include __setup() with a name based on KBUILD_MODNAME. > > What if there is already an option like the modname? I do not know of any > code that currently does so, but you never know. > > Are acpi= and apm= already what your patch wants to extend to other modules? > If not, there's conflict. There is a conflict. Thanks for pointing that out. Both the obsolete __setup() parameter code and the module parameter code in kernel/params.c are limited to a single matching parameter. The first matching parameter will be used, and non-early obsoleted parameters are overridden by module parameter code. If I understand the code correctly that is. =) Maybe it is possible to (mis)use early_param instead of __setup and let these parameters become "high priority" parameters that only are parsed by do_early_param()...? / magnus - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] disable builtin modules
>This patch makes it possible to disable built in code from the kernel >command line. The patch is rather simple - it extends the compiled-in case >of module_init() to include __setup() with a name based on KBUILD_MODNAME. What if there is already an option like the modname? I do not know of any code that currently does so, but you never know. Are acpi= and apm= already what your patch wants to extend to other modules? If not, there's conflict. Jan Engelhardt -- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] disable builtin modules
This patch makes it possible to disable built in code from the kernel command line. The patch is rather simple - it extends the compiled-in case of module_init() to include __setup() with a name based on KBUILD_MODNAME. What if there is already an option like the modname? I do not know of any code that currently does so, but you never know. Are acpi= and apm= already what your patch wants to extend to other modules? If not, there's conflict. Jan Engelhardt -- - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] disable builtin modules
On Sun, 20 Mar 2005 10:51:41 +0100 (MET), Jan Engelhardt [EMAIL PROTECTED] wrote: This patch makes it possible to disable built in code from the kernel command line. The patch is rather simple - it extends the compiled-in case of module_init() to include __setup() with a name based on KBUILD_MODNAME. What if there is already an option like the modname? I do not know of any code that currently does so, but you never know. Are acpi= and apm= already what your patch wants to extend to other modules? If not, there's conflict. There is a conflict. Thanks for pointing that out. Both the obsolete __setup() parameter code and the module parameter code in kernel/params.c are limited to a single matching parameter. The first matching parameter will be used, and non-early obsoleted parameters are overridden by module parameter code. If I understand the code correctly that is. =) Maybe it is possible to (mis)use early_param instead of __setup and let these parameters become high priority parameters that only are parsed by do_early_param()...? / magnus - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] disable builtin modules
This patch makes it possible to disable built in code from the kernel command line. The patch is rather simple - it extends the compiled-in case of module_init() to include __setup() with a name based on KBUILD_MODNAME. Problem: Say that your Firewire PHY breaks and you find yourself unable to boot any installation cd that includes built in Firewire support because the ohci1394 code together with your broken hardware makes the kernel crash during bootup. Solution: Boot a kernel that includes this patch and pass ohci1394=off. Signed-off-by: Magnus Damm <[EMAIL PROTECTED]> diff -urNp linux-2.6.11.4/include/linux/init.h linux-2.6.11.4-disable_builtin/include/linux/init.h --- linux-2.6.11.4/include/linux/init.h 2005-03-16 10:56:20.0 +0100 +++ linux-2.6.11.4-disable_builtin/include/linux/init.h 2005-03-19 23:42:29.417496240 +0100 @@ -143,6 +143,16 @@ struct obs_kernel_param { /* Relies on saved_command_line being set */ void __init parse_early_param(void); + +void __init disable_initcall(void *fn); +#define __module_init_disable(x) \ +static int __init x##_disable_module(char *str)\ +{ \ + disable_initcall(x);\ + return 1; \ +} \ +__setup(__stringify(KBUILD_MODNAME) "=off", x##_disable_module) + #endif /* __ASSEMBLY__ */ /** @@ -153,7 +163,7 @@ void __init parse_early_param(void); * builtin) or at module insertion time (if a module). There can only * be one per module. */ -#define module_init(x) __initcall(x); +#define module_init(x) __initcall(x); __module_init_disable(x); /** * module_exit() - driver exit entry point diff -urNp linux-2.6.11.4/init/main.c linux-2.6.11.4-disable_builtin/init/main.c --- linux-2.6.11.4/init/main.c 2005-03-16 10:56:20.0 +0100 +++ linux-2.6.11.4-disable_builtin/init/main.c 2005-03-19 23:31:52.676295616 +0100 @@ -527,6 +527,17 @@ struct task_struct *child_reaper = extern initcall_t __initcall_start[], __initcall_end[]; +void __init disable_initcall(void *fn) +{ + initcall_t *call; + + for (call = __initcall_start; call < __initcall_end; call++) { + + if (*call == fn) + *call = NULL; + } +} + static void __init do_initcalls(void) { initcall_t *call; @@ -541,7 +552,8 @@ static void __init do_initcalls(void) printk("\n"); } - (*call)(); + if (*call) + (*call)(); msg = NULL; if (preempt_count() != count) { - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] disable builtin modules
This patch makes it possible to disable built in code from the kernel command line. The patch is rather simple - it extends the compiled-in case of module_init() to include __setup() with a name based on KBUILD_MODNAME. Problem: Say that your Firewire PHY breaks and you find yourself unable to boot any installation cd that includes built in Firewire support because the ohci1394 code together with your broken hardware makes the kernel crash during bootup. Solution: Boot a kernel that includes this patch and pass ohci1394=off. Signed-off-by: Magnus Damm [EMAIL PROTECTED] diff -urNp linux-2.6.11.4/include/linux/init.h linux-2.6.11.4-disable_builtin/include/linux/init.h --- linux-2.6.11.4/include/linux/init.h 2005-03-16 10:56:20.0 +0100 +++ linux-2.6.11.4-disable_builtin/include/linux/init.h 2005-03-19 23:42:29.417496240 +0100 @@ -143,6 +143,16 @@ struct obs_kernel_param { /* Relies on saved_command_line being set */ void __init parse_early_param(void); + +void __init disable_initcall(void *fn); +#define __module_init_disable(x) \ +static int __init x##_disable_module(char *str)\ +{ \ + disable_initcall(x);\ + return 1; \ +} \ +__setup(__stringify(KBUILD_MODNAME) =off, x##_disable_module) + #endif /* __ASSEMBLY__ */ /** @@ -153,7 +163,7 @@ void __init parse_early_param(void); * builtin) or at module insertion time (if a module). There can only * be one per module. */ -#define module_init(x) __initcall(x); +#define module_init(x) __initcall(x); __module_init_disable(x); /** * module_exit() - driver exit entry point diff -urNp linux-2.6.11.4/init/main.c linux-2.6.11.4-disable_builtin/init/main.c --- linux-2.6.11.4/init/main.c 2005-03-16 10:56:20.0 +0100 +++ linux-2.6.11.4-disable_builtin/init/main.c 2005-03-19 23:31:52.676295616 +0100 @@ -527,6 +527,17 @@ struct task_struct *child_reaper = init extern initcall_t __initcall_start[], __initcall_end[]; +void __init disable_initcall(void *fn) +{ + initcall_t *call; + + for (call = __initcall_start; call __initcall_end; call++) { + + if (*call == fn) + *call = NULL; + } +} + static void __init do_initcalls(void) { initcall_t *call; @@ -541,7 +552,8 @@ static void __init do_initcalls(void) printk(\n); } - (*call)(); + if (*call) + (*call)(); msg = NULL; if (preempt_count() != count) { - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/