Re: Early printk behaviour

From: Gerd Hoffmann
Date: Mon Aug 20 2007 - 04:01:33 EST


Robin Getz wrote:

>> Hmm, yes, should be doable in generic code. Check whenever the current
>> console has CON_BOOT set and if so unregister it.
>
> Something like:
>
> +++ kernel/printk.c (working copy)
> +int __init disable_boot_consoles(void)
> +{
> + struct console *con;
> +
> + for (con = console_drivers; con; con = con->next) {
> + if (con->flags & CON_BOOT) {
> + printk(KERN_INFO "Unregister BootConsole %s%d\n",
> + con->name, con->index);
> + unregister_console(con);
> + }
> + }
> + return 0;
> +}
> +late_initcall(disable_boot_consoles);

Yep, that should work. You can drop the loop though. You can't
register a boot console if another console exists, and the first
non-boot console replaces the boot console, thus you never ever have
more than one console in case the boot console is still active.

The printk should be all lowercase like the other printk's in the file.

Other than that it loosk fine.

cheers,
Gerd

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/