diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2009-03-10 10:22:26 +0000 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2009-03-10 10:22:26 +0000 |
commit | 4c3a91aebdec01a50e7daa6db8513a6be73ed66b (patch) | |
tree | 3caa9a1d01424b097531e626c698ea938e8c99b8 | |
parent | b4da2829c109706812b899722deb65eed42d9746 (diff) |
[ARM] Add an early debug console
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | arch/arm/Kconfig.debug | 8 | ||||
-rw-r--r-- | arch/arm/kernel/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/kernel/early_printk.c | 38 |
3 files changed, 47 insertions, 0 deletions
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index 192ee01a9ba2..a7a01289a480 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -59,6 +59,14 @@ config DEBUG_LL in the kernel. This is helpful if you are debugging code that executes before the console is initialized. +config DEBUG_LL_CONSOLE + bool "Kernel early console" + depends on DEBUG_LL + help + Say Y here if you want to have an early console using the Kernel + low-level debugging functions. Add earlyprintk to your kernel + parameters to enable this console. + config DEBUG_ICEDCC bool "Kernel low-level debugging via EmbeddedICE DCC channel" depends on DEBUG_LL diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index 4305345987d3..f1495d8ab15c 100644 --- a/arch/arm/kernel/Makefile +++ b/arch/arm/kernel/Makefile @@ -44,5 +44,6 @@ endif head-y := head$(MMUEXT).o obj-$(CONFIG_DEBUG_LL) += debug.o +obj-$(CONFIG_DEBUG_LL_CONSOLE) += early_printk.o extra-y := $(head-y) init_task.o vmlinux.lds diff --git a/arch/arm/kernel/early_printk.c b/arch/arm/kernel/early_printk.c new file mode 100644 index 000000000000..a0aea0a5e252 --- /dev/null +++ b/arch/arm/kernel/early_printk.c @@ -0,0 +1,38 @@ +/* + * linux/arch/arm/kernel/early_printk.c + * + * Copyright (C) 2009 Sascha Hauer <s.hauer@pengutronix.de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include <linux/console.h> +#include <linux/init.h> + +extern void printch(int); + +static void early_serial_write(struct console *con, const char *s, unsigned n) +{ + while (*s && n-- > 0) { + if (*s == '\n') + printch('\r'); + printch(*s); + s++; + } +} + +static struct console early_serial_console = { + .name = "earlyser", + .write = early_serial_write, + .flags = CON_PRINTBUFFER | CON_BOOT, + .index = -1, +}; + +static int __init setup_early_printk(char *buf) +{ + register_console(&early_serial_console); + return 0; +} + +early_param("earlyprintk", setup_early_printk); |