blob: 9a4c11267a5e01c994535bad11ca946d0211c867 [file] [log] [blame]
Andrew Geisslerd25ed322020-06-27 00:28:28 -05001qemu: search for datadir as in version 4.2
2
3os_find_datadir() was changed after the 4.2 release. We need to check for
4../share/qemu relative to the executable because that is where the runqemu
5configuration assumes it will be.
6
7Upstream-Status: Submitted [qemu-devel@nongnu.org]
8
9Signed-off-by: Joe Slater <joe.slater@windriver.com>
10
11
Andrew Geissler635e0e42020-08-21 15:58:33 -050012Index: qemu-5.1.0/os-posix.c
13===================================================================
14--- qemu-5.1.0.orig/os-posix.c
15+++ qemu-5.1.0/os-posix.c
Andrew Geisslerd25ed322020-06-27 00:28:28 -050016@@ -82,8 +82,9 @@ void os_setup_signal_handling(void)
17
18 /*
19 * Find a likely location for support files using the location of the binary.
20+ * Typically, this would be "$bindir/../share/qemu".
21 * When running from the build tree this will be "$bindir/../pc-bios".
22- * Otherwise, this is CONFIG_QEMU_DATADIR.
23+ * Otherwise, this is CONFIG_QEMU_DATADIR as constructed by configure.
Andrew Geissler635e0e42020-08-21 15:58:33 -050024 *
25 * The caller must use g_free() to free the returned data when it is
26 * no longer required.
27@@ -96,6 +97,12 @@ char *os_find_datadir(void)
Andrew Geisslerd25ed322020-06-27 00:28:28 -050028 exec_dir = qemu_get_exec_dir();
29 g_return_val_if_fail(exec_dir != NULL, NULL);
30
31+ dir = g_build_filename(exec_dir, "..", "share", "qemu", NULL);
32+ if (g_file_test(dir, G_FILE_TEST_IS_DIR)) {
33+ return g_steal_pointer(&dir);
34+ }
35+ g_free(dir); /* no autofree this time */
36+
37 dir = g_build_filename(exec_dir, "..", "pc-bios", NULL);
38 if (g_file_test(dir, G_FILE_TEST_IS_DIR)) {
39 return g_steal_pointer(&dir);