# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1182354721 -3600
# Node ID 799b3e4bfeac22da13ccc13f15253069438e6b1a
# Parent 79b180596baf8969941da952a37c9d8b312218ff
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@xxxxxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
xen/arch/x86/setup.c | 32 ++++++++++++++++++++++++++------
1 files changed, 26 insertions(+), 6 deletions(-)
diff -r 79b180596baf -r 799b3e4bfeac xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c Wed Jun 20 16:18:03 2007 +0100
+++ b/xen/arch/x86/setup.c Wed Jun 20 16:52:01 2007 +0100
@@ -405,7 +405,7 @@ void __init __start_xen(unsigned long mb
void __init __start_xen(unsigned long mbi_p)
{
char *memmap_type = NULL;
- char __cmdline[] = "", *cmdline = __cmdline;
+ char __cmdline[] = "", *cmdline = __cmdline, *kextra;
unsigned long _initrd_start = 0, _initrd_len = 0;
unsigned int initrdidx = 1;
char *_policy_start = NULL;
@@ -426,6 +426,17 @@ void __init __start_xen(unsigned long mb
/* Parse the command-line options. */
if ( (mbi->flags & MBI_CMDLINE) && (mbi->cmdline != 0) )
cmdline = __va(mbi->cmdline);
+ if ( (kextra = strstr(cmdline, " -- ")) != NULL )
+ {
+ /*
+ * Options after ' -- ' separator belong to dom0.
+ * 1. Orphan dom0's options from Xen's command line.
+ * 2. Skip all but final leading space from dom0's options.
+ */
+ *kextra = '\0';
+ kextra += 3;
+ while ( kextra[1] == ' ' ) kextra++;
+ }
cmdline_parse(cmdline);
parse_video_info();
@@ -1009,17 +1020,26 @@ void __init __start_xen(unsigned long mb
/* Grab the DOM0 command line. */
cmdline = (char *)(mod[0].string ? __va(mod[0].string) : NULL);
- if ( cmdline != NULL )
+ if ( (cmdline != NULL) || (kextra != NULL) )
{
static char dom0_cmdline[MAX_GUEST_CMDLINE];
- /* Skip past the image name and copy to a local buffer. */
- while ( *cmdline == ' ' ) cmdline++;
- if ( (cmdline = strchr(cmdline, ' ')) != NULL )
+ dom0_cmdline[0] = '\0';
+
+ if ( cmdline != NULL )
{
+ /* Skip past the image name and copy to a local buffer. */
while ( *cmdline == ' ' ) cmdline++;
- safe_strcpy(dom0_cmdline, cmdline);
+ if ( (cmdline = strchr(cmdline, ' ')) != NULL )
+ {
+ while ( *cmdline == ' ' ) cmdline++;
+ safe_strcpy(dom0_cmdline, cmdline);
+ }
}
+
+ if ( kextra != NULL )
+ /* kextra always includes exactly one leading space. */
+ safe_strcat(dom0_cmdline, kextra);
/* Append any extra parameters. */
if ( skip_ioapic_setup && !strstr(dom0_cmdline, "noapic") )
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|