From nobody Sun Nov 16 14:00:37 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601906271; cv=none; d=zohomail.com; s=zohoarc; b=BihR7k7Sgs3KDt65YNGxAuVOS4lYxAujl7Sx95H9nVOdsThkY8jOH0TIIgwUIcCsS1nc72Rp4Ad7wuE5pKOhX3RqPaZtV6tSA7KGFA067lA+OUO/hl3CqK1B/Msi9fSvj2rq/tfApbcpPswEMrHzke1pC2GjkUjpx55NM4s7P8A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601906271; h=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=U7sNZB2VXonlY+9BgEDJ21Ard5jJhPjK31W+FYncWDk=; b=KQzGP8LpBwDNFVQLM2H668ntoXgQvimk2QFmRDLV1myFmmGH693EigF5X5qH0elOOoTlvGh48vbEAatwbHOsuBchcmcHP21a8yhLLa9Pv+mnc1hWdeF15M5pwaPKf/BapETqDsW2fS1MkHOSf1RmiOWjneGPNm1Ca4tTt90kWpE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601906271534152.7860824888138; Mon, 5 Oct 2020 06:57:51 -0700 (PDT) Received: from localhost ([::1]:56034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPQzu-0008TA-6L for importer@patchew.org; Mon, 05 Oct 2020 09:57:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPQyS-00078T-08 for qemu-devel@nongnu.org; Mon, 05 Oct 2020 09:56:20 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:39436) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kPQyO-0000NT-S0 for qemu-devel@nongnu.org; Mon, 05 Oct 2020 09:56:19 -0400 Received: by mail-wr1-x443.google.com with SMTP id k10so9683837wru.6 for ; Mon, 05 Oct 2020 06:56:16 -0700 (PDT) Received: from localhost.localdomain ([2001:b07:6468:f312:2e86:3d8b:8b70:920c]) by smtp.gmail.com with ESMTPSA id c8sm13406559wmd.18.2020.10.05.06.56.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Oct 2020 06:56:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=U7sNZB2VXonlY+9BgEDJ21Ard5jJhPjK31W+FYncWDk=; b=H+TyBtcIfwbf1aFsmsGBXxStLECRz/OSrT+CQaY8inLX+VuJOaBfSIj5j1HSr682vg TCOztDVSDrp/zQIebgq8xne4oQ3aTgh1wsveWNBkGqB9sGuBA3iEMlPsThxBj5hVAWNE qel3artLMA/fmsrbERFJuwz+DHgEf1EzkzpBNHviPxwFfN2s7Sc4BfOjrk2hYChsIp4g Fq01KhZ9Oemo9mRik1JFsGE04aDEnkSHSacouJjDLj9okx1wL5NwzkiFPOFbshLwwHPd 8tKjo4Xn50ECEJhDRziD2tAU6yJlEmRD+PrmwO8OIrtuogL2zMTuoFuJq50jGFHl8Rfo Igqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=U7sNZB2VXonlY+9BgEDJ21Ard5jJhPjK31W+FYncWDk=; b=rZCtdmMzQMH3FIqk2p7d4474Hnz+yNTApsxopQNogbpFIoRJG0ycseazSfQFDO1Thz Fvzeq1UqVVCU2sICG1yuNdDKZyXSCDCza+8mmehJ6zM5GSfTqpoqlIYaa9JXtH/APT1Z OcnXzTz94rze6Ap+ZCkZUZ2/TsCEL+Rmtt3inOSIfA4nXsD5VJAjKGv7O5qYMvqHWXGH 5wvVrZWAdbcmVCjhgNbzQ1DSOivRIVU3P3C11/tD1Sqp5zHMOcv2RUV2B9IuCJrHexf0 o/3DdCFHj8kSnu+nSOnvNWGuG6jnNfL0Gp2OOZfFbnpWCydWB6/pZOFo1o4E20/Mt+MC /mXA== X-Gm-Message-State: AOAM533FXLTlBPTySaHWEKrypYdJ5PtYEva/a++00MhRHqKSf7ioa9VJ svk4MA1B+PQp9zJ6fhBylv5TtYbs50A= X-Google-Smtp-Source: ABdhPJzvyksxF/JK/7tQBh3sRITDzqCkhyLe9ivCkSO9I2H6lAS+utBvl0HcWiOgClmrL6FY4nt4Iw== X-Received: by 2002:a05:6000:10ce:: with SMTP id b14mr6002072wrx.204.1601906174831; Mon, 05 Oct 2020 06:56:14 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 2/4] dtc: Convert Makefile bits to meson bits Date: Mon, 5 Oct 2020 15:56:11 +0200 Message-Id: <20201005135613.435932-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201005135613.435932-1-pbonzini@redhat.com> References: <20201005135613.435932-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=2a00:1450:4864:20::443; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x443.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marcandre.lureau@redhat.com, richard.henderson@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Build the library via the main meson.build just like for capstone. This improves the current state of affairs in that we will re-link the qemu executables against a changed libfdt.a, which we wouldn't do before-hand, and lets us remove the whole recursive make machinery. The list of targets that require FDT is now obtained from default-configs/ instead of being hardcoded in the configure script. Signed-off-by: Paolo Bonzini --- Makefile | 23 +---- configure | 93 ++++--------------- default-configs/targets/aarch64-softmmu.mak | 1 + default-configs/targets/arm-softmmu.mak | 1 + .../targets/microblaze-softmmu.mak | 1 + .../targets/microblazeel-softmmu.mak | 1 + default-configs/targets/mips64el-softmmu.mak | 1 + default-configs/targets/ppc-softmmu.mak | 1 + default-configs/targets/ppc64-softmmu.mak | 1 + default-configs/targets/riscv32-softmmu.mak | 1 + default-configs/targets/riscv64-softmmu.mak | 1 + default-configs/targets/rx-softmmu.mak | 1 + meson.build | 61 ++++++++++-- meson_options.txt | 3 + 14 files changed, 84 insertions(+), 106 deletions(-) diff --git a/Makefile b/Makefile index 9d6b7fc8c0..c37e513431 100644 --- a/Makefile +++ b/Makefile @@ -142,28 +142,6 @@ SUBDIR_MAKEFLAGS=3D$(if $(V),,--no-print-directory --q= uiet) include $(SRC_PATH)/tests/Makefile.include =20 all: recurse-all -Makefile: $(addsuffix /all, $(SUBDIRS)) - -# LIBFDT_lib=3D"": avoid breaking existing trees with objects requiring -f= PIC -DTC_MAKE_ARGS=3D-I$(SRC_PATH)/dtc VPATH=3D$(SRC_PATH)/dtc -C dtc V=3D"$(V)= " LIBFDT_lib=3D"" -DTC_CFLAGS=3D$(CFLAGS) $(QEMU_CFLAGS) -DTC_CPPFLAGS=3D-I$(SRC_PATH)/dtc/libfdt - -.PHONY: dtc/all -dtc/all: .git-submodule-status dtc/libfdt - $(call quiet-command,$(MAKE) $(DTC_MAKE_ARGS) CPPFLAGS=3D"$(DTC_CPPFLAGS)= " CFLAGS=3D"$(DTC_CFLAGS)" LDFLAGS=3D"$(QEMU_LDFLAGS)" ARFLAGS=3D"$(ARFLAGS= )" CC=3D"$(CC)" AR=3D"$(AR)" LD=3D"$(LD)" $(SUBDIR_MAKEFLAGS) libfdt,) - -dtc/%: .git-submodule-status - @mkdir -p $@ - -# Retain for a while so that incremental build across this patch -# does not raise an error for missing target "capstone/all", which -# comes from the saved SUBDIRS value. -.PHONY: capstone/all -capstone/all: - -.PHONY: slirp/all -slirp/all: =20 ROM_DIRS =3D $(addprefix pc-bios/, $(ROMS)) ROM_DIRS_RULES=3D$(foreach t, all clean, $(addsuffix /$(t), $(ROM_DIRS))) diff --git a/configure b/configure index 51f4e978be..2fdb4339e8 100755 --- a/configure +++ b/configure @@ -296,7 +296,7 @@ brlapi=3D"" curl=3D"" curses=3D"" docs=3D"" -fdt=3D"" +fdt=3D"auto" netmap=3D"no" sdl=3D"auto" sdl_image=3D"auto" @@ -1181,9 +1181,13 @@ for opt do ;; --enable-curl) curl=3D"yes" ;; - --disable-fdt) fdt=3D"no" + --disable-fdt) fdt=3D"disabled" ;; - --enable-fdt) fdt=3D"yes" + --enable-fdt) fdt=3D"enabled" + ;; + --enable-fdt=3Dgit) fdt=3D"internal" + ;; + --enable-fdt=3Dsystem) fdt=3D"system" ;; --disable-linux-aio) linux_aio=3D"no" ;; @@ -3941,67 +3945,15 @@ fi =20 ########################################## # fdt probe -# fdt support is mandatory for at least some target architectures, -# so insist on it if we're building those system emulators. -fdt_required=3Dno -for target in $target_list; do - case $target in - aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64e= l-softmmu|riscv*-softmmu|rx-softmmu) - fdt_required=3Dyes - ;; - esac -done - -if test "$fdt_required" =3D "yes"; then - if test "$fdt" =3D "no"; then - error_exit "fdt disabled but some requested targets require it." \ - "You can turn off fdt only if you also disable all the system emulat= ion" \ - "targets which need it (by specifying a cut down --target-list)." - fi - fdt=3Dyes -elif test "$fdt" !=3D "yes" ; then - fdt=3Dno -fi - -# fdt is only required when building softmmu targets -if test -z "$fdt" -a "$softmmu" !=3D "yes" ; then - fdt=3D"no" -fi =20 -if test "$fdt" !=3D "no" ; then - fdt_libs=3D"-lfdt" - # explicitly check for libfdt_env.h as it is missing in some stable inst= alls - # and test for required functions to make sure we are on a version >=3D = 1.4.2 - cat > $TMPC << EOF -#include -#include -int main(void) { fdt_check_full(NULL, 0); return 0; } -EOF - if compile_prog "" "$fdt_libs" ; then - # system DTC is good - use it - fdt=3Dsystem - else - # have GIT checkout, so activate dtc submodule - if test -e "${source_path}/.git" ; then - git_submodules=3D"${git_submodules} dtc" - fi - if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.g= it" ; then - fdt=3Dgit - mkdir -p dtc - fdt_cflags=3D"-I${source_path}/dtc/libfdt" - fdt_ldflags=3D"-Ldtc/libfdt" - fdt_libs=3D"$fdt_libs" - elif test "$fdt" =3D "yes" ; then - # Not a git build & no libfdt found, prompt for system install - error_exit "DTC (libfdt) version >=3D 1.4.2 not present." \ - "Please install the DTC (libfdt) devel package" - else - # don't have and don't want - fdt_libs=3D - fdt=3Dno - fi - fi -fi +case "$fdt" in + auto | enabled | internal) + # Simpler to always update submodule, even if not needed. + if test -e "${source_path}/.git" && test $git_update =3D 'yes' ; then + git_submodules=3D"${git_submodules} dtc" + fi + ;; +esac =20 ########################################## # opengl probe (for sdl2, gtk, milkymist-tmu2) @@ -6107,9 +6059,6 @@ fi if test $git_update =3D 'yes' ; then (cd "${source_path}" && GIT=3D"$git" "./scripts/git-submodule.sh" upda= te "$git_submodules") fi -if test "$fdt" =3D "git" ; then - symlink "$source_path/dtc/Makefile" "dtc/Makefile" -fi =20 config_host_mak=3D"config-host.mak" =20 @@ -6213,7 +6162,6 @@ if test "$guest_agent" =3D "yes" ; then echo "CONFIG_GUEST_AGENT=3Dy" >> $config_host_mak fi echo "CONFIG_SMBD_COMMAND=3D\"$smbd\"" >> $config_host_mak -subdirs=3D if test "$vde" =3D "yes" ; then echo "CONFIG_VDE=3Dy" >> $config_host_mak echo "VDE_LIBS=3D$vde_libs" >> $config_host_mak @@ -6539,11 +6487,6 @@ fi if test "$preadv" =3D "yes" ; then echo "CONFIG_PREADV=3Dy" >> $config_host_mak fi -if test "$fdt" !=3D "no" ; then - echo "CONFIG_FDT=3Dy" >> $config_host_mak - echo "FDT_CFLAGS=3D$fdt_cflags" >> $config_host_mak - echo "FDT_LIBS=3D$fdt_ldflags $fdt_libs" >> $config_host_mak -fi if test "$membarrier" =3D "yes" ; then echo "CONFIG_MEMBARRIER=3Dy" >> $config_host_mak fi @@ -7083,14 +7026,10 @@ for target in $target_list; do esac done =20 -if [ "$fdt" =3D "git" ]; then - subdirs=3D"$subdirs dtc" -fi echo "CONFIG_QEMU_INTERP_PREFIX=3D$interp_prefix" | sed 's/%M/@0@/' >> $co= nfig_host_mak if test "$default_targets" =3D "yes"; then echo "CONFIG_DEFAULT_TARGETS=3Dy" >> $config_host_mak fi -echo "SUBDIRS=3D$subdirs" >> $config_host_mak =20 if test "$numa" =3D "yes"; then echo "CONFIG_NUMA=3Dy" >> $config_host_mak @@ -7269,7 +7208,7 @@ NINJA=3D${ninja:-$PWD/ninjatool} $meson setup \ -Dcocoa=3D$cocoa -Dmpath=3D$mpath -Dsdl=3D$sdl -Dsdl_image=3D$sdl_image \ -Dvnc=3D$vnc -Dvnc_sasl=3D$vnc_sasl -Dvnc_jpeg=3D$vnc_jpeg -Dvnc_png=3D$v= nc_png \ -Dgettext=3D$gettext -Dxkbcommon=3D$xkbcommon -Du2f=3D$u2f \ - -Dcapstone=3D$capstone -Dslirp=3D$slirp \ + -Dcapstone=3D$capstone -Dslirp=3D$slirp -Dfdt=3D$fdt \ $cross_arg \ "$PWD" "$source_path" =20 diff --git a/default-configs/targets/aarch64-softmmu.mak b/default-configs/= targets/aarch64-softmmu.mak index a8c0174fc3..7703127674 100644 --- a/default-configs/targets/aarch64-softmmu.mak +++ b/default-configs/targets/aarch64-softmmu.mak @@ -2,3 +2,4 @@ TARGET_ARCH=3Daarch64 TARGET_BASE_ARCH=3Darm TARGET_SUPPORTS_MTTCG=3Dy TARGET_XML_FILES=3D gdb-xml/aarch64-core.xml gdb-xml/aarch64-fpu.xml gdb-x= ml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-neon.x= ml gdb-xml/arm-m-profile.xml +TARGET_NEED_FDT=3Dy diff --git a/default-configs/targets/arm-softmmu.mak b/default-configs/targ= ets/arm-softmmu.mak index 9b1a7f37c6..84a98f4818 100644 --- a/default-configs/targets/arm-softmmu.mak +++ b/default-configs/targets/arm-softmmu.mak @@ -1,3 +1,4 @@ TARGET_ARCH=3Darm TARGET_SUPPORTS_MTTCG=3Dy TARGET_XML_FILES=3D gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-v= fp3.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml +TARGET_NEED_FDT=3Dy diff --git a/default-configs/targets/microblaze-softmmu.mak b/default-confi= gs/targets/microblaze-softmmu.mak index 0b5c78ef00..33f2a00402 100644 --- a/default-configs/targets/microblaze-softmmu.mak +++ b/default-configs/targets/microblaze-softmmu.mak @@ -1,3 +1,4 @@ TARGET_ARCH=3Dmicroblaze TARGET_WORDS_BIGENDIAN=3Dy TARGET_SUPPORTS_MTTCG=3Dy +TARGET_NEED_FDT=3Dy diff --git a/default-configs/targets/microblazeel-softmmu.mak b/default-con= figs/targets/microblazeel-softmmu.mak index dc822219d8..af40391f2f 100644 --- a/default-configs/targets/microblazeel-softmmu.mak +++ b/default-configs/targets/microblazeel-softmmu.mak @@ -1,2 +1,3 @@ TARGET_ARCH=3Dmicroblaze TARGET_SUPPORTS_MTTCG=3Dy +TARGET_NEED_FDT=3Dy diff --git a/default-configs/targets/mips64el-softmmu.mak b/default-configs= /targets/mips64el-softmmu.mak index b751ae1bcf..5a52aa4b64 100644 --- a/default-configs/targets/mips64el-softmmu.mak +++ b/default-configs/targets/mips64el-softmmu.mak @@ -1,3 +1,4 @@ TARGET_ARCH=3Dmips64 TARGET_BASE_ARCH=3Dmips TARGET_ALIGNED_ONLY=3Dy +TARGET_NEED_FDT=3Dy diff --git a/default-configs/targets/ppc-softmmu.mak b/default-configs/targ= ets/ppc-softmmu.mak index ef69037a2c..f4eef1819a 100644 --- a/default-configs/targets/ppc-softmmu.mak +++ b/default-configs/targets/ppc-softmmu.mak @@ -1,3 +1,4 @@ TARGET_ARCH=3Dppc TARGET_WORDS_BIGENDIAN=3Dy TARGET_XML_FILES=3D gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/p= ower-altivec.xml gdb-xml/power-spe.xml +TARGET_NEED_FDT=3Dy diff --git a/default-configs/targets/ppc64-softmmu.mak b/default-configs/ta= rgets/ppc64-softmmu.mak index 0fde2d02b9..84fbf46be9 100644 --- a/default-configs/targets/ppc64-softmmu.mak +++ b/default-configs/targets/ppc64-softmmu.mak @@ -3,3 +3,4 @@ TARGET_BASE_ARCH=3Dppc TARGET_WORDS_BIGENDIAN=3Dy TARGET_SUPPORTS_MTTCG=3Dy TARGET_XML_FILES=3D gdb-xml/power64-core.xml gdb-xml/power-fpu.xml gdb-xml= /power-altivec.xml gdb-xml/power-spe.xml gdb-xml/power-vsx.xml +TARGET_NEED_FDT=3Dy diff --git a/default-configs/targets/riscv32-softmmu.mak b/default-configs/= targets/riscv32-softmmu.mak index 4544e1ae9a..9446d96d13 100644 --- a/default-configs/targets/riscv32-softmmu.mak +++ b/default-configs/targets/riscv32-softmmu.mak @@ -2,3 +2,4 @@ TARGET_ARCH=3Driscv32 TARGET_BASE_ARCH=3Driscv TARGET_SUPPORTS_MTTCG=3Dy TARGET_XML_FILES=3D gdb-xml/riscv-32bit-cpu.xml gdb-xml/riscv-32bit-fpu.xm= l gdb-xml/riscv-64bit-fpu.xml gdb-xml/riscv-32bit-csr.xml gdb-xml/riscv-32b= it-virtual.xml +TARGET_NEED_FDT=3Dy diff --git a/default-configs/targets/riscv64-softmmu.mak b/default-configs/= targets/riscv64-softmmu.mak index 6ce0b283cf..d809bd666a 100644 --- a/default-configs/targets/riscv64-softmmu.mak +++ b/default-configs/targets/riscv64-softmmu.mak @@ -2,3 +2,4 @@ TARGET_ARCH=3Driscv64 TARGET_BASE_ARCH=3Driscv TARGET_SUPPORTS_MTTCG=3Dy TARGET_XML_FILES=3D gdb-xml/riscv-64bit-cpu.xml gdb-xml/riscv-32bit-fpu.xm= l gdb-xml/riscv-64bit-fpu.xml gdb-xml/riscv-64bit-csr.xml gdb-xml/riscv-64b= it-virtual.xml +TARGET_NEED_FDT=3Dy diff --git a/default-configs/targets/rx-softmmu.mak b/default-configs/targe= ts/rx-softmmu.mak index 2d410e0b0c..0c458b2d07 100644 --- a/default-configs/targets/rx-softmmu.mak +++ b/default-configs/targets/rx-softmmu.mak @@ -1,2 +1,3 @@ TARGET_ARCH=3Drx TARGET_XML_FILES=3D gdb-xml/rx-core.xml +TARGET_NEED_FDT=3Dy diff --git a/meson.build b/meson.build index 6ee8c3265c..426b73d31f 100644 --- a/meson.build +++ b/meson.build @@ -531,11 +531,6 @@ if get_option('vnc').enabled() compile_args: '-DSTRUCT_IOVEC_DEFINED') endif endif -fdt =3D not_found -if 'CONFIG_FDT' in config_host - fdt =3D declare_dependency(compile_args: config_host['FDT_CFLAGS'].split= (), - link_args: config_host['FDT_LIBS'].split()) -endif snappy =3D not_found if 'CONFIG_SNAPPY' in config_host snappy =3D declare_dependency(link_args: config_host['SNAPPY_LIBS'].spli= t()) @@ -723,6 +718,7 @@ ignored =3D [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TA= RGET_ARCH' ] =20 default_targets =3D 'CONFIG_DEFAULT_TARGETS' in config_host actual_target_dirs =3D [] +fdt_required =3D [] foreach target : target_dirs config_target =3D { 'TARGET_NAME': target.split('-')[0] } if target.endswith('linux-user') @@ -774,6 +770,10 @@ foreach target : target_dirs config_target +=3D keyval.load('default-configs/targets' / target + '.ma= k') config_target +=3D { 'TARGET_' + config_target['TARGET_ARCH'].to_upper()= : 'y' } =20 + if 'TARGET_NEED_FDT' in config_target + fdt_required +=3D target + endif + # Add default keys if 'TARGET_BASE_ARCH' not in config_target config_target +=3D {'TARGET_BASE_ARCH': config_target['TARGET_ARCH']} @@ -1041,7 +1041,54 @@ if have_system endif endif =20 +fdt =3D not_found +fdt_opt =3D get_option('fdt') +if have_system + if fdt_opt in ['enabled', 'auto', 'system'] + have_internal =3D fs.exists(meson.current_source_dir() / 'dtc/libfdt/M= akefile.libfdt') + fdt =3D cc.find_library('fdt', static: enable_static, + required: fdt_opt =3D=3D 'system' or + fdt_opt =3D=3D 'enabled' and not have_= internal) + if fdt.found() and cc.links(''' + #include + #include + int main(void) { fdt_check_full(NULL, 0); return 0; }''', + dependencies: fdt) + fdt_opt =3D 'system' + elif have_internal + fdt_opt =3D 'internal' + else + fdt_opt =3D 'disabled' + endif + endif + if fdt_opt =3D=3D 'internal' + fdt_files =3D files( + 'dtc/libfdt/fdt.c', + 'dtc/libfdt/fdt_ro.c', + 'dtc/libfdt/fdt_wip.c', + 'dtc/libfdt/fdt_sw.c', + 'dtc/libfdt/fdt_rw.c', + 'dtc/libfdt/fdt_strerror.c', + 'dtc/libfdt/fdt_empty_tree.c', + 'dtc/libfdt/fdt_addresses.c', + 'dtc/libfdt/fdt_overlay.c', + 'dtc/libfdt/fdt_check.c', + ) + + fdt_inc =3D include_directories('dtc/libfdt') + libfdt =3D static_library('fdt', + sources: fdt_files, + include_directories: fdt_inc) + fdt =3D declare_dependency(link_with: libfdt, + include_directories: fdt_inc) + endif +endif +if not fdt.found() and fdt_required.length() > 0 + error('fdt not available but required by targets ' + ', '.join(fdt_requi= red)) +endif + config_host_data.set('CONFIG_CAPSTONE', capstone.found()) +config_host_data.set('CONFIG_FDT', fdt.found()) config_host_data.set('CONFIG_SLIRP', slirp.found()) =20 genh +=3D configure_file(output: 'config-host.h', configuration: config_ho= st_data) @@ -1311,7 +1358,7 @@ softmmu_ss.add(files( =20 softmmu_ss.add(when: 'CONFIG_TPM', if_true: files('tpm.c')) softmmu_ss.add(when: 'CONFIG_SECCOMP', if_true: [files('qemu-seccomp.c'), = seccomp]) -softmmu_ss.add(when: ['CONFIG_FDT', fdt], if_true: [files('device_tree.c'= )]) +softmmu_ss.add(when: fdt, if_true: files('device_tree.c')) =20 common_ss.add(files('cpus-common.c')) =20 @@ -1804,7 +1851,7 @@ endif summary_info +=3D {'malloc trim support': has_malloc_trim} summary_info +=3D {'RDMA support': config_host.has_key('CONFIG_RDMA')} summary_info +=3D {'PVRDMA support': config_host.has_key('CONFIG_PVRDMA= ')} -summary_info +=3D {'fdt support': config_host.has_key('CONFIG_FDT')} +summary_info +=3D {'fdt support': fdt_opt =3D=3D 'disabled' ? false = : fdt_opt} summary_info +=3D {'membarrier': config_host.has_key('CONFIG_MEMBAR= RIER')} summary_info +=3D {'preadv support': config_host.has_key('CONFIG_PREADV= ')} summary_info +=3D {'fdatasync': config_host.has_key('CONFIG_FDATAS= YNC')} diff --git a/meson_options.txt b/meson_options.txt index 8a362fb08d..1d3c94840a 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -55,3 +55,6 @@ option('capstone', type: 'combo', value: 'auto', option('slirp', type: 'combo', value: 'auto', choices: ['disabled', 'enabled', 'auto', 'system', 'internal'], description: 'Whether and how to find the slirp library') +option('fdt', type: 'combo', value: 'auto', + choices: ['disabled', 'enabled', 'auto', 'system', 'internal'], + description: 'Whether and how to find the libfdt library') --=20 2.26.2