grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH grub-core/kern/xen/init.c] pvgrub2 xen cmdline xenstore var to gr


From: Mark Pryor
Subject: [PATCH grub-core/kern/xen/init.c] pvgrub2 xen cmdline xenstore var to grubenv
Date: Fri, 23 Oct 2015 17:11:33 -0700

When entering the grub2 shell during a pvgrub2 boot, there is no info about the 
current
domU in the grubenv (set). Starting with a patch submitted by Olaf Herring I 
exported
the xenstore cmdline only.

The env var, xen_cmdline, can then be used in the top level script used to make
the pvgrub2 kernel blob.

Signed-off-by: Mark Pryor <address@hidden>
---
 grub-core/kern/xen/init.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/grub-core/kern/xen/init.c b/grub-core/kern/xen/init.c
index 0559c03..2a3112d 100644
--- a/grub-core/kern/xen/init.c
+++ b/grub-core/kern/xen/init.c
@@ -524,6 +524,29 @@ map_all_pages (void)
   grub_mm_init_region ((void *) heap_start, heap_end - heap_start);
 }
 
+/*
+ * Find all name=val pairs in the provided cmd_line and export them
+ * so that scripts can evaluate the variables for their own purpose.
+ */
+static void
+export_cmdline (void)
+{
+  char *p;
+  const char *name="xen_cmdline";
+
+  p = grub_malloc (MAX_GUEST_CMDLINE + 1);
+  if (!p)
+    return;
+
+  grub_memcpy (p, grub_xen_start_page_addr->cmd_line, MAX_GUEST_CMDLINE);
+  p[MAX_GUEST_CMDLINE] = '\0';
+
+  grub_env_set (name, p);
+  grub_env_export (name);
+
+   grub_free (p);
+}
+
 extern char _end[];
 
 void
@@ -539,6 +562,8 @@ grub_machine_init (void)
 
   map_all_pages ();
 
+  export_cmdline ();
+
   grub_console_init ();
 
   grub_tsc_init ();
-- 
2.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]