From: Tom Rini - Remove saved_command_line (and saving of the command line). - Call parse_early_options - Convert debug=, switches= to __early_param. And from Geert Uytterhoeven - Rename CL_SIZE to COMMAND_LINE_SIZE to fix compilation of init/main.c and match majority of other arches (MIPS needs a similar fix). - Move Atari-specific part from arch/m68k/kernel/setup.c to arch/m68k/atari/config.c, so we can drop the #ifdef CONFIG_ATARI --- 25-akpm/arch/m68k/atari/config.c | 13 ++++++- 25-akpm/arch/m68k/kernel/setup.c | 54 ++++++++++-------------------- 25-akpm/arch/m68k/kernel/vmlinux-std.lds | 3 + 25-akpm/arch/m68k/kernel/vmlinux-sun3.lds | 3 + 25-akpm/arch/m68k/mac/config.c | 2 - 25-akpm/arch/m68k/q40/config.c | 1 25-akpm/include/asm-m68k/bootinfo.h | 4 +- 25-akpm/include/asm-m68k/setup.h | 4 +- 8 files changed, 41 insertions(+), 43 deletions(-) diff -puN arch/m68k/atari/config.c~early-param-m68k arch/m68k/atari/config.c --- 25/arch/m68k/atari/config.c~early-param-m68k 2004-03-30 19:49:08.562636864 -0800 +++ 25-akpm/arch/m68k/atari/config.c 2004-03-30 19:49:08.575634888 -0800 @@ -180,7 +180,7 @@ int __init atari_parse_bootinfo(const st /* Parse the Atari-specific switches= option. */ -void __init atari_switches_setup( const char *str, unsigned len ) +static void __init atari_switches_setup( const char *str, unsigned len ) { char switches[len+1]; char *p; @@ -217,6 +217,17 @@ void __init atari_switches_setup( const } } +static int __init early_switches(char *p) +{ + char *q; + + atari_switches_setup(p, (q = strchr(p, ' ' )) ? + (q - p) : strlen(p)); + + return 0; +} +__early_param("switches=", early_switches); + /* * Setup the Atari configuration info diff -puN arch/m68k/kernel/setup.c~early-param-m68k arch/m68k/kernel/setup.c --- 25/arch/m68k/kernel/setup.c~early-param-m68k 2004-03-30 19:49:08.564636560 -0800 +++ 25-akpm/arch/m68k/kernel/setup.c 2004-03-30 19:49:08.576634736 -0800 @@ -61,8 +61,7 @@ struct mem_info m68k_memory[NUM_MEMINFO] static struct mem_info m68k_ramdisk = { 0, 0 }; -static char m68k_command_line[CL_SIZE]; -char saved_command_line[CL_SIZE]; +static char m68k_command_line[COMMAND_LINE_SIZE]; char m68k_debug_device[6] = ""; @@ -196,6 +195,22 @@ static void __init m68k_parse_bootinfo(c #endif } +/* + * "debug=xxx" will enable printing certain kernel messages to some + * machine-specific device. + */ +static int __init early_debug(char *p) +{ + strlcpy(m68k_debug_device, p, sizeof(m68k_debug_device)); + + /* Terminate the arg. */ + if ((p = strchr(m68k_debug_device, ' ' ))) + *p = 0; + + return 0; +} +__early_param("debug=", early_debug); + void __init setup_arch(char **cmdline_p) { extern int _etext, _edata, _end; @@ -203,7 +218,6 @@ void __init setup_arch(char **cmdline_p) unsigned long endmem, startmem; #endif int i; - char *p, *q; if (!MACH_IS_HP300) { /* The bootinfo is located right after the kernel bss */ @@ -244,39 +258,7 @@ void __init setup_arch(char **cmdline_p) init_mm.brk = (unsigned long) &_end; *cmdline_p = m68k_command_line; - memcpy(saved_command_line, *cmdline_p, CL_SIZE); - - /* Parse the command line for arch-specific options. - * For the m68k, this is currently only "debug=xxx" to enable printing - * certain kernel messages to some machine-specific device. - */ - for( p = *cmdline_p; p && *p; ) { - i = 0; - if (!strncmp( p, "debug=", 6 )) { - strlcpy( m68k_debug_device, p+6, sizeof(m68k_debug_device) ); - if ((q = strchr( m68k_debug_device, ' ' ))) *q = 0; - i = 1; - } -#ifdef CONFIG_ATARI - /* This option must be parsed very early */ - if (!strncmp( p, "switches=", 9 )) { - extern void atari_switches_setup( const char *, int ); - atari_switches_setup( p+9, (q = strchr( p+9, ' ' )) ? - (q - (p+9)) : strlen(p+9) ); - i = 1; - } -#endif - - if (i) { - /* option processed, delete it */ - if ((q = strchr( p, ' ' ))) - strcpy( p, q+1 ); - else - *p = 0; - } else { - if ((p = strchr( p, ' ' ))) ++p; - } - } + parse_early_options(cmdline_p); switch (m68k_machtype) { #ifdef CONFIG_AMIGA diff -puN arch/m68k/kernel/vmlinux-std.lds~early-param-m68k arch/m68k/kernel/vmlinux-std.lds --- 25/arch/m68k/kernel/vmlinux-std.lds~early-param-m68k 2004-03-30 19:49:08.565636408 -0800 +++ 25-akpm/arch/m68k/kernel/vmlinux-std.lds 2004-03-30 19:49:08.576634736 -0800 @@ -50,6 +50,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 arch/m68k/kernel/vmlinux-sun3.lds~early-param-m68k arch/m68k/kernel/vmlinux-sun3.lds --- 25/arch/m68k/kernel/vmlinux-sun3.lds~early-param-m68k 2004-03-30 19:49:08.566636256 -0800 +++ 25-akpm/arch/m68k/kernel/vmlinux-sun3.lds 2004-03-30 19:49:08.576634736 -0800 @@ -44,6 +44,9 @@ __init_begin = .; __setup_start = .; .init.setup : { *(.init.setup) } __setup_end = .; + __early_begin = .; + __early_param : { *(__early_param) } + __early_end = .; __start___param = .; __param : { *(__param) } __stop___param = .; diff -puN arch/m68k/mac/config.c~early-param-m68k arch/m68k/mac/config.c --- 25/arch/m68k/mac/config.c~early-param-m68k 2004-03-30 19:49:08.568635952 -0800 +++ 25-akpm/arch/m68k/mac/config.c 2004-03-30 19:49:08.577634584 -0800 @@ -58,7 +58,7 @@ extern struct mem_info m68k_memory[NUM_M extern struct mem_info m68k_ramdisk; -extern char m68k_command_line[CL_SIZE]; +extern char m68k_command_line[COMMAND_LINE_SIZE]; void *mac_env; /* Loaded by the boot asm */ diff -puN arch/m68k/q40/config.c~early-param-m68k arch/m68k/q40/config.c --- 25/arch/m68k/q40/config.c~early-param-m68k 2004-03-30 19:49:08.569635800 -0800 +++ 25-akpm/arch/m68k/q40/config.c 2004-03-30 19:49:08.577634584 -0800 @@ -64,7 +64,6 @@ void q40_set_vectors (void); extern void q40_mksound(unsigned int /*freq*/, unsigned int /*ticks*/ ); -extern char *saved_command_line; extern char m68k_debug_device[]; static void q40_mem_console_write(struct console *co, const char *b, unsigned int count); diff -puN include/asm-m68k/bootinfo.h~early-param-m68k include/asm-m68k/bootinfo.h --- 25/include/asm-m68k/bootinfo.h~early-param-m68k 2004-03-30 19:49:08.571635496 -0800 +++ 25-akpm/include/asm-m68k/bootinfo.h 2004-03-30 19:49:08.578634432 -0800 @@ -344,7 +344,7 @@ struct compat_mem_info { #define COMPAT_FPU_68060 (1<