ia64/xen-unstable

changeset 15426:799b3e4bfeac

kernel command line extension

In order to allow appending to the dom0 command line even with boot
loaders that only allow editing the kernel (i.e. Xen in our case)
command line, support a '--' separator option.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Wed Jun 20 16:52:01 2007 +0100 (2007-06-20)
parents 79b180596baf
children 9c6076750685
files xen/arch/x86/setup.c
line diff
     1.1 --- a/xen/arch/x86/setup.c	Wed Jun 20 16:18:03 2007 +0100
     1.2 +++ b/xen/arch/x86/setup.c	Wed Jun 20 16:52:01 2007 +0100
     1.3 @@ -405,7 +405,7 @@ void init_done(void)
     1.4  void __init __start_xen(unsigned long mbi_p)
     1.5  {
     1.6      char *memmap_type = NULL;
     1.7 -    char __cmdline[] = "", *cmdline = __cmdline;
     1.8 +    char __cmdline[] = "", *cmdline = __cmdline, *kextra;
     1.9      unsigned long _initrd_start = 0, _initrd_len = 0;
    1.10      unsigned int initrdidx = 1;
    1.11      char *_policy_start = NULL;
    1.12 @@ -426,6 +426,17 @@ void __init __start_xen(unsigned long mb
    1.13      /* Parse the command-line options. */
    1.14      if ( (mbi->flags & MBI_CMDLINE) && (mbi->cmdline != 0) )
    1.15          cmdline = __va(mbi->cmdline);
    1.16 +    if ( (kextra = strstr(cmdline, " -- ")) != NULL )
    1.17 +    {
    1.18 +        /*
    1.19 +         * Options after ' -- ' separator belong to dom0.
    1.20 +         *  1. Orphan dom0's options from Xen's command line.
    1.21 +         *  2. Skip all but final leading space from dom0's options.
    1.22 +         */
    1.23 +        *kextra = '\0';
    1.24 +        kextra += 3;
    1.25 +        while ( kextra[1] == ' ' ) kextra++;
    1.26 +    }
    1.27      cmdline_parse(cmdline);
    1.28  
    1.29      parse_video_info();
    1.30 @@ -1009,18 +1020,27 @@ void __init __start_xen(unsigned long mb
    1.31  
    1.32      /* Grab the DOM0 command line. */
    1.33      cmdline = (char *)(mod[0].string ? __va(mod[0].string) : NULL);
    1.34 -    if ( cmdline != NULL )
    1.35 +    if ( (cmdline != NULL) || (kextra != NULL) )
    1.36      {
    1.37          static char dom0_cmdline[MAX_GUEST_CMDLINE];
    1.38  
    1.39 -        /* Skip past the image name and copy to a local buffer. */
    1.40 -        while ( *cmdline == ' ' ) cmdline++;
    1.41 -        if ( (cmdline = strchr(cmdline, ' ')) != NULL )
    1.42 +        dom0_cmdline[0] = '\0';
    1.43 +
    1.44 +        if ( cmdline != NULL )
    1.45          {
    1.46 +            /* Skip past the image name and copy to a local buffer. */
    1.47              while ( *cmdline == ' ' ) cmdline++;
    1.48 -            safe_strcpy(dom0_cmdline, cmdline);
    1.49 +            if ( (cmdline = strchr(cmdline, ' ')) != NULL )
    1.50 +            {
    1.51 +                while ( *cmdline == ' ' ) cmdline++;
    1.52 +                safe_strcpy(dom0_cmdline, cmdline);
    1.53 +            }
    1.54          }
    1.55  
    1.56 +        if ( kextra != NULL )
    1.57 +            /* kextra always includes exactly one leading space. */
    1.58 +            safe_strcat(dom0_cmdline, kextra);
    1.59 +
    1.60          /* Append any extra parameters. */
    1.61          if ( skip_ioapic_setup && !strstr(dom0_cmdline, "noapic") )
    1.62              safe_strcat(dom0_cmdline, " noapic");