aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2011-05-24 20:13:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-25 11:39:41 -0400
commitd634f194d4e2e58d57927c812aca097e67a2287d (patch)
treeca17ff43725293ea0bda7a7d7e8ed23ad4f89e14 /arch/um/kernel
parent2525e70d492f8c7bbe1292db8fcd973607a56ac6 (diff)
um: add earlyprintk support
User Mode Linux can also benefit from earlyprintk. UML's earlyprintk writes kernel messages directly to stdout. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/kernel')
-rw-r--r--arch/um/kernel/Makefile1
-rw-r--r--arch/um/kernel/early_printk.c33
2 files changed, 34 insertions, 0 deletions
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile
index 1119233597a1..c4491c15afb2 100644
--- a/arch/um/kernel/Makefile
+++ b/arch/um/kernel/Makefile
@@ -17,6 +17,7 @@ obj-y = config.o exec.o exitcode.o init_task.o irq.o ksyms.o mem.o \
17obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o 17obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o
18obj-$(CONFIG_GPROF) += gprof_syms.o 18obj-$(CONFIG_GPROF) += gprof_syms.o
19obj-$(CONFIG_GCOV) += gmon_syms.o 19obj-$(CONFIG_GCOV) += gmon_syms.o
20obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
20 21
21USER_OBJS := config.o 22USER_OBJS := config.o
22 23
diff --git a/arch/um/kernel/early_printk.c b/arch/um/kernel/early_printk.c
new file mode 100644
index 000000000000..ec649bf72f68
--- /dev/null
+++ b/arch/um/kernel/early_printk.c
@@ -0,0 +1,33 @@
1/*
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>
12#include "os.h"
13
14static void early_console_write(struct console *con, const char *s, unsigned int n)
15{
16 um_early_printk(s, n);
17}
18
19static struct console early_console = {
20 .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{
28 register_console(&early_console);
29
30 return 0;
31}
32
33early_param("earlyprintk", setup_early_printk);