All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>,
	Wei Liu <wei.liu2@citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [PATCH RFC] libxl: make firmware_override able to cope with relative path
Date: Mon, 8 Aug 2016 15:40:04 +0100	[thread overview]
Message-ID: <1470667204-12077-1-git-send-email-wei.liu2@citrix.com> (raw)

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

             reply	other threads:[~2016-08-08 14:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-08 14:40 Wei Liu [this message]
2016-08-08 15:09 ` [PATCH RFC] libxl: make firmware_override able to cope with relative path 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1470667204-12077-1-git-send-email-wei.liu2@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.