From andi
DESC
generate ia32 early_printk via inclusion
EDESC

I was trying to generate an early_printk.i and it wasn't obvious how.  Also,
using this makefile trick breaks make dependencies: early_printk.o doesn't
get regenerated when you switch CONFIG_X86_4G.

Don't use a makefile trick - just #include the x86_64 file.


---

 25-akpm/Documentation/kernel-parameters.txt |   17 +++++++++++++++++
 25-akpm/arch/i386/Kconfig                   |    3 +++
 25-akpm/arch/i386/kernel/Makefile           |    1 +
 25-akpm/arch/i386/kernel/early_printk.c     |    2 ++
 25-akpm/arch/i386/kernel/setup.c            |   12 ++++++++++++
 25-akpm/arch/x86_64/kernel/early_printk.c   |    4 ++++
 6 files changed, 39 insertions(+)

diff -puN arch/i386/Kconfig~early_printk arch/i386/Kconfig
--- 25/arch/i386/Kconfig~early_printk	Tue Feb 17 15:37:57 2004
+++ 25-akpm/arch/i386/Kconfig	Tue Feb 17 15:37:57 2004
@@ -1177,6 +1177,9 @@ config DEBUG_KERNEL
 	  Say Y here if you are developing drivers or trying to debug and
 	  identify kernel problems.
 
+config EARLY_PRINTK
+       default y
+
 config DEBUG_STACKOVERFLOW
 	bool "Check for stack overflows"
 	depends on DEBUG_KERNEL
diff -puN arch/i386/kernel/Makefile~early_printk arch/i386/kernel/Makefile
--- 25/arch/i386/kernel/Makefile~early_printk	Tue Feb 17 15:37:57 2004
+++ 25-akpm/arch/i386/kernel/Makefile	Tue Feb 17 15:38:07 2004
@@ -32,6 +32,7 @@ obj-y				+= sysenter.o vsyscall.o
 obj-$(CONFIG_ACPI_SRAT) 	+= srat.o
 obj-$(CONFIG_HPET_TIMER) 	+= time_hpet.o
 obj-$(CONFIG_EFI) 		+= efi.o efi_stub.o
+obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
 
 EXTRA_AFLAGS   := -traditional
 
diff -puN arch/i386/kernel/setup.c~early_printk arch/i386/kernel/setup.c
--- 25/arch/i386/kernel/setup.c~early_printk	Tue Feb 17 15:37:57 2004
+++ 25-akpm/arch/i386/kernel/setup.c	Tue Feb 17 15:37:57 2004
@@ -1118,6 +1118,18 @@ void __init setup_arch(char **cmdline_p)
 #endif
 	paging_init();
 
+#ifdef CONFIG_EARLY_PRINTK
+	{
+		char *s = strstr(*cmdline_p, "earlyprintk=");
+		if (s) {
+			extern void setup_early_printk(char *);
+			setup_early_printk(s+12);
+			printk("early console enabled\n");
+		}
+	}
+#endif
+
+
 	dmi_scan_machine();
 
 #ifdef CONFIG_X86_GENERICARCH
diff -puN arch/x86_64/kernel/early_printk.c~early_printk arch/x86_64/kernel/early_printk.c
--- 25/arch/x86_64/kernel/early_printk.c~early_printk	Tue Feb 17 15:37:57 2004
+++ 25-akpm/arch/x86_64/kernel/early_printk.c	Tue Feb 17 15:37:57 2004
@@ -7,7 +7,11 @@
 
 /* Simple VGA output */
 
+#ifdef __i386__
+#define VGABASE		(__PAGE_OFFSET + 0xb8000UL)
+#else
 #define VGABASE		0xffffffff800b8000UL
+#endif
 
 #define MAX_YPOS	25
 #define MAX_XPOS	80
diff -puN Documentation/kernel-parameters.txt~early_printk Documentation/kernel-parameters.txt
--- 25/Documentation/kernel-parameters.txt~early_printk	Tue Feb 17 15:37:57 2004
+++ 25-akpm/Documentation/kernel-parameters.txt	Tue Feb 17 15:37:57 2004
@@ -317,6 +317,23 @@ running once the system is up.
 
 	dtc3181e=	[HW,SCSI]
 
+	earlyprintk=	[x86, x86_64]
+			earlyprintk=vga
+			earlyprintk=serial[,ttySn[,baudrate]]
+
+			Append ,keep to not disable it when the real console
+			takes over.
+
+			Only vga or serial at a time, not both.
+
+			Currently only ttyS0 and ttyS1 are supported.
+
+			Interaction with the standard serial driver is not
+			very good.
+
+			The VGA output is eventually overwritten by the real
+			console.
+
 	eata=		[HW,SCSI]
 
 	eda=		[HW,PS2]
diff -puN /dev/null arch/i386/kernel/early_printk.c
--- /dev/null	Thu Apr 11 07:25:15 2002
+++ 25-akpm/arch/i386/kernel/early_printk.c	Tue Feb 17 15:38:07 2004
@@ -0,0 +1,2 @@
+
+#include "../../x86_64/kernel/early_printk.c"

_