Remove the command altogether from targets that do not have device tree support,
instead of leaving it nonfunctional.

Signed-off-by: Paolo Bonzini <[email protected]>
---
 meson.build        | 2 --
 qapi/machine.json  | 2 +-
 hmp-commands.hx    | 2 +-
 system/meson.build | 2 +-
 4 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/meson.build b/meson.build
index de8e5ad67dc..6bf7f3eb685 100644
--- a/meson.build
+++ b/meson.build
@@ -3126,8 +3126,6 @@ if fdt_required.length() > 0 or 
get_option('fdt').enabled()
   endif
 endif
 
-config_host_data.set('CONFIG_FDT', fdt.found())
-
 vhost_user = not_found
 if host_os == 'linux' and have_vhost_user
   libvhost_user = subproject('libvhost-user')
diff --git a/qapi/machine.json b/qapi/machine.json
index b6d634b30d5..c5e40857ba4 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
@@ -1828,4 +1828,4 @@
 ##
 { 'command': 'dumpdtb',
   'data': { 'filename': 'str' },
-  'if': 'CONFIG_FDT' }
+  'if': 'TARGET_NEEDS_FDT' }
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 17b5ea839d9..f7263957240 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1819,7 +1819,7 @@ ERST
         .flags      = "p",
     },
 
-#if defined(CONFIG_FDT)
+#if defined(TARGET_NEED_FDT)
     {
         .name       = "dumpdtb",
         .args_type  = "filename:F",
diff --git a/system/meson.build b/system/meson.build
index 25e21172505..4e54f5d1a4b 100644
--- a/system/meson.build
+++ b/system/meson.build
@@ -32,7 +32,7 @@ if have_tpm
 endif
 
 system_ss.add(when: seccomp, if_true: files('qemu-seccomp.c'))
-system_ss.add(when: fdt, if_true: files('device_tree.c'))
+system_ss.add(when: 'TARGET_NEED_FDT', if_true: [fdt, files('device_tree.c')])
 if host_os == 'linux'
   system_ss.add(files('async-teardown.c'))
 endif
-- 
2.43.0


Reply via email to