blob: 4a0800bc37b202b53f8e81ac45eaba36cae16052 [file] [log] [blame]
Richard Weinbergerd634f192011-05-24 17:13:01 -07001/*
2 * Copyright (C) 2011 Richard Weinberger <richrd@nod.at>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#include <linux/kernel.h>
10#include <linux/console.h>
11#include <linux/init.h>
Al Viro37185b32012-10-08 03:27:32 +010012#include <os.h>
Richard Weinbergerd634f192011-05-24 17:13:01 -070013
14static void early_console_write(struct console *con, const char *s, unsigned int n)
15{
16 um_early_printk(s, n);
17}
18
Thomas Gleixnerd0380e62013-04-29 16:17:18 -070019static struct console early_console_dev = {
Richard Weinbergerd634f192011-05-24 17:13:01 -070020 .name = "earlycon",
21 .write = early_console_write,
22 .flags = CON_BOOT,
23 .index = -1,
24};
25
26static int __init setup_early_printk(char *buf)
27{
Thomas Gleixnerd0380e62013-04-29 16:17:18 -070028 if (!early_console) {
29 early_console = &early_console_dev;
30 register_console(&early_console_dev);
31 }
Richard Weinbergerd634f192011-05-24 17:13:01 -070032 return 0;
33}
34
35early_param("earlyprintk", setup_early_printk);