[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 2/4] 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. --- 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 <cjwatson@xxxxxxxxxx> + 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 <cjwatson@xxxxxxxxxx> + 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 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |