datadir: Use bundle mechanism
softmmu/datadir.c had its own implementation to find files in the build tree, but now bundle mechanism provides the unified implementation which works for datadir and the other files. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20220624145039.49929-4-akihiko.odaki@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
cf60ccc330
commit
882084a04a
@ -223,7 +223,7 @@ jobs:
|
|||||||
- BUILD_RC=0 && make -j${JOBS} || BUILD_RC=$?
|
- BUILD_RC=0 && make -j${JOBS} || BUILD_RC=$?
|
||||||
- |
|
- |
|
||||||
if [ "$BUILD_RC" -eq 0 ] ; then
|
if [ "$BUILD_RC" -eq 0 ] ; then
|
||||||
mv pc-bios/s390-ccw/*.img pc-bios/ ;
|
mv pc-bios/s390-ccw/*.img qemu-bundle/usr/local/share/qemu ;
|
||||||
${TEST_CMD} ;
|
${TEST_CMD} ;
|
||||||
else
|
else
|
||||||
$(exit $BUILD_RC);
|
$(exit $BUILD_RC);
|
||||||
|
@ -40,9 +40,9 @@ else
|
|||||||
endif
|
endif
|
||||||
cp = find_program('cp')
|
cp = find_program('cp')
|
||||||
|
|
||||||
t = []
|
if native_qemu_keymap.found()
|
||||||
foreach km, args: keymaps
|
t = []
|
||||||
if native_qemu_keymap.found()
|
foreach km, args: keymaps
|
||||||
# generate with qemu-kvm
|
# generate with qemu-kvm
|
||||||
t += custom_target(km,
|
t += custom_target(km,
|
||||||
build_by_default: true,
|
build_by_default: true,
|
||||||
@ -50,20 +50,11 @@ foreach km, args: keymaps
|
|||||||
command: [native_qemu_keymap, '-f', '@OUTPUT@', args.split()],
|
command: [native_qemu_keymap, '-f', '@OUTPUT@', args.split()],
|
||||||
install: true,
|
install: true,
|
||||||
install_dir: qemu_datadir / 'keymaps')
|
install_dir: qemu_datadir / 'keymaps')
|
||||||
else
|
endforeach
|
||||||
# copy from source tree
|
|
||||||
t += custom_target(km,
|
|
||||||
build_by_default: true,
|
|
||||||
input: km,
|
|
||||||
output: km,
|
|
||||||
command: [cp, '@INPUT@', '@OUTPUT@'],
|
|
||||||
install: true,
|
|
||||||
install_dir: qemu_datadir / 'keymaps')
|
|
||||||
endif
|
|
||||||
endforeach
|
|
||||||
|
|
||||||
if native_qemu_keymap.found()
|
|
||||||
alias_target('update-keymaps', t)
|
alias_target('update-keymaps', t)
|
||||||
|
else
|
||||||
|
install_data(keymaps.keys(), install_dir: qemu_datadir / 'keymaps')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
install_data(['sl', 'sv'], install_dir: qemu_datadir / 'keymaps')
|
install_data(['sl', 'sv'], install_dir: qemu_datadir / 'keymaps')
|
||||||
|
@ -85,16 +85,9 @@ blobs = [
|
|||||||
'vof-nvram.bin',
|
'vof-nvram.bin',
|
||||||
]
|
]
|
||||||
|
|
||||||
ln_s = [find_program('ln', required: true), '-sf']
|
if get_option('install_blobs')
|
||||||
foreach f : blobs
|
install_data(blobs, install_dir: qemu_datadir)
|
||||||
roms += custom_target(f,
|
endif
|
||||||
build_by_default: have_system,
|
|
||||||
output: f,
|
|
||||||
input: files('meson.build'), # dummy input
|
|
||||||
install: get_option('install_blobs'),
|
|
||||||
install_dir: qemu_datadir,
|
|
||||||
command: [ ln_s, meson.project_source_root() / 'pc-bios' / f, '@OUTPUT@' ])
|
|
||||||
endforeach
|
|
||||||
|
|
||||||
subdir('descriptors')
|
subdir('descriptors')
|
||||||
subdir('keymaps')
|
subdir('keymaps')
|
||||||
|
@ -64,7 +64,7 @@ mkdir -p "$DEST_DIR/lib/" # Copy the shared libraries here
|
|||||||
|
|
||||||
# Build once to get the list of dynamic lib paths, and copy them over
|
# Build once to get the list of dynamic lib paths, and copy them over
|
||||||
../configure --disable-werror --cc="$CC" --cxx="$CXX" --enable-fuzzing \
|
../configure --disable-werror --cc="$CC" --cxx="$CXX" --enable-fuzzing \
|
||||||
--prefix="$DEST_DIR" --bindir="$DEST_DIR" --datadir="$DEST_DIR/data/" \
|
--prefix="/opt/qemu-oss-fuzz" \
|
||||||
--extra-cflags="$EXTRA_CFLAGS" --target-list="i386-softmmu"
|
--extra-cflags="$EXTRA_CFLAGS" --target-list="i386-softmmu"
|
||||||
|
|
||||||
if ! make "-j$(nproc)" qemu-fuzz-i386; then
|
if ! make "-j$(nproc)" qemu-fuzz-i386; then
|
||||||
@ -81,14 +81,14 @@ if [ "$GITLAB_CI" != "true" ]; then
|
|||||||
|
|
||||||
# Build a second time to build the final binary with correct rpath
|
# Build a second time to build the final binary with correct rpath
|
||||||
../configure --disable-werror --cc="$CC" --cxx="$CXX" --enable-fuzzing \
|
../configure --disable-werror --cc="$CC" --cxx="$CXX" --enable-fuzzing \
|
||||||
--prefix="$DEST_DIR" --bindir="$DEST_DIR" --datadir="$DEST_DIR/data/" \
|
--prefix="/opt/qemu-oss-fuzz" \
|
||||||
--extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="-Wl,-rpath,\$ORIGIN/lib" \
|
--extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="-Wl,-rpath,\$ORIGIN/lib" \
|
||||||
--target-list="i386-softmmu"
|
--target-list="i386-softmmu"
|
||||||
make "-j$(nproc)" qemu-fuzz-i386 V=1
|
make "-j$(nproc)" qemu-fuzz-i386 V=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy over the datadir
|
# Prepare a preinstalled tree
|
||||||
cp -r ../pc-bios/ "$DEST_DIR/pc-bios"
|
make install DESTDIR=$DEST_DIR/qemu-bundle
|
||||||
|
|
||||||
targets=$(./qemu-fuzz-i386 | awk '$1 ~ /\*/ {print $2}')
|
targets=$(./qemu-fuzz-i386 | awk '$1 ~ /\*/ {print $2}')
|
||||||
base_copy="$DEST_DIR/qemu-fuzz-i386-target-$(echo "$targets" | head -n 1)"
|
base_copy="$DEST_DIR/qemu-fuzz-i386-target-$(echo "$targets" | head -n 1)"
|
||||||
|
@ -83,26 +83,6 @@ void qemu_add_data_dir(char *path)
|
|||||||
data_dir[data_dir_idx++] = path;
|
data_dir[data_dir_idx++] = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Find a likely location for support files using the location of the binary.
|
|
||||||
* When running from the build tree this will be "$bindir/pc-bios".
|
|
||||||
* Otherwise, this is CONFIG_QEMU_DATADIR (possibly relocated).
|
|
||||||
*
|
|
||||||
* The caller must use g_free() to free the returned data when it is
|
|
||||||
* no longer required.
|
|
||||||
*/
|
|
||||||
static char *find_datadir(void)
|
|
||||||
{
|
|
||||||
g_autofree char *dir = NULL;
|
|
||||||
|
|
||||||
dir = g_build_filename(qemu_get_exec_dir(), "pc-bios", NULL);
|
|
||||||
if (g_file_test(dir, G_FILE_TEST_IS_DIR)) {
|
|
||||||
return g_steal_pointer(&dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
return get_relocated_path(CONFIG_QEMU_DATADIR);
|
|
||||||
}
|
|
||||||
|
|
||||||
void qemu_add_default_firmwarepath(void)
|
void qemu_add_default_firmwarepath(void)
|
||||||
{
|
{
|
||||||
char **dirs;
|
char **dirs;
|
||||||
@ -116,7 +96,7 @@ void qemu_add_default_firmwarepath(void)
|
|||||||
g_strfreev(dirs);
|
g_strfreev(dirs);
|
||||||
|
|
||||||
/* try to find datadir relative to the executable path */
|
/* try to find datadir relative to the executable path */
|
||||||
qemu_add_data_dir(find_datadir());
|
qemu_add_data_dir(get_relocated_path(CONFIG_QEMU_DATADIR));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qemu_list_data_dirs(void)
|
void qemu_list_data_dirs(void)
|
||||||
|
@ -158,8 +158,6 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char ***envp)
|
|||||||
{
|
{
|
||||||
|
|
||||||
char *target_name;
|
char *target_name;
|
||||||
const char *bindir;
|
|
||||||
char *datadir;
|
|
||||||
GString *cmd_line;
|
GString *cmd_line;
|
||||||
gchar *pretty_cmd_line;
|
gchar *pretty_cmd_line;
|
||||||
bool serialize = false;
|
bool serialize = false;
|
||||||
@ -174,22 +172,6 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char ***envp)
|
|||||||
target_name = strstr(**argv, "-target-");
|
target_name = strstr(**argv, "-target-");
|
||||||
if (target_name) { /* The binary name specifies the target */
|
if (target_name) { /* The binary name specifies the target */
|
||||||
target_name += strlen("-target-");
|
target_name += strlen("-target-");
|
||||||
/*
|
|
||||||
* With oss-fuzz, the executable is kept in the root of a directory (we
|
|
||||||
* cannot assume the path). All data (including bios binaries) must be
|
|
||||||
* in the same dir, or a subdir. Thus, we cannot place the pc-bios so
|
|
||||||
* that it would be in exec_dir/../pc-bios.
|
|
||||||
* As a workaround, oss-fuzz allows us to use argv[0] to get the
|
|
||||||
* location of the executable. Using this we add exec_dir/pc-bios to
|
|
||||||
* the datadirs.
|
|
||||||
*/
|
|
||||||
bindir = qemu_get_exec_dir();
|
|
||||||
datadir = g_build_filename(bindir, "pc-bios", NULL);
|
|
||||||
if (g_file_test(datadir, G_FILE_TEST_IS_DIR)) {
|
|
||||||
qemu_add_data_dir(datadir);
|
|
||||||
} else {
|
|
||||||
g_free(datadir);
|
|
||||||
}
|
|
||||||
} else if (*argc > 1) { /* The target is specified as an argument */
|
} else if (*argc > 1) { /* The target is specified as an argument */
|
||||||
target_name = (*argv)[1];
|
target_name = (*argv)[1];
|
||||||
if (!strstr(target_name, "--fuzz-target=")) {
|
if (!strstr(target_name, "--fuzz-target=")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user