All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] libxl: make firmware_override able to cope with relative path
@ 2016-08-08 14:40 Wei Liu
  2016-08-08 15:09 ` Ian Jackson
  0 siblings, 1 reply; 10+ messages in thread
From: Wei Liu @ 2016-08-08 14:40 UTC (permalink / raw)
  To: Xen-devel; +Cc: Ian Jackson, Wei Liu, Andrew Cooper

And also document that option in xl.cfg(5).

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>

I suppose this should be able to make xtf free from absolute paths in
config files.
---
 docs/man/xl.cfg.pod.5.in | 12 +++++++++++-
 tools/libxl/libxl_dom.c  | 11 +++++++++--
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/docs/man/xl.cfg.pod.5.in b/docs/man/xl.cfg.pod.5.in
index 48c9c0d..f1fffbf 100644
--- a/docs/man/xl.cfg.pod.5.in
+++ b/docs/man/xl.cfg.pod.5.in
@@ -1189,7 +1189,7 @@ accept the defaults for these options wherever possible.
 
 =item B<bios="STRING">
 
-Select the virtual firmware that is exposed to the guest.
+Select the virtual bios that is exposed to the guest.
 By default, a guess is made based on the device model, but sometimes
 it may be useful to request a different one, like UEFI.
 
@@ -1214,6 +1214,16 @@ Requires device_model_version=qemu-xen.
 
 =back
 
+=item B<firmware_override="STRING">
+
+Override the virtual firmware provided by Xen. The value can be an
+absolute or relative path to a file.
+
+If the value is a relative path, searching is frist done in current
+working directory then Xen firmware directory.
+
+If not set, the default hvmloader is used.
+
 =item B<pae=BOOLEAN>
 
 Hide or expose the IA32 Physical Address Extensions. These extensions
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index eef5045..f05aae3 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -905,8 +905,15 @@ static int libxl__domain_firmware(libxl__gc *gc,
         if (rc == 0 && info->ramdisk != NULL)
             rc = xc_dom_ramdisk_file(dom, info->ramdisk);
     } else {
-        rc = xc_dom_kernel_file(dom, libxl__abs_path(gc, firmware,
-                                                 libxl__xenfirmwaredir_path()));
+        const char *firmware_path;
+        struct stat stab;
+
+        if (info->u.hvm.firmware && !stat(firmware, &stab))
+            firmware_path = firmware;
+        else
+            firmware_path =
+                libxl__abs_path(gc, firmware, libxl__xenfirmwaredir_path());
+        rc = xc_dom_kernel_file(dom, firmware_path);
     }
 
     if (rc != 0) {
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-08-08 17:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-08 14:40 [PATCH RFC] libxl: make firmware_override able to cope with relative path Wei Liu
2016-08-08 15:09 ` Ian Jackson
2016-08-08 15:27   ` Wei Liu
2016-08-08 15:49     ` Ian Jackson
2016-08-08 15:59       ` Andrew Cooper
2016-08-08 16:09         ` Ian Jackson
2016-08-08 16:19           ` Andrew Cooper
2016-08-08 16:24             ` Ian Jackson
2016-08-08 16:32               ` Andrew Cooper
2016-08-08 17:00                 ` Ian Jackson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.