diff mbox series

os-posix: Restore firmware location ../share/qemu

Message ID 20200826075705.8961-1-azoff@svenskalinuxforeningen.se (mailing list archive)
State New, archived
Headers show
Series os-posix: Restore firmware location ../share/qemu | expand

Commit Message

azoff@azoff.se Aug. 26, 2020, 7:57 a.m. UTC
Prior to commit 6dd2dacedd83d12328afa8559bffb2b9ec5c89ed (v5.0.0), the
binary relative path ../share/qemu was searched for firmware, but in
that commit, this path got lost.

Consider the following use-case:
* QEMU is built in a docker image on one system.
* QEMU is supposed to be executed on a plethora of distributions/systems
* QEMU is not installed system wide on the executors
When building QEMU, the --prefix configure flag is used to generate a
tree containing all the QEMU resources that needs to be transfered to
the executors. The path to the root of the QEMU tree might be different
for the different executors, therefore, the path stored in
CONFIG_QEMU_DATADIR is likely not the right one.
With this use-case, the only likely path is one that is expressed as
relative to the root of the QEMU binary tree or the QEMU binary iself.

Signed-off-by: Torbjörn Svensson <azoff@svenskalinuxforeningen.se>
---
 os-posix.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/os-posix.c b/os-posix.c
index bf98508b6d..f016ac374c 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -96,6 +96,11 @@  char *os_find_datadir(void)
     exec_dir = qemu_get_exec_dir();
     g_return_val_if_fail(exec_dir != NULL, NULL);
 
+    dir = g_build_filename(exec_dir, "..", "share", "qemu", NULL);
+    if (g_file_test(dir, G_FILE_TEST_IS_DIR)) {
+        return g_steal_pointer(&dir);
+    }
+
     dir = g_build_filename(exec_dir, "pc-bios", NULL);
     if (g_file_test(dir, G_FILE_TEST_IS_DIR)) {
         return g_steal_pointer(&dir);