make all archs use early_param
Subsystems (9)
PATCH 1/1 make all archs use early_param
To celebrate the 2-year anniversary of the creation of the arch-indep early_param() macros and the generic parse_early_param(), this patch stops calling it for archs which didn't inserts explicit calls, polite FIXMEs and a BUG_ON().
Gold star to PowerPC and s390 for calling parse_early_param(), *and* using it instead of open-coded early cmdline hacking.
Quick guide:
(1) setup_arch() should call parse_early_param() as soon as saved_command_line is set.
(2) Use "early_param("param", parse_param);": parse_param() gets a NULL arg if cmdline is "param", otherwise whatever follows "param=". Returns 0 on success, -ve on error (which causes printk).
init/main.c +5 -7
@@ -445,19 +445,17 @@ static int __init do_early_param(char *preturn 0 ; } -/* Arch code calls this early on, or if not, just before other parsing. */ +static __initdata int early_param_parsed; + +/* Arch code calls this early on, usually from setup_arch. */ void __init parse_early_param (void ) { -static __initdata int done =0 ;static __initdata char tmp_cmdline[COMMAND_LINE_SIZE ]; -if (done) -return ; -/* All fall through to do_early_param. */ strlcpy (tmp_cmdline, saved_command_line,COMMAND_LINE_SIZE );parse_args ("early options" , tmp_cmdline,NULL ,0 , do_early_param); - done =1 ; + early_param_parsed =1 ; }/*
@@ -521,7 +519,7 @@ asmlinkage void __init start_kernel(voidbuild_all_zonelists ();page_alloc_init ();printk (KERN_NOTICE "Kernel command line: %s\n" , saved_command_line); -parse_early_param (); +BUG_ON (!early_param_parsed);parse_args ("Booting kernel" , command_line, __start___param, __stop___param - __start___param, &unknown_bootoption);
arch/alpha/kernel/setup.c +3 -1
@@ -545,8 +545,10 @@ setup_arch(char **cmdline_p)strcpy (saved_command_line, command_line); *cmdline_p = command_line; +parse_early_param (); +/* -* Process command-line arguments. +* Process command-line arguments. FIXME: Convert to early_param() */ while ((p =strsep (&args," \t" )) !=NULL ) {if (!*p)continue ;
arch/arm26/kernel/setup.c +1 -0
@@ -494,6 +494,7 @@ void __init setup_arch(char **cmdline_p)memcpy (saved_command_line, from,COMMAND_LINE_SIZE ); saved_command_line[COMMAND_LINE_SIZE -1 ] ='\0' ; +parse_early_param ();parse_cmdline (&meminfo, cmdline_p, from);bootmem_init (&meminfo);paging_init (&meminfo);
arch/avr32/kernel/setup.c +2 -0
@@ -341,7 +341,9 @@ void __init setup_arch (char **cmdline_p init_mm.end_data = (unsigned long ) &_edata; init_mm.brk = (unsigned long ) &_end; +/* FIXME: use early_param() */ parse_cmdline_early (cmdline_p); +parse_early_param ();setup_bootmem ();
arch/cris/kernel/setup.c +1 -0
@@ -155,6 +155,7 @@ setup_arch(char **cmdline_p)/* Save command line for future references. */ memcpy (saved_command_line, cris_command_line,COMMAND_LINE_SIZE ); saved_command_line[COMMAND_LINE_SIZE -1 ] ='\0' ; +parse_early_param ();/* give credit for the CRIS port */ show_etrax_copyright ();
arch/frv/kernel/setup.c +1 -0
@@ -765,6 +765,7 @@ void __init setup_arch(char **cmdline_p)#endif memcpy (saved_command_line, redboot_command_line,COMMAND_LINE_SIZE ); +parse_early_param ();determine_cpu ();determine_clocks (1 );
arch/h8300/kernel/setup.c +1 -0
@@ -156,6 +156,7 @@ void __init setup_arch(char **cmdline_p) *cmdline_p = &command_line[0 ];memcpy (saved_command_line, command_line,COMMAND_LINE_SIZE ); saved_command_line[COMMAND_LINE_SIZE -1 ] =0 ; +parse_early_param ();#ifdef DEBUG if (strlen (*cmdline_p))
arch/ia64/kernel/setup.c +1 -0
@@ -444,6 +444,7 @@ setup_arch (char **cmdline_p)machvec_init (NULL );#endif +/* FIXME: Convert this and platform_setup to use early_param() */ if (early_console_setup (*cmdline_p) ==0 )mark_bsp_online ();
arch/m32r/kernel/setup.c +2 -0
@@ -260,7 +260,9 @@ void __init setup_arch(char **cmdline_p) data_resource.start =virt_to_phys (_etext); data_resource.end =virt_to_phys (_edata)-1 ; +/* FIXME: Use early_param() */ parse_mem_cmdline (cmdline_p); +parse_early_param ();setup_memory ();
arch/m68k/kernel/setup.c +2 -0
@@ -242,7 +242,9 @@ void __init setup_arch(char **cmdline_p) *cmdline_p = m68k_command_line;memcpy (saved_command_line, *cmdline_p,CL_SIZE ); +parse_early_param (); +/* FIXME: Replace with early_param() */ /* 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.
arch/m68knommu/kernel/setup.c +1 -0
@@ -236,6 +236,7 @@ void setup_arch(char **cmdline_p) *cmdline_p = &command_line[0 ];memcpy (saved_command_line, command_line,COMMAND_LINE_SIZE ); saved_command_line[COMMAND_LINE_SIZE -1 ] =0 ; +parse_early_param ();#ifdef DEBUG if (strlen (*cmdline_p))
arch/mips/kernel/setup.c +2 -0
@@ -476,7 +476,9 @@ static void __init arch_mem_init(char **strlcpy (saved_command_line, command_line,COMMAND_LINE_SIZE ); *cmdline_p = command_line; +parse_early_param (); +/* FIXME: replace with early_param() */ parse_cmdline_early ();bootmem_init ();sparse_init ();
arch/parisc/kernel/setup.c +1 -0
@@ -141,6 +141,7 @@ void __init setup_arch(char **cmdline_p)#endif setup_pdc ();setup_cmdline (cmdline_p); +parse_early_param ();collect_boot_cpu_data ();do_memory_inventory ();/* probe for physical memory */ parisc_cache_init ();
arch/s390/kernel/setup.c +1 -0
@@ -600,6 +600,7 @@ setup_arch(char **cmdline_p)/* Save unparsed command line copy for /proc/cmdline */ strlcpy (saved_command_line,COMMAND_LINE ,COMMAND_LINE_SIZE ); +parse_early_param (); *cmdline_p =COMMAND_LINE ; *(*cmdline_p +COMMAND_LINE_SIZE -1 ) ='\0' ;
arch/sh/kernel/setup.c +2 -0
@@ -274,7 +274,9 @@ void __init setup_arch(char **cmdline_p) data_resource.start = (unsigned long )virt_to_phys (_etext); data_resource.end = (unsigned long )virt_to_phys (_edata)-1 ; +/* FIXME: Replace with early_param() */ sh_mv_setup (cmdline_p); +parse_early_param ();/* * Find the highest page frame number we have available
arch/sh64/kernel/setup.c +2 -0
@@ -194,7 +194,9 @@ void __init setup_arch(char **cmdline_p) data_resource.start =__pa (_etext); data_resource.end =__pa (_edata)-1 ; +/* FIXME: Use early_param() */ parse_mem_cmdline (cmdline_p); +parse_early_param ();/* * Find the lowest and highest page frame numbers we have available
arch/sparc/kernel/setup.c +2 -0
@@ -259,6 +259,7 @@ void __init setup_arch(char **cmdline_p)/* Initialize PROM console and command line. */ *cmdline_p =prom_getbootargs ();strcpy (saved_command_line, *cmdline_p); +parse_early_param ();/* Set sparc_cpu_model */ sparc_cpu_model = sun_unknown;
@@ -306,6 +307,7 @@ void __init setup_arch(char **cmdline_p)#elif defined(CONFIG_PROM_CONSOLE ) conswitchp = &prom_con;#endif +/* FIXME: use early_param() */ boot_flags_init (*cmdline_p);idprom_init ();
arch/sparc64/kernel/setup.c +2 -0
@@ -328,6 +328,7 @@ void __init setup_arch(char **cmdline_p)/* Initialize PROM console and command line. */ *cmdline_p =prom_getbootargs ();strcpy (saved_command_line, *cmdline_p); +parse_early_param ();if (tlb_type == hypervisor)printk ("ARCH: SUN4V\n" );
@@ -340,6 +341,7 @@ void __init setup_arch(char **cmdline_p) conswitchp = &prom_con;#endif +/* FIXME: use early_param() */ boot_flags_init (*cmdline_p);idprom_init ();
arch/um/kernel/um_arch.c +1 -0
@@ -485,6 +485,7 @@ void __init setup_arch(char **cmdline_p)paging_init ();strlcpy (saved_command_line, command_line,COMMAND_LINE_SIZE ); *cmdline_p = command_line; +parse_early_param ();setup_hostinfo (); }
arch/v850/kernel/setup.c +2 -0
@@ -66,6 +66,7 @@ void __init setup_arch (char **cmdline) *cmdline = command_line;memcpy (saved_command_line, command_line,COMMAND_LINE_SIZE ); saved_command_line[COMMAND_LINE_SIZE -1 ] ='\0' ; +parse_early_param ();console_verbose ();
@@ -83,6 +84,7 @@ void __init setup_arch (char **cmdline) CPU_MODEL_LONG, PLATFORM_LONG);/* do machine-specific setups. */ +/* FIXME: use early_param() */ mach_setup (cmdline);#ifdef CONFIG_MTD
arch/xtensa/kernel/setup.c +1 -0
@@ -258,6 +258,7 @@ void __init setup_arch(char **cmdline_p)memcpy (saved_command_line, command_line,COMMAND_LINE_SIZE ); saved_command_line[COMMAND_LINE_SIZE -1 ] ='\0' ; *cmdline_p = command_line; +parse_early_param ();/* Reserve some memory regions */
Signature · 1 line
Help! Save Australia from the worst of the DMCA: http://linux.org.au/law
Quoted 2 lines · Rusty Russell
Gold star to PowerPC and s390 for calling
parse_early_param(), *and* using it instead of open-coded early cmdline hacking.
Thanks! :)
arch/s390/kernel/setup.c setup_arch(char **cmdline_p) · line 606
Quoted 11 lines
diff -urpN --exclude TAGS -X
/home/rusty/devel/kernel/kernel-patches/dontdiff--minimallinux-2.6.18-rc3-mm2/arch/s390/kernel/setup.cworking-2.6.18-rc3-mm2-early_param-for-all/arch/s390/kernel/setup.carch/s390/kernel/setup.c +1
-0@@ -600,6 +600,7 @@ setup_arch(char **cmdline_p)/* Save unparsed command line copy for /proc/cmdline */ strlcpy (saved_command_line,COMMAND_LINE ,COMMAND_LINE_SIZE ); +parse_early_param (); *cmdline_p =COMMAND_LINE ; *(*cmdline_p +COMMAND_LINE_SIZE -1 ) ='\0' ;
This part of the patch should be removed.
That would be s390's second call to parse_early_param(). It needs to be done a bit later _after_ the 'memory_end = memory_size' line, where it is already. Otherwise passing 'mem=' to the kernel will have no effect anymory.
Quoted 4 lines · Rusty Russell
To celebrate the 2-year anniversary of the creation of the arch-indep
early_param()macros and the genericparse_early_param(), this patch stops calling it for archs which didn't inserts explicit calls, polite FIXMEs and aBUG_ON().
Is there any reason why we can't put the early params in a section discarded after init time (like ARM does with its early param parsing) ?
early params are using obs_kernel_param - is this no longer obsolete ?
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of: 2.6 Serial core
Quoted 8 lines · Russell King
Quoted 4 lines · Rusty Russell
To celebrate the 2-year anniversary of the creation of the arch-indep
early_param()macros and the genericparse_early_param(), this patch stops calling it for archs which didn't inserts explicit calls, polite FIXMEs and aBUG_ON().Is there any reason why we can't put the early params in a section discarded after init time (like ARM does with its early param parsing) ?
Good point.
Quoted 1 line
early params are using
obs_kernel_param- is this no longer obsolete ?
Yes... it was originally for __setup, which was supposed to be replaced by module_param() everywhere. It turned out that we never did that (noone really wants a namespace for core parameters), then also overloaded that struct to do early_param()...
Thanks!
Rusty.
Signature · 1 line
Help! Save Australia from the worst of the DMCA: http://linux.org.au/law