All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, thuth@redhat.com,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [PATCH v1 5/5] configure: allow the selection of alternate config in the build
Date: Mon, 21 Jun 2021 16:21:20 +0100	[thread overview]
Message-ID: <20210621152120.4465-6-alex.bennee@linaro.org> (raw)
In-Reply-To: <20210621152120.4465-1-alex.bennee@linaro.org>

While the default config works well enough it does end up enabling a
lot of stuff. For more minimal builds we can select a different list
of devices and let Kconfig work out what we want. For example:

  ../../configure --without-default-features \
    --target-list=arm-softmmu,aarch64-softmmu \
    --with-devices-aarch64=minimal

will override the aarch64-softmmu default set of devices with a more
minimal set of devices that just enables the virt and sbsa-ref models.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20210528163116.31902-1-alex.bennee@linaro.org>

---
v2
  - remove extraneous cc
  - dropped pathname from config
  - add virt.mak config
  - drop ZYNQMP from the 64bit only build
  - test -f the --with-devices-FOO file
v3
  - add config with the recently moved default-config->configs
  - dropped Phillipe's r-b due to refactoring
  - don't echo array to config-meson.cross
---
 configure                                   | 24 ++++++++++++++++++++-
 configs/devices/aarch64-softmmu/minimal.mak |  9 ++++++++
 meson.build                                 |  3 ++-
 3 files changed, 34 insertions(+), 2 deletions(-)
 create mode 100644 configs/devices/aarch64-softmmu/minimal.mak

diff --git a/configure b/configure
index b47c38b504..e5cc6b2b29 100755
--- a/configure
+++ b/configure
@@ -921,6 +921,18 @@ for opt do
   ;;
   --without-default-devices) default_devices="false"
   ;;
+  --with-devices-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --with-devices-FOO option"
+  ;;
+  --with-devices-*) device_arch=${opt#--with-devices-};
+                    device_arch=${device_arch%%=*}
+                    cf=$source_path/configs/devices/$device_arch-softmmu/$optarg.mak
+                    if test -f "$cf"; then
+                        device_archs="$device_archs $device_arch"
+                        eval "devices_${device_arch}=\$optarg"
+                    else
+                         error_exit "File $cf does not exist"
+                    fi
+  ;;
   --without-default-features) # processed above
   ;;
   --enable-gprof) gprof="yes"
@@ -1770,7 +1782,8 @@ Advanced options (experts only):
   --without-default-features default all --enable-* options to "disabled"
   --without-default-devices  do not include any device that is not needed to
                            start the emulator (only use if you are including
-                           desired devices in default-configs/devices/)
+                           desired devices in configs/devices/)
+  --with-devices-ARCH=NAME override default configs/devices
   --enable-debug           enable common debug build options
   --enable-sanitizers      enable default sanitizers
   --enable-tsan            enable thread sanitizer
@@ -6331,6 +6344,15 @@ if test "$skip_meson" = no; then
 
   echo "# Automatically generated by configure - do not modify" > $cross
   echo "[properties]" >> $cross
+
+  # unroll any custom device configs
+  if test -n "$device_archs"; then
+      for a in $device_archs; do
+          eval "c=\$devices_${a}"
+          echo "${a}-softmmu = '$c'" >> $cross
+      done
+  fi
+
   test -z "$cxx" && echo "link_language = 'c'" >> $cross
   echo "[built-in options]" >> $cross
   echo "c_args = [${CFLAGS:+$(meson_quote $CFLAGS)}]" >> $cross
diff --git a/configs/devices/aarch64-softmmu/minimal.mak b/configs/devices/aarch64-softmmu/minimal.mak
new file mode 100644
index 0000000000..0ebc1dca56
--- /dev/null
+++ b/configs/devices/aarch64-softmmu/minimal.mak
@@ -0,0 +1,9 @@
+#
+# A minimal version of the config that only supports only a few
+# virtual machines. This avoids bringing in any of numerous legacy
+# features from the 32bit platform (although virt still supports 32bit
+# itself)
+#
+
+CONFIG_ARM_VIRT=y
+CONFIG_SBSA_REF=y
diff --git a/meson.build b/meson.build
index 4893ffa2ac..1d7a9ee421 100644
--- a/meson.build
+++ b/meson.build
@@ -1368,9 +1368,10 @@ foreach target : target_dirs
                                                configuration: config_target_data)}
 
   if target.endswith('-softmmu')
+    config_input = meson.get_external_property(target, 'default')
     config_devices_mak = target + '-config-devices.mak'
     config_devices_mak = configure_file(
-      input: ['configs/devices' / target / 'default.mak', 'Kconfig'],
+      input: ['configs/devices' / target / config_input + '.mak', 'Kconfig'],
       output: config_devices_mak,
       depfile: config_devices_mak + '.d',
       capture: true,
-- 
2.20.1



      parent reply	other threads:[~2021-06-21 15:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-21 15:21 [PATCH v1 0/5] custom device configs (split from larger series) Alex Bennée
2021-06-21 15:21 ` [PATCH v1 1/5] meson: Introduce target-specific Kconfig Alex Bennée
2021-07-06 10:52   ` Thomas Huth
2021-07-06 12:47     ` Philippe Mathieu-Daudé
2021-07-06 13:10       ` Thomas Huth
2021-07-06 13:40         ` Philippe Mathieu-Daudé
2021-07-06 13:52         ` Alex Bennée
2021-06-21 15:21 ` [PATCH v1 2/5] hw/arm: add dependency on OR_IRQ for XLNX_VERSAL Alex Bennée
2021-06-21 19:00   ` Philippe Mathieu-Daudé
2021-06-21 20:00     ` Edgar E. Iglesias
2021-07-06 10:53   ` Thomas Huth
2021-06-21 15:21 ` [PATCH v1 3/5] hw/arm: move CONFIG_V7M out of default-devices Alex Bennée
2021-07-06 11:04   ` Thomas Huth
2021-07-06 12:14   ` Philippe Mathieu-Daudé
2021-06-21 15:21 ` [PATCH v1 4/5] configs: rename default-configs to configs and reorganise Alex Bennée
2021-06-21 18:14   ` Philippe Mathieu-Daudé
2021-06-21 18:38     ` Alex Bennée
2021-06-21 15:21 ` Alex Bennée [this message]

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=20210621152120.4465-6-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --subject='Re: [PATCH v1 5/5] configure: allow the selection of alternate config in the build' \
    /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

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.