From: Tom Rini <trini@kernel.crashing.org>

- Remove saved_command_line (and saving of the command line).
- Call parse_early_options
- Convert earlyprintk=


---

 25-akpm/arch/x86_64/kernel/early_printk.c |    2 +-
 25-akpm/arch/x86_64/kernel/head64.c       |   16 +++++-----------
 25-akpm/arch/x86_64/kernel/setup.c        |    7 ++-----
 25-akpm/arch/x86_64/kernel/vmlinux.lds.S  |    3 +++
 25-akpm/include/asm-x86_64/bootsetup.h    |    1 -
 25-akpm/include/asm-x86_64/setup.h        |    6 +-----
 6 files changed, 12 insertions(+), 23 deletions(-)

diff -puN arch/x86_64/kernel/early_printk.c~early-param-x86_64 arch/x86_64/kernel/early_printk.c
--- 25/arch/x86_64/kernel/early_printk.c~early-param-x86_64	2004-03-31 00:55:05.710926136 -0800
+++ 25-akpm/arch/x86_64/kernel/early_printk.c	2004-03-31 00:55:05.718924920 -0800
@@ -219,4 +219,4 @@ void __init disable_early_printk(void)
 	}
 } 
 
-__setup("earlyprintk=", setup_early_printk);
+__early_param("earlyprintk=", setup_early_printk);
diff -puN arch/x86_64/kernel/head64.c~early-param-x86_64 arch/x86_64/kernel/head64.c
--- 25/arch/x86_64/kernel/head64.c~early-param-x86_64	2004-03-31 00:55:05.711925984 -0800
+++ 25-akpm/arch/x86_64/kernel/head64.c	2004-03-31 00:55:05.719924768 -0800
@@ -34,8 +34,6 @@ extern char x86_boot_params[2048];
 #define OLD_CL_BASE_ADDR        0x90000
 #define OLD_CL_OFFSET           0x90022
 
-extern char saved_command_line[];
-
 static void __init copy_bootdata(char *real_mode_data)
 {
 	int new_data;
@@ -52,8 +50,7 @@ static void __init copy_bootdata(char *r
 		printk("old bootloader convention, maybe loadlin?\n");
 	}
 	command_line = (char *) ((u64)(new_data));
-	memcpy(saved_command_line, command_line, COMMAND_LINE_SIZE);
-	printk("Bootdata ok (command line is %s)\n", saved_command_line);	
+	printk("Bootdata ok (command line is %s)\n", command_line);
 }
 
 static void __init setup_boot_cpu_data(void)
@@ -81,18 +78,15 @@ void __init x86_64_start_kernel(char * r
 	pda_init(0);
 	copy_bootdata(real_mode_data);
 	/* default console: */
-	if (!strstr(saved_command_line, "console="))
-		strcat(saved_command_line, " console=tty0"); 
-	s = strstr(saved_command_line, "earlyprintk=");
-	if (s != NULL)
-		setup_early_printk(s);
+	if (!strstr(command_line, "console="))
+		strcat(command_line, " console=tty0");
 #ifdef CONFIG_DISCONTIGMEM
-	s = strstr(saved_command_line, "numa=");
+	s = strstr(command_line, "numa=");
 	if (s != NULL)
 		numa_setup(s+5);
 #endif
 #ifdef CONFIG_X86_IO_APIC
-	if (strstr(saved_command_line, "disableapic"))
+	if (strstr(command_line, "disableapic"))
 		disable_apic = 1;
 #endif
 	setup_boot_cpu_data();
diff -puN arch/x86_64/kernel/setup.c~early-param-x86_64 arch/x86_64/kernel/setup.c
--- 25/arch/x86_64/kernel/setup.c~early-param-x86_64	2004-03-31 00:55:05.713925680 -0800
+++ 25-akpm/arch/x86_64/kernel/setup.c	2004-03-31 00:55:05.720924616 -0800
@@ -55,6 +55,7 @@
 #include <asm/bootsetup.h>
 #include <asm/smp.h>
 #include <asm/proto.h>
+#include <asm/setup.h>	/* For COMMAND_LINE_SIZE */
 
 /*
  * Machine setup..
@@ -100,7 +101,6 @@ extern int root_mountflags;
 extern char _text, _etext, _edata, _end;
 
 char command_line[COMMAND_LINE_SIZE];
-char saved_command_line[COMMAND_LINE_SIZE];
 
 struct resource standard_io_resources[] = {
 	{ "dma1", 0x00, 0x1f, IORESOURCE_BUSY },
@@ -196,10 +196,6 @@ static __init void parse_cmdline_early (
 	char c = ' ', *to = command_line, *from = COMMAND_LINE;
 	int len = 0;
 
-	/* Save unparsed command line copy for /proc/cmdline */
-	memcpy(saved_command_line, COMMAND_LINE, COMMAND_LINE_SIZE);
-	saved_command_line[COMMAND_LINE_SIZE-1] = '\0';
-
 	for (;;) {
 		if (c != ' ') 
 			goto next_char; 
@@ -427,6 +423,7 @@ void __init setup_arch(char **cmdline_p)
 	data_resource.end = virt_to_phys(&_edata)-1;
 
 	parse_cmdline_early(cmdline_p);
+	parse_early_options(cmdline_p);
 
 	/*
 	 * partially used pages are not usable - thus
diff -puN arch/x86_64/kernel/vmlinux.lds.S~early-param-x86_64 arch/x86_64/kernel/vmlinux.lds.S
--- 25/arch/x86_64/kernel/vmlinux.lds.S~early-param-x86_64	2004-03-31 00:55:05.714925528 -0800
+++ 25-akpm/arch/x86_64/kernel/vmlinux.lds.S	2004-03-31 00:55:05.720924616 -0800
@@ -89,6 +89,9 @@ SECTIONS
   __setup_start = .;
   .init.setup : { *(.init.setup) }
   __setup_end = .;
+  __early_begin = .;
+  __early_param : { *(__early_param) }
+  __early_end = .;
   __start___param = .;
   __param : { *(__param) }
   __stop___param = .;
diff -puN include/asm-x86_64/bootsetup.h~early-param-x86_64 include/asm-x86_64/bootsetup.h
--- 25/include/asm-x86_64/bootsetup.h~early-param-x86_64	2004-03-31 00:55:05.715925376 -0800
+++ 25-akpm/include/asm-x86_64/bootsetup.h	2004-03-31 00:55:05.721924464 -0800
@@ -30,7 +30,6 @@ extern char x86_boot_params[2048];
 #define EDD_NR     (*(unsigned char *) (PARAM+EDDNR))
 #define EDD_BUF     ((struct edd_info *) (PARAM+EDDBUF))
 #define COMMAND_LINE saved_command_line
-#define COMMAND_LINE_SIZE 256
 
 #define RAMDISK_IMAGE_START_MASK  	0x07FF
 #define RAMDISK_PROMPT_FLAG		0x8000
diff -puN include/asm-x86_64/setup.h~early-param-x86_64 include/asm-x86_64/setup.h
--- 25/include/asm-x86_64/setup.h~early-param-x86_64	2004-03-31 00:55:05.716925224 -0800
+++ 25-akpm/include/asm-x86_64/setup.h	2004-03-31 00:55:05.721924464 -0800
@@ -1,10 +1,6 @@
-/*
- *	Just a place holder. We don't want to have to test x86 before
- *	we include stuff
- */
-
 #ifndef _x8664_SETUP_H
 #define _x8664_SETUP_H
 
+#define COMMAND_LINE_SIZE	256
 
 #endif

_