All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bernhard Beschow <shentey@gmail.com>
To: "Paolo Bonzini" <pbonzini@redhat.com>,
	"BALATON Zoltan" <balaton@eik.bme.hu>,
	"Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	qemu-ppc@nongnu.org,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [PATCH 4/5] configure: Add dtc option
Date: Thu, 12 Jun 2025 21:27:18 +0000	[thread overview]
Message-ID: <B55C341F-5BDE-45B5-B3F5-2F730EF4586D@gmail.com> (raw)
In-Reply-To: <d2860e38-241e-4778-ad9c-7042c73edfd9@redhat.com>



Am 12. Juni 2025 05:46:03 UTC schrieb Paolo Bonzini <pbonzini@redhat.com>:
>On 6/12/25 07:12, Paolo Bonzini wrote:
>> I'll send a patch to the upstream dtc project and you can add it to QEMU via diff_files (see commit 64644bc4eab2f for an example).
>This is the patch, backported to QEMU's version of the dtc subproject:
>
>diff --git a/libfdt/meson.build b/libfdt/meson.build
>index 0307ffb..6581965 100644
>--- a/libfdt/meson.build
>+++ b/libfdt/meson.build
>@@ -30,6 +30,7 @@ libfdt_dep = declare_dependency(
>   include_directories: libfdt_inc,
>   link_with: libfdt,
> )
>+meson.override_dependency('libfdt', libfdt_dep)
>  install_headers(
>   files(
>diff --git a/meson.build b/meson.build
>index b23ea1b..7def0a6 100644
>--- a/meson.build
>+++ b/meson.build
>@@ -54,6 +54,7 @@ version_gen_h = vcs_tag(
>  subdir('libfdt')
> +dtc_tools = []
> if get_option('tools')
>   flex = find_program('flex', required: true)
>   bison = find_program('bison', required: true)
>@@ -77,7 +78,7 @@ if get_option('tools')
>   )
>    if cc.check_header('fnmatch.h')
>-    executable(
>+    dtc_tools += executable(
>       'convert-dtsv0',
>       [
>         lgen.process('convert-dtsv0-lexer.l'),
>@@ -88,7 +89,7 @@ if get_option('tools')
>     )
>   endif
> -  executable(
>+  dtc_tools += executable(
>     'dtc',
>     [
>       lgen.process('dtc-lexer.l'),
>@@ -108,7 +109,7 @@ if get_option('tools')
>   )
>    foreach e: ['fdtdump', 'fdtget', 'fdtput', 'fdtoverlay']
>-    executable(e, files(e + '.c'), dependencies: util_dep, install: true)
>+    dtc_tools += executable(e, files(e + '.c'), dependencies: util_dep, install: true)
>   endforeach
>    install_data(
>@@ -118,6 +119,10 @@ if get_option('tools')
>   )
> endif
> +foreach e: dtc_tools
>+  meson.override_find_program(e.name(), e)
>+endforeach
>+
> if not meson.is_cross_build()
>   if py.found() and swig.found()
>     subdir('pylibfdt')
>
>
>and this is how you can then find dtc in QEMU's meson.build:
>
>diff --git a/meson.build b/meson.build
>index 61595015802..831678b4580 100644
>--- a/meson.build
>+++ b/meson.build
>@@ -2121,13 +2121,15 @@ if numa.found() and not cc.links('''
> endif
>  fdt = not_found
>+dtc = not_found
> fdt_opt = get_option('fdt')
> if fdt_opt == 'enabled' and get_option('wrap_mode') == 'nodownload'
>   fdt_opt = 'system'
> endif
> if fdt_opt in ['enabled', 'system'] or (fdt_opt == 'auto' and have_system)
>   fdt = cc.find_library('fdt', required: fdt_opt == 'system')
>-  if fdt.found() and cc.links('''
>+  dtc = find_program('dtc', required: fdt_opt == 'system')
>+  if dtc.found() and fdt.found() and cc.links('''
>      #include <libfdt.h>
>      #include <libfdt_env.h>
>      int main(void) { fdt_find_max_phandle(NULL, NULL); return 0; }''',
>@@ -2136,8 +2138,12 @@ if fdt_opt in ['enabled', 'system'] or (fdt_opt == 'auto' and have_system)
>   elif fdt_opt != 'system'
>     fdt_opt = get_option('wrap_mode') == 'nodownload' ? 'disabled' : 'internal'
>     fdt = not_found
>+    dtc = not_found
>   else
>-    error('system libfdt is too old (1.5.1 or newer required)')
>+    if dtc.found()
>+      error('system libfdt is too old (1.5.1 or newer required)')
>+    else
>+      error('device tree compiler not found')
>   endif
> endif
> if fdt_opt == 'internal'
>@@ -2145,7 +2148,8 @@ if fdt_opt == 'internal'
>   libfdt_proj = subproject('dtc', required: true,
>                            default_options: ['tools=false',  'yaml=disabled',
>                                              'python=disabled', 'default_library=static'])
>-  fdt = libfdt_proj.get_variable('libfdt_dep')
>+  fdt = dependency('libfdt', required: true)
>+  dtc = find_program('dtc', required: true)
> endif
>  rdma = not_found
>

Thanks Paolo, I'll send a v2.

Best regards,
Bernhard

  reply	other threads:[~2025-06-12 21:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-10 20:41 [PATCH 0/5] DTB build housekeeping Bernhard Beschow
2025-06-10 20:41 ` [PATCH 1/5] hw: Fix type constant for DTB files Bernhard Beschow
2025-06-11 10:31   ` Thomas Huth
2025-06-10 20:41 ` [PATCH 2/5] pc-bios/dtb/meson: Prefer target name to be outfile, not infile Bernhard Beschow
2025-06-11 10:38   ` Thomas Huth
2025-06-10 20:41 ` [PATCH 3/5] scripts/meson-buildoptions: Sort coroutine_backend choices lexicographically Bernhard Beschow
2025-06-11  0:37   ` BALATON Zoltan
2025-06-11 10:40   ` Thomas Huth
2025-06-11 12:59     ` Kohei Tokunaga
2025-06-10 20:41 ` [PATCH 4/5] configure: Add dtc option Bernhard Beschow
2025-06-11  0:37   ` BALATON Zoltan
2025-06-11  8:45     ` Daniel P. Berrangé
2025-06-11 11:45       ` BALATON Zoltan
2025-06-12  5:12         ` Paolo Bonzini
2025-06-12  5:46           ` Paolo Bonzini
2025-06-12 21:27             ` Bernhard Beschow [this message]
2025-06-12 12:39           ` BALATON Zoltan
2025-06-10 20:41 ` [PATCH 5/5] configure: Require dtc for boards with bundled device trees Bernhard Beschow
2025-06-12  6:09 ` [PATCH 0/5] DTB build housekeeping Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B55C341F-5BDE-45B5-B3F5-2F730EF4586D@gmail.com \
    --to=shentey@gmail.com \
    --cc=balaton@eik.bme.hu \
    --cc=berrange@redhat.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.