All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] configure: allow the overriding of default-config in the build
@ 2021-05-28 16:31 Alex Bennée
  2021-06-01  8:04 ` Philippe Mathieu-Daudé
  2021-06-01 10:48 ` Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: Alex Bennée @ 2021-05-28 16:31 UTC (permalink / raw)
  To: qemu-devel
  Cc: Philippe Mathieu-Daudé,
	qemu-arm, Alex Bennée, f4bug, Paolo Bonzini

While the default config works well enough it does end up enabling a
lot of stuff. For more minimal builds we can pass a slimmed down 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=(pwd)/../../configs/aarch64-softmmu/aarch64-softmmu-64bit-only.mak

will override the aarch64-softmmu default devices to one of our own
choosing.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                                        | 16 ++++++++++++++++
 .../aarch64-softmmu-64bit-only.mak               | 10 ++++++++++
 meson.build                                      |  3 ++-
 3 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 configs/aarch64-softmmu/aarch64-softmmu-64bit-only.mak

diff --git a/configure b/configure
index 90c0807347..5acb8b2ed5 100755
--- a/configure
+++ b/configure
@@ -921,6 +921,12 @@ for opt do
   ;;
   --without-default-devices) default_devices="false"
   ;;
+  --with-devices-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --with-devices-cc-FOO option"
+  ;;
+  --with-devices-*)  device_arch=${opt#--with-devices-}; device_arch=${device_arch%%=*}
+                     device_archs="$device_archs $device_arch"
+                     eval "devices_${device_arch}=\$optarg"
+  ;;
   --without-default-features) # processed above
   ;;
   --enable-gprof) gprof="yes"
@@ -1767,6 +1773,7 @@ Advanced options (experts only):
   --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/)
+  --with-devices-ARCH=PATH override default-configs/devices with your own file
   --enable-debug           enable common debug build options
   --enable-sanitizers      enable default sanitizers
   --enable-tsan            enable thread sanitizer
@@ -6378,6 +6385,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/aarch64-softmmu/aarch64-softmmu-64bit-only.mak b/configs/aarch64-softmmu/aarch64-softmmu-64bit-only.mak
new file mode 100644
index 0000000000..3626de9e3c
--- /dev/null
+++ b/configs/aarch64-softmmu/aarch64-softmmu-64bit-only.mak
@@ -0,0 +1,10 @@
+#
+# A version of the config that only supports 64bits and their devices.
+# This doesn't quite eliminate all 32 bit devices as some boards like
+# "virt" support both.
+#
+
+CONFIG_ARM_VIRT=y
+CONFIG_XLNX_ZYNQMP_ARM=y
+CONFIG_XLNX_VERSAL=y
+CONFIG_SBSA_REF=y
diff --git a/meson.build b/meson.build
index 3f065f53f2..656ebde513 100644
--- a/meson.build
+++ b/meson.build
@@ -1350,9 +1350,10 @@ foreach target : target_dirs
                                                configuration: config_target_data)}
 
   if target.endswith('-softmmu')
+    config_input = meson.get_external_property(target, 'default-configs/devices' / target + '.mak')
     config_devices_mak = target + '-config-devices.mak'
     config_devices_mak = configure_file(
-      input: ['default-configs/devices' / target + '.mak', 'Kconfig'],
+      input: [config_input, 'Kconfig'],
       output: config_devices_mak,
       depfile: config_devices_mak + '.d',
       capture: true,
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH] configure: allow the overriding of default-config in the build
  2021-05-28 16:31 [RFC PATCH] configure: allow the overriding of default-config in the build Alex Bennée
@ 2021-06-01  8:04 ` Philippe Mathieu-Daudé
  2021-06-01 10:48 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-06-01  8:04 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel
  Cc: Paolo Bonzini, qemu-arm, Philippe Mathieu-Daudé

On 5/28/21 6:31 PM, Alex Bennée wrote:
> While the default config works well enough it does end up enabling a
> lot of stuff. For more minimal builds we can pass a slimmed down 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=(pwd)/../../configs/aarch64-softmmu/aarch64-softmmu-64bit-only.mak
> 
> will override the aarch64-softmmu default devices to one of our own
> choosing.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  configure                                        | 16 ++++++++++++++++
>  .../aarch64-softmmu-64bit-only.mak               | 10 ++++++++++
>  meson.build                                      |  3 ++-
>  3 files changed, 28 insertions(+), 1 deletion(-)
>  create mode 100644 configs/aarch64-softmmu/aarch64-softmmu-64bit-only.mak

Surprisingly simple :)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH] configure: allow the overriding of default-config in the build
  2021-05-28 16:31 [RFC PATCH] configure: allow the overriding of default-config in the build Alex Bennée
  2021-06-01  8:04 ` Philippe Mathieu-Daudé
@ 2021-06-01 10:48 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2021-06-01 10:48 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel; +Cc: qemu-arm, Philippe Mathieu-Daudé, f4bug

On 28/05/21 18:31, Alex Bennée wrote:
> +  --with-devices-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --with-devices-cc-FOO option"

Extra "cc".

Looks pretty good otherwise, possible tweaks include:

1) check that the architecture exists (i.e. that it there is a valid 
softmmu target named after it)

2) checking that the file exists using "test -f".

> diff --git a/configs/aarch64-softmmu/aarch64-softmmu-64bit-only.mak b/configs/aarch64-softmmu/aarch64-softmmu-64bit-only.mak

Not sure if you want to include this file or it's just an example; if 
you do, you probably should either remove the directory or call it 
64bit-only.mak, without including aarch64-softmmu twice.

Paolo

> index 0000000000..3626de9e3c
> --- /dev/null
> +++ b/configs/aarch64-softmmu/aarch64-softmmu-64bit-only.mak
> @@ -0,0 +1,10 @@
> +#
> +# A version of the config that only supports 64bits and their devices.
> +# This doesn't quite eliminate all 32 bit devices as some boards like
> +# "virt" support both.
> +#
> +
> +CONFIG_ARM_VIRT=y
> +CONFIG_XLNX_ZYNQMP_ARM=y
> +CONFIG_XLNX_VERSAL=y
> +CONFIG_SBSA_REF=y
> diff --git a/meson.build b/meson.build
> index 3f065f53f2..656ebde513 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1350,9 +1350,10 @@ foreach target : target_dirs
>                                                  configuration: config_target_data)}
>   
>     if target.endswith('-softmmu')
> +    config_input = meson.get_external_property(target, 'default-configs/devices' / target + '.mak')
>       config_devices_mak = target + '-config-devices.mak'
>       config_devices_mak = configure_file(
> -      input: ['default-configs/devices' / target + '.mak', 'Kconfig'],
> +      input: [config_input, 'Kconfig'],
>         output: config_devices_mak,
>         depfile: config_devices_mak + '.d',
>         capture: true,
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-01 10:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-28 16:31 [RFC PATCH] configure: allow the overriding of default-config in the build Alex Bennée
2021-06-01  8:04 ` Philippe Mathieu-Daudé
2021-06-01 10:48 ` Paolo Bonzini

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.