Subject: [PATCH] x86, boot: Add printf support for early console in compressed/misc.c Reuse printf.c in x86 setup code. Later decompresser code could print out more info for debug info. Signed-off-by: Yinghai Lu --- arch/x86/boot/compressed/Makefile | 1 + arch/x86/boot/compressed/misc.h | 7 +++++++ arch/x86/boot/compressed/pagetable.c | 4 ++++ arch/x86/boot/compressed/printf.c | 5 +++++ 4 files changed, 17 insertions(+) Index: linux-2.6/arch/x86/boot/compressed/Makefile =================================================================== --- linux-2.6.orig/arch/x86/boot/compressed/Makefile +++ linux-2.6/arch/x86/boot/compressed/Makefile @@ -73,6 +73,7 @@ vmlinux-objs-y := $(obj)/vmlinux.lds $(o $(obj)/string.o $(obj)/cmdline.o $(obj)/error.o \ $(obj)/piggy.o $(obj)/cpuflags.o +vmlinux-objs-$(CONFIG_X86_VERBOSE_BOOTUP) += $(obj)/printf.o vmlinux-objs-$(CONFIG_EARLY_PRINTK) += $(obj)/early_serial_console.o vmlinux-objs-$(CONFIG_RANDOMIZE_BASE) += $(obj)/kaslr.o ifdef CONFIG_X86_64 Index: linux-2.6/arch/x86/boot/compressed/printf.c =================================================================== --- /dev/null +++ linux-2.6/arch/x86/boot/compressed/printf.c @@ -0,0 +1,5 @@ +#include "misc.h" + +#define puts(__x) __putstr(__x) + +#include "../printf.c" Index: linux-2.6/arch/x86/boot/compressed/misc.h =================================================================== --- linux-2.6.orig/arch/x86/boot/compressed/misc.h +++ linux-2.6/arch/x86/boot/compressed/misc.h @@ -37,14 +37,21 @@ void __putstr(const char *s); #define error_putstr(__x) __putstr(__x) #define error_puthex(__x) __puthex(__x) +/* printf.c */ +int sprintf(char *buf, const char *fmt, ...); +int printf(const char *fmt, ...); + #ifdef CONFIG_X86_VERBOSE_BOOTUP #define debug_putstr(__x) __putstr(__x) +#define debug_printf printf #else static inline void debug_putstr(const char *s) { } +static inline int debug_printf(const char *fmt, ...) +{ } #endif