[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/4] Accept environment variables on the command line for Xen.
From: |
Colin Watson |
Subject: |
[PATCH 2/4] Accept environment variables on the command line for Xen. |
Date: |
Thu, 12 Dec 2013 15:37:22 +0000 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
* grub-core/kern/xen/init.c (fetch_command_line_word): New function.
(parse_command_line): Likewise.
(grub_machine_init): Call parse_command_line.
---
ChangeLog | 8 ++++++++
grub-core/kern/xen/init.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 766fe4b..fc86601 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2013-12-12 Colin Watson <address@hidden>
+ Accept environment variables on the command line for Xen.
+
+ * grub-core/kern/xen/init.c (fetch_command_line_word): New function.
+ (parse_command_line): Likewise.
+ (grub_machine_init): Call parse_command_line.
+
+2013-12-12 Colin Watson <address@hidden>
+
Add an option to exclude devices from search results.
* grub-core/commands/search.c (struct search_ctx): Add excludes and
diff --git a/grub-core/kern/xen/init.c b/grub-core/kern/xen/init.c
index 1d8eaec..eb9b8b3 100644
--- a/grub-core/kern/xen/init.c
+++ b/grub-core/kern/xen/init.c
@@ -525,6 +525,48 @@ map_all_pages (void)
grub_mm_init_region ((void *) heap_start, heap_end - heap_start);
}
+static char *
+fetch_command_line_word (char *pos, char **word)
+{
+ while (grub_isspace (*pos))
+ pos++;
+
+ if (!*pos)
+ return NULL;
+
+ *word = pos;
+ while (*pos && !grub_isspace (*pos))
+ pos++;
+ if (*pos)
+ *pos++ = '\0';
+ return pos;
+}
+
+static void
+parse_command_line (void)
+{
+ char *cmd_line;
+ char *pos, *word;
+
+ cmd_line = grub_malloc (MAX_GUEST_CMDLINE + 1);
+ grub_memcpy (cmd_line, grub_xen_start_page_addr->cmd_line,
+ MAX_GUEST_CMDLINE);
+ cmd_line[MAX_GUEST_CMDLINE] = '\0';
+ pos = cmd_line;
+ while ((pos = fetch_command_line_word (pos, &word)) != NULL)
+ {
+ char *equals;
+
+ equals = grub_strchr (word, '=');
+ if (!equals)
+ continue;
+
+ *equals = '\0';
+ grub_env_set (word, equals + 1);
+ }
+ grub_free (cmd_line);
+}
+
extern char _end[];
void
@@ -547,6 +589,8 @@ grub_machine_init (void)
grub_xendisk_init ();
grub_boot_init ();
+
+ parse_command_line ();
}
void
--
1.8.4.4
- [PATCH 0/4] Turn-key PV-GRUB2 installation, Colin Watson, 2013/12/12
- [PATCH 1/4] Add an option to exclude devices from search results., Colin Watson, 2013/12/12
- Re: [Xen-devel] [PATCH 1/4] Add an option to exclude devices from search results., Vladimir 'φ-coder/phcoder' Serbinenko, 2013/12/13
- Re: [Xen-devel] [PATCH 1/4] Add an option to exclude devices from search results., Colin Watson, 2013/12/13
- [PATCH] add --boot-directory option to grub-mkstandalone, Andrey Borzenkov, 2013/12/13
- Re: [PATCH] add --boot-directory option to grub-mkstandalone, Colin Watson, 2013/12/20
- Re: [PATCH] add --boot-directory option to grub-mkstandalone, Andrey Borzenkov, 2013/12/21
- Re: [PATCH] add --boot-directory option to grub-mkstandalone, Andrey Borzenkov, 2013/12/21
- Re: [Xen-devel] [PATCH 1/4] Add an option to exclude devices from search results., Jordan Uggla, 2013/12/22
[PATCH 2/4] Accept environment variables on the command line for Xen.,
Colin Watson <=
- Re: [PATCH 2/4] Accept environment variables on the command line for Xen., Andrey Borzenkov, 2013/12/12
- Re: [PATCH 2/4] Accept environment variables on the command line for Xen., Vladimir 'phcoder' Serbinenko, 2013/12/12
- Re: [PATCH 2/4] Accept environment variables on the command line for Xen., Andrey Borzenkov, 2013/12/12
- Re: [PATCH 2/4] Accept environment variables on the command line for Xen., Vladimir 'φ-coder/phcoder' Serbinenko, 2013/12/12
- Re: [PATCH 2/4] Accept environment variables on the command line for Xen., Colin Watson, 2013/12/12
- Re: [PATCH 2/4] Accept environment variables on the command line for Xen., Vladimir 'φ-coder/phcoder' Serbinenko, 2013/12/12
[PATCH 3/4] Build grub.xen., Colin Watson, 2013/12/12