Re: /dev/console should it always be available?

From: Mike Panetta (mpanetta@realminfo.com)
Date: Sat Feb 26 2000 - 15:10:41 EST


I will try this patch. Will it compile against 2.3.x and 2.2 kernels?
Just in case I have the problem with 2.2.x kernels as well...

Thanks,
Mike

On Sat, Feb 26, 2000 at 04:56:19PM +0000, Matthew Kirkwood wrote:
> On Sat, 26 Feb 2000, Mike Panetta wrote:
>
> > Should /dev/console always be available even if there is no video card
> > or keyboard on a machine? I keep getting these messages in the logs
> > about init not being able to open(/dev/console) when I remove the
> > video card from an embedded box I am working on.
>
> Odd. Attached is a patch which may let you escape the complaints
> if you boot with "console=null".
>
> Matthew.

> Index: linux/kernel/printk.c
> ===================================================================
> RCS file: /cvs/linux/linux/kernel/printk.c,v
> retrieving revision 1.40
> diff -u -r1.40 printk.c
> --- linux/kernel/printk.c 2000/02/14 07:37:40 1.40
> +++ linux/kernel/printk.c 2000/02/24 11:59:48
> @@ -45,16 +45,23 @@
>
> spinlock_t console_lock = SPIN_LOCK_UNLOCKED;
>
> -struct console *console_drivers = NULL;
> +static void null_write(struct console*, const char*, unsigned);
> +static kdev_t null_device(struct console*);
> +struct console null_console = {
> +name: "null",
> +write: null_write,
> +device: null_device,
> +};
> +
> +struct console *console_drivers = &null_console;
> +
> static char log_buf[LOG_BUF_LEN];
> static unsigned long log_start = 0;
> static unsigned long logged_chars = 0;
> struct console_cmdline console_cmdline[MAX_CMDLINECONSOLES];
> static int preferred_console = -1;
>
> -/*
> - * Setup a list of consoles. Called from init/main.c
> - */
> +
> static int __init console_setup(char *str)
> {
> struct console_cmdline *c;
> @@ -486,4 +493,18 @@
> if (tty && tty->driver.write)
> tty->driver.write(tty, 0, msg, strlen(msg));
> return;
> +}
> +
> +
> +/*
> + * null console methods
> + */
> +static void null_write(struct console *c, const char *s, unsigned l)
> +{
> + /* nuthin' */
> +}
> +
> +static kdev_t null_device(struct console *c)
> +{
> + return MKDEV(MEM_MAJOR, 3); /* it's hardcoded in mem.c, why not here */
> }
>

-- 

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



This archive was generated by hypermail 2b29 : Tue Feb 29 2000 - 21:00:15 EST