Skip to content

Commit

Permalink
build: switch to Kconfig
Browse files Browse the repository at this point in the history
The make_device_config.sh script is replaced by minikconf, which
is modified to support the same command line as its predecessor.

The roots of the parsing are default-configs/*.mak, Kconfig.host and
hw/Kconfig.  One difference with make_device_config.sh is that all symbols
have to be defined in a Kconfig file, including those coming from the
configure script.  This is the reason for the Kconfig.host file introduced
in the previous patch. Whenever a file in default-configs/*.mak used
$(...) to refer to a config-host.mak symbol, this is replaced by a
Kconfig dependency; this part must be done already in this patch
for bisectability.

Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Yang Zhong <[email protected]>
Acked-by: Thomas Huth <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
bonzini committed Mar 7, 2019
1 parent 82f5181 commit e0e312f
Show file tree
Hide file tree
Showing 27 changed files with 102 additions and 60 deletions.
9 changes: 8 additions & 1 deletion Kconfig.host
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# These are "proxy" symbols used to pass config-host.mak values
# down to Kconfig.
# down to Kconfig. See also MINIKCONF_ARGS in the Makefile:
# these two need to be kept in sync.

config KVM
bool
Expand All @@ -10,9 +11,15 @@ config LINUX
config OPENGL
bool

config X11
bool

config SPICE
bool

config IVSHMEM
bool

config TPM
bool

Expand Down
26 changes: 21 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ DOCS=
endif

SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet) BUILD_DIR=$(BUILD_DIR)
SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_DIRS))
SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(filter %-softmmu, $(TARGET_DIRS)))
SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %.d, $(SUBDIR_DEVICES_MAK))

ifeq ($(SUBDIR_DEVICES_MAK),)
config-all-devices.mak:
Expand All @@ -343,9 +343,25 @@ endif

-include $(SUBDIR_DEVICES_MAK_DEP)

%/config-devices.mak: default-configs/%.mak $(SRC_PATH)/scripts/make_device_config.sh
$(call quiet-command, \
$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $< $*-config-devices.mak.d $@ > [email protected],"GEN","[email protected]")
# This has to be kept in sync with Kconfig.host.
MINIKCONF_ARGS = \
$@ $*-config.devices.mak.d $< $(MINIKCONF_INPUTS) \
CONFIG_KVM=$(CONFIG_KVM) \
CONFIG_SPICE=$(CONFIG_SPICE) \
CONFIG_IVSHMEM=$(CONFIG_IVSHMEM) \
CONFIG_TPM=$(CONFIG_TPM) \
CONFIG_XEN=$(CONFIG_XEN) \
CONFIG_OPENGL=$(CONFIG_OPENGL) \
CONFIG_X11=$(CONFIG_X11) \
CONFIG_VHOST_USER=$(CONFIG_VHOST_USER) \
CONFIG_VIRTFS=$(CONFIG_VIRTFS) \
CONFIG_LINUX=$(CONFIG_LINUX)

MINIKCONF_INPUTS = $(SRC_PATH)/Kconfig.host $(SRC_PATH)/hw/Kconfig
MINIKCONF = $(PYTHON) $(SRC_PATH)/scripts/minikconf.py \

$(SUBDIR_DEVICES_MAK): %/config-devices.mak: default-configs/%.mak $(MINIKCONF_INPUTS) $(BUILD_DIR)/config-host.mak
$(call quiet-command, $(MINIKCONF) $(MINIKCONF_ARGS) > $@.tmp, "GEN", "$@.tmp")
$(call quiet-command, if test -f $@; then \
if cmp -s $@.old $@; then \
mv $@.tmp $@; \
Expand Down
7 changes: 6 additions & 1 deletion Makefile.target
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ BUILD_DIR?=$(CURDIR)/..

include ../config-host.mak
include config-target.mak
include config-devices.mak
include $(SRC_PATH)/rules.mak

ifdef CONFIG_SOFTMMU
include config-devices.mak
endif

$(call set-vpath, $(SRC_PATH):$(BUILD_DIR))
ifdef CONFIG_LINUX
QEMU_CFLAGS += -I../linux-headers
Expand Down Expand Up @@ -201,7 +204,9 @@ all-obj-$(CONFIG_SOFTMMU) += $(crypto-obj-y)
all-obj-$(CONFIG_SOFTMMU) += $(io-obj-y)
all-obj-$(CONFIG_SOFTMMU) += $(slirp-obj-y)

ifdef CONFIG_SOFTMMU
$(QEMU_PROG_BUILD): config-devices.mak
endif

COMMON_LDADDS = ../libqemuutil.a

Expand Down
6 changes: 6 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -7438,12 +7438,18 @@ fi

if supported_xen_target $target; then
echo "CONFIG_XEN=y" >> $config_target_mak
echo "$target/config-devices.mak: CONFIG_XEN=y" >> $config_host_mak
if test "$xen_pci_passthrough" = yes; then
echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
fi
else
echo "$target/config-devices.mak: CONFIG_XEN=n" >> $config_host_mak
fi
if supported_kvm_target $target; then
echo "CONFIG_KVM=y" >> $config_target_mak
echo "$target/config-devices.mak: CONFIG_KVM=y" >> $config_host_mak
else
echo "$target/config-devices.mak: CONFIG_KVM=n" >> $config_host_mak
fi
if supported_hax_target $target; then
echo "CONFIG_HAX=y" >> $config_target_mak
Expand Down
3 changes: 0 additions & 3 deletions default-configs/arm-softmmu.mak
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ CONFIG_ARM_V7M=y
CONFIG_NETDUINO2=y

CONFIG_ARM_GIC=y
CONFIG_ARM_GIC_KVM=$(CONFIG_KVM)
CONFIG_ARM_TIMER=y
CONFIG_ARM_MPTIMER=y
CONFIG_A9_GTIMER=y
Expand Down Expand Up @@ -126,8 +125,6 @@ CONFIG_VERSATILE_PCI=y
CONFIG_VERSATILE_I2C=y

CONFIG_PCI_EXPRESS_GENERIC_BRIDGE=y
CONFIG_VFIO=$(CONFIG_LINUX)
CONFIG_VFIO_PLATFORM=y
CONFIG_VFIO_XGMAC=y
CONFIG_VFIO_AMD_XGBE=y

Expand Down
5 changes: 1 addition & 4 deletions default-configs/i386-softmmu.mak
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ include pci.mak
include sound.mak
include usb.mak
include hyperv.mak
CONFIG_QXL=$(CONFIG_SPICE)
CONFIG_VGA_ISA=y
CONFIG_VGA_CIRRUS=y
CONFIG_VMWARE_VGA=y
Expand Down Expand Up @@ -37,8 +36,6 @@ CONFIG_HPET=y
CONFIG_APPLESMC=y
CONFIG_I8259=y
CONFIG_PFLASH_CFI01=y
CONFIG_TPM_TIS=$(CONFIG_TPM)
CONFIG_TPM_CRB=$(CONFIG_TPM)
CONFIG_MC146818RTC=y
CONFIG_PCI_PIIX=y
CONFIG_WDT_IB700=y
Expand Down Expand Up @@ -66,9 +63,9 @@ CONFIG_ACPI_SMBUS=y
CONFIG_SMBUS_EEPROM=y
CONFIG_FW_CFG_DMA=y
CONFIG_I2C=y
CONFIG_SEV=$(CONFIG_KVM)
CONFIG_VTD=y
CONFIG_AMD_IOMMU=y
CONFIG_PAM=y
CONFIG_PC=y
CONFIG_I440FX=y
CONFIG_Q35=y
1 change: 0 additions & 1 deletion default-configs/lm32-softmmu.mak
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

CONFIG_LM32=y
CONFIG_MILKYMIST=y
CONFIG_MILKYMIST_TMU2=$(call land,$(CONFIG_X11),$(CONFIG_OPENGL))
CONFIG_FRAMEBUFFER=y
CONFIG_PTIMER=y
CONFIG_PFLASH_CFI01=y
Expand Down
1 change: 0 additions & 1 deletion default-configs/pci.mak
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,5 @@ CONFIG_VGA_PCI=y
CONFIG_BOCHS_DISPLAY=y
CONFIG_IVSHMEM_DEVICE=$(CONFIG_IVSHMEM)
CONFIG_ROCKER=y
CONFIG_VFIO=$(CONFIG_LINUX)
CONFIG_VFIO_PCI=y
CONFIG_EDID=y
1 change: 0 additions & 1 deletion default-configs/ppc-softmmu.mak
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ CONFIG_I8259=y
CONFIG_XILINX=y
CONFIG_XILINX_ETHLITE=y
CONFIG_E500=y
CONFIG_OPENPIC_KVM=$(call land,$(CONFIG_E500),$(CONFIG_KVM))
CONFIG_PLATFORM_BUS=y
CONFIG_ETSEC=y
CONFIG_PPC405=y
Expand Down
5 changes: 0 additions & 5 deletions default-configs/ppc64-softmmu.mak
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ CONFIG_ISA_IPMI_BT=y
# For pSeries
CONFIG_PSERIES=y
CONFIG_VIRTIO_VGA=y
CONFIG_XICS=$(CONFIG_PSERIES)
CONFIG_XICS_SPAPR=$(CONFIG_PSERIES)
CONFIG_XICS_KVM=$(call land,$(CONFIG_PSERIES),$(CONFIG_KVM))
CONFIG_XIVE=$(CONFIG_PSERIES)
CONFIG_XIVE_SPAPR=$(CONFIG_PSERIES)
CONFIG_MEM_DEVICE=y
CONFIG_DIMM=y
CONFIG_SPAPR_RNG=y
4 changes: 1 addition & 3 deletions default-configs/s390x-softmmu.mak
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
CONFIG_PCI=y
CONFIG_VIRTIO_PCI=$(CONFIG_PCI)
CONFIG_VIRTIO_PCI=y
include virtio.mak
CONFIG_SCLPCONSOLE=y
CONFIG_TERMINAL3270=y
CONFIG_S390_FLIC=y
CONFIG_S390_FLIC_KVM=$(CONFIG_KVM)
CONFIG_WDT_DIAG288=y
CONFIG_S390_CCW_VIRTIO=y
CONFIG_VFIO=$(CONFIG_LINUX)
CONFIG_VFIO_CCW=y
CONFIG_VFIO_AP=y
3 changes: 0 additions & 3 deletions default-configs/virtio.mak
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
CONFIG_VHOST_USER_SCSI=$(CONFIG_VHOST_USER)
CONFIG_VHOST_USER_BLK=$(CONFIG_VHOST_USER)
CONFIG_VIRTIO=y
CONFIG_VIRTIO_9P=$(CONFIG_VIRTFS)
CONFIG_VIRTIO_BALLOON=y
Expand All @@ -12,4 +10,3 @@ CONFIG_VIRTIO_RNG=y
CONFIG_SCSI=y
CONFIG_VIRTIO_SCSI=y
CONFIG_VIRTIO_SERIAL=y
CONFIG_VIRTIO_INPUT_HOST=$(CONFIG_LINUX)
2 changes: 2 additions & 0 deletions hw/9pfs/Kconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
config VIRTIO_9P
bool
default y
depends on VIRTFS
1 change: 1 addition & 0 deletions hw/arm/Kconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
config ARM_VIRT
bool
imply VFIO_PLATFORM

config DIGIC
bool
Expand Down
2 changes: 2 additions & 0 deletions hw/block/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ config VIRTIO_BLK

config VHOST_USER_BLK
bool
default y
depends on VHOST_USER && LINUX
3 changes: 3 additions & 0 deletions hw/display/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ config FRAMEBUFFER

config MILKYMIST_TMU2
bool
default y
depends on OPENGL && X11

config SM501
bool
Expand All @@ -66,6 +68,7 @@ config VGA

config QXL
bool
depends on SPICE && PCI

config VIRTIO_GPU
bool
Expand Down
8 changes: 8 additions & 0 deletions hw/i386/Kconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
config SEV
bool
depends on KVM

config PC
bool
imply QXL
imply SEV
imply TPM_CRB
imply TPM_TIS

config I440FX
bool
Expand Down
5 changes: 5 additions & 0 deletions hw/input/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@ config TSC2005
config VIRTIO_INPUT
bool

config VIRTIO_INPUT_HOST
bool
default y
depends on LINUX

config TSC210X
bool
12 changes: 12 additions & 0 deletions hw/intc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,28 @@ config APIC

config ARM_GIC_KVM
bool
default y
depends on ARM_GIC && KVM

config OPENPIC_KVM
bool
default y
depends on OPENPIC && KVM

config XICS
bool
default y
depends on PSERIES

config XICS_SPAPR
bool
default y
depends on PSERIES

config XICS_KVM
bool
default y
depends on XICS && KVM

config ALLWINNER_A10_PIC
bool
Expand All @@ -42,6 +52,8 @@ config S390_FLIC

config S390_FLIC_KVM
bool
default y
depends on S390_FLIC && KVM

config OMPIC
bool
2 changes: 2 additions & 0 deletions hw/misc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ config MACIO

config IVSHMEM_DEVICE
bool
default y
depends on PCI && LINUX && IVSHMEM

config ECCMEMCTL
bool
Expand Down
4 changes: 4 additions & 0 deletions hw/ppc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ config VIRTEX

config XIVE
bool
default y
depends on PSERIES

config XIVE_SPAPR
bool
default y
depends on PSERIES
7 changes: 7 additions & 0 deletions hw/scsi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@ config ESP
config ESP_PCI
bool

config SPAPR_VSCSI
bool
default y
depends on PSERIES

config VIRTIO_SCSI
bool

config VHOST_USER_SCSI
bool
default y
depends on VHOST_USER && LINUX
2 changes: 2 additions & 0 deletions hw/tpm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ config TPM

config TPM_TIS
bool
depends on TPM

config TPM_CRB
bool
depends on TPM

config TPM_PASSTHROUGH
bool
Expand Down
9 changes: 9 additions & 0 deletions hw/vfio/Kconfig
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
config VFIO
bool
depends on LINUX

config VFIO_PCI
bool
select VFIO
depends on LINUX

config VFIO_CCW
bool
select VFIO
depends on LINUX

config VFIO_PLATFORM
bool
select VFIO
depends on LINUX

config VFIO_XGMAC
bool
Expand All @@ -18,3 +25,5 @@ config VFIO_AMD_XGBE

config VFIO_AP
bool
select VFIO
depends on LINUX
2 changes: 1 addition & 1 deletion hw/xtensa/Kconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
config XTENSA_SIM
bool

config XTENSA_FPGA
config XTENSA_XTFPGA
bool
Loading

0 comments on commit e0e312f

Please sign in to comment.