Subject: printk in init/main.c

From: Rob Scott <[email-masked]>
Date: Mon, 14 Feb 2000 22:55:24 -0800 (PST)

Hi,

I'm trying to get my first printk(linux_banner) in init/main.c to work. I
can't figure out how console_drivers gets initialized. It's used in the
following fragment from printk (where the actual printing gets done):

if (msg_level < console_loglevel && console_drivers) {
		struct console *c = console_drivers;
		while(c) {
			if ((c->flags & CON_ENABLED) && c->write)
				c->write(c, msg, p - msg + line_feed);
			c = c->next;
		}
	}
	
The printk(linux_banner) is called before console_init in the function 
start_kernel as the following fragment from init/main.c shows:

/*
 * Interrupts are still disabled. Do necessary setups, then
 * enable them
 */
	printk(linux_banner);
	setup_arch(&command_line, &memory_start, &memory_end);
	memory_start = paging_init(memory_start,memory_end);
	trap_init();
	init_IRQ();
	sched_init();
	time_init();
	parse_options(command_line);

	/*
	 * HACK ALERT! This is early. We're enabling the console before
	 * we've done PCI setups etc, and console_init() must be aware of
	 * this. But we do want output early, in case something goes
wrong.
	 */
	memory_start = console_init(memory_start,memory_end);

My guess is that there's some "interesting" compile time behavour that I'm
missing...

Thanks in advance for your help!
Rob Scott

unsubscribe: body of `unsubscribe linux-arm-kernel' to [email-masked]

---

From: Nicolas Pitre <[email-masked]>
Date: Tue, 15 Feb 2000 11:31:56 -0500 (EST)

> following fragment from printk (where the actual printing gets done):
[...]
> start_kernel as the following fragment from init/main.c shows:
[...]

All printk's before console_init() are stored in a buffer.  The buffer is
purged only when the console is initialized, but your kernel may have
crashed before that point.

You may consider using printascii() and friends.  See
arch/arm/kernel/debug-*.S, or arch/arm/kernel/head_*.s depending on the
version you are using.

Nicolas