From nobody Tue Feb 10 00:39:42 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1657789772; cv=none; d=zohomail.com; s=zohoarc; b=g7akCyFKH2DSP7UCW1Vp7xmhW+cQ8l77fALl+ZgYkUfVWtrYpvXSncJjvn/+FUxMqsD8+A1cbhiXp1YAVN4xOBXDOzcwrRlR+lJxl4H4gmUDTgTGt46rmrSZsJYNWfe/MKf0neCqSanz4AC5RKsfsw/q9Nt8zc/Qvh6dJCBoUyA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657789772; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PuZojlBvMJHakpry/pxYzjDQngsN2NNKxuawl1RMhPU=; b=PdSmbcgpEWzTzbX8GIFq/gRnPm0V08R4oHinm/Zt9mT4wN5t5GhAZHtNu6DQcgl5IhE4mhLM+k32LjI+FPmhk3iUBSIHPjQ8sp2b5xNsLOokVW4sHeB8GokCbUN+YHcDabGEDTPD8at/YkFVjFVi+bSSjODkQI/OMdGzeW7Yz6w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1657789772462612.8316179433796; Thu, 14 Jul 2022 02:09:32 -0700 (PDT) Received: from localhost ([::1]:53930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBuqh-0001RU-Dj for importer@patchew.org; Thu, 14 Jul 2022 05:09:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40562) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBujt-00056F-Dd for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:38767) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBujn-0005ub-RG for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:29 -0400 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-632-MqQ9yY68N96reyfVW6TU0g-1; Thu, 14 Jul 2022 05:02:21 -0400 Received: by mail-ej1-f70.google.com with SMTP id s4-20020a170906500400b006feaccb3a0eso507962ejj.11 for ; Thu, 14 Jul 2022 02:02:21 -0700 (PDT) Received: from goa-sendmail ([93.56.169.184]) by smtp.gmail.com with ESMTPSA id l9-20020a1709063d2900b00722f66fb36csm447677ejf.112.2022.07.14.02.02.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 02:02:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657789343; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PuZojlBvMJHakpry/pxYzjDQngsN2NNKxuawl1RMhPU=; b=iHYtwsfbdZJc7i2ec8P78jXYDcqKSrQUqmCfyjjhvty89NcrZUOdqxLRpsKRGpp4o1NAXb Ug5ivHRnbiO8CGkJBrsPMXVxwfCVXDw4RpjFInI5dwpM2O6bQ7wl86GvR1DOnGWE1uPcKH uF58QVFxra1neEIO4CXIHUr9TRglodE= X-MC-Unique: MqQ9yY68N96reyfVW6TU0g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PuZojlBvMJHakpry/pxYzjDQngsN2NNKxuawl1RMhPU=; b=3YBy/JZ0bsfg7+u2LbN0PBQtsyrwqHeZ4Jz1ZvRmhNkl+6iLbor24HRr51+So4ihsu 2ger11Oe3FJoHMq2RLGQLqQtGuROF/50e1wApDRryRmPH1x7oKui4JvHNWMb44DDkYx7 vIgvoDTbSUnkJyTQtR7IquekjF7G93Wwk40DHQNbmCgbN8btoSEGEdn/9JSSASLiCLW6 RGahnYHqE2kc3b4gymuMKG+Irw55d4jGTtFTgW6zeaXeuYo3Al2HaIIboRwH2fe6AvME ptY6K3n2RGyP/j/48Ckj3cZhK65vCgZYMMnlQvRRAKd2WOhh909LjhmfCrW7ecWaBmYS WkCw== X-Gm-Message-State: AJIora/sR4CcNdF7jYSpd/vIoKOUIfq6SODcxshTUhwXafSvUpuaSDQ4 jVMA63CXVrISekVbExJqRggTR/dTuONFFOk/LN00VkVmBrtt7yZJpXYSzvOauH8wn92m5Houd0r e9+Yz8WMX8Ebmg3vYBv/yvJ4DBVPJajfx5anBRPvgIZ+fhzq8RiDG2RtsqzqaoxN/o5s= X-Received: by 2002:a17:906:4786:b0:722:e5ac:7d96 with SMTP id cw6-20020a170906478600b00722e5ac7d96mr8071565ejc.172.1657789339587; Thu, 14 Jul 2022 02:02:19 -0700 (PDT) X-Google-Smtp-Source: AGRyM1szn6ZZSS89yyjVTCMqwCayjt6Bl/sdpOAXFSd9CezXduDrr0t9lwp//DH9/CE4P2bVlVjq5A== X-Received: by 2002:a17:906:4786:b0:722:e5ac:7d96 with SMTP id cw6-20020a170906478600b00722e5ac7d96mr8071538ejc.172.1657789339218; Thu, 14 Jul 2022 02:02:19 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Akihiko Odaki Subject: [PULL 03/20] datadir: Use bundle mechanism Date: Thu, 14 Jul 2022 11:01:54 +0200 Message-Id: <20220714090211.304305-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220714090211.304305-1-pbonzini@redhat.com> References: <20220714090211.304305-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1657789774576100001 Content-Type: text/plain; charset="utf-8" From: Akihiko Odaki 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 Message-Id: <20220624145039.49929-4-akihiko.odaki@gmail.com> Signed-off-by: Paolo Bonzini --- .travis.yml | 2 +- pc-bios/keymaps/meson.build | 21 ++++++--------------- pc-bios/meson.build | 13 +++---------- scripts/oss-fuzz/build.sh | 8 ++++---- softmmu/datadir.c | 22 +--------------------- tests/qtest/fuzz/fuzz.c | 18 ------------------ 6 files changed, 15 insertions(+), 69 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9afc4a54b8..4fdc9a6785 100644 --- a/.travis.yml +++ b/.travis.yml @@ -223,7 +223,7 @@ jobs: - BUILD_RC=3D0 && make -j${JOBS} || BUILD_RC=3D$? - | 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} ; else $(exit $BUILD_RC); diff --git a/pc-bios/keymaps/meson.build b/pc-bios/keymaps/meson.build index 44247a12b5..2837eb34f4 100644 --- a/pc-bios/keymaps/meson.build +++ b/pc-bios/keymaps/meson.build @@ -40,9 +40,9 @@ else endif cp =3D find_program('cp') =20 -t =3D [] -foreach km, args: keymaps - if native_qemu_keymap.found() +if native_qemu_keymap.found() + t =3D [] + foreach km, args: keymaps # generate with qemu-kvm t +=3D custom_target(km, build_by_default: true, @@ -50,20 +50,11 @@ foreach km, args: keymaps command: [native_qemu_keymap, '-f', '@OUTPUT@', arg= s.split()], install: true, install_dir: qemu_datadir / 'keymaps') - else - # copy from source tree - t +=3D custom_target(km, - build_by_default: true, - input: km, - output: km, - command: [cp, '@INPUT@', '@OUTPUT@'], - install: true, - install_dir: qemu_datadir / 'keymaps') - endif -endforeach + endforeach =20 -if native_qemu_keymap.found() alias_target('update-keymaps', t) +else + install_data(keymaps.keys(), install_dir: qemu_datadir / 'keymaps') endif =20 install_data(['sl', 'sv'], install_dir: qemu_datadir / 'keymaps') diff --git a/pc-bios/meson.build b/pc-bios/meson.build index 41ba1c0ec7..388e0db6e4 100644 --- a/pc-bios/meson.build +++ b/pc-bios/meson.build @@ -85,16 +85,9 @@ blobs =3D [ 'vof-nvram.bin', ] =20 -ln_s =3D [find_program('ln', required: true), '-sf'] -foreach f : blobs - roms +=3D custom_target(f, - 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 +if get_option('install_blobs') + install_data(blobs, install_dir: qemu_datadir) +endif =20 subdir('descriptors') subdir('keymaps') diff --git a/scripts/oss-fuzz/build.sh b/scripts/oss-fuzz/build.sh index aaf485cb55..2656a89aea 100755 --- a/scripts/oss-fuzz/build.sh +++ b/scripts/oss-fuzz/build.sh @@ -64,7 +64,7 @@ mkdir -p "$DEST_DIR/lib/" # Copy the shared libraries he= re =20 # Build once to get the list of dynamic lib paths, and copy them over ../configure --disable-werror --cc=3D"$CC" --cxx=3D"$CXX" --enable-fuzzing= \ - --prefix=3D"$DEST_DIR" --bindir=3D"$DEST_DIR" --datadir=3D"$DEST_DIR/d= ata/" \ + --prefix=3D"/opt/qemu-oss-fuzz" \ --extra-cflags=3D"$EXTRA_CFLAGS" --target-list=3D"i386-softmmu" =20 if ! make "-j$(nproc)" qemu-fuzz-i386; then @@ -81,14 +81,14 @@ if [ "$GITLAB_CI" !=3D "true" ]; then =20 # Build a second time to build the final binary with correct rpath ../configure --disable-werror --cc=3D"$CC" --cxx=3D"$CXX" --enable-fuz= zing \ - --prefix=3D"$DEST_DIR" --bindir=3D"$DEST_DIR" --datadir=3D"$DEST_D= IR/data/" \ + --prefix=3D"/opt/qemu-oss-fuzz" \ --extra-cflags=3D"$EXTRA_CFLAGS" --extra-ldflags=3D"-Wl,-rpath,\$O= RIGIN/lib" \ --target-list=3D"i386-softmmu" make "-j$(nproc)" qemu-fuzz-i386 V=3D1 fi =20 -# Copy over the datadir -cp -r ../pc-bios/ "$DEST_DIR/pc-bios" +# Prepare a preinstalled tree +make install DESTDIR=3D$DEST_DIR/qemu-bundle =20 targets=3D$(./qemu-fuzz-i386 | awk '$1 ~ /\*/ {print $2}') base_copy=3D"$DEST_DIR/qemu-fuzz-i386-target-$(echo "$targets" | head -n 1= )" diff --git a/softmmu/datadir.c b/softmmu/datadir.c index 160cac999a..697cffea93 100644 --- a/softmmu/datadir.c +++ b/softmmu/datadir.c @@ -83,26 +83,6 @@ void qemu_add_data_dir(char *path) data_dir[data_dir_idx++] =3D path; } =20 -/* - * Find a likely location for support files using the location of the bina= ry. - * 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 =3D NULL; - - dir =3D 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) { char **dirs; @@ -116,7 +96,7 @@ void qemu_add_default_firmwarepath(void) g_strfreev(dirs); =20 /* 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)); } =20 void qemu_list_data_dirs(void) diff --git a/tests/qtest/fuzz/fuzz.c b/tests/qtest/fuzz/fuzz.c index 0ad4ba9e94..2b3bc1fb9d 100644 --- a/tests/qtest/fuzz/fuzz.c +++ b/tests/qtest/fuzz/fuzz.c @@ -158,8 +158,6 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char = ***envp) { =20 char *target_name; - const char *bindir; - char *datadir; GString *cmd_line; gchar *pretty_cmd_line; bool serialize =3D false; @@ -174,22 +172,6 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char= ***envp) target_name =3D strstr(**argv, "-target-"); if (target_name) { /* The binary name specifies the target */ target_name +=3D strlen("-target-"); - /* - * With oss-fuzz, the executable is kept in the root of a director= y (we - * cannot assume the path). All data (including bios binaries) mus= t 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 =3D qemu_get_exec_dir(); - datadir =3D 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 */ target_name =3D (*argv)[1]; if (!strstr(target_name, "--fuzz-target=3D")) { --=20 2.36.1