Nico Huber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46767 )
Change subject: util/qemu: Add `qemu` make target
......................................................................
util/qemu: Add `qemu` make target
Add some mechanics to automatically have a `qemu` make target for
supported configurations. So with a QEMU target selected in Kconfig,
one would ideally only have to run `make qemu` to test things.
There are some notable variables that can be set or adapted in
`Makefile.inc` files, the make command line or the environment.
Primarily for `Makefile.inc` use:
QEMU-y the QEMU executable
QEMU_CFG-y a QEMU config that sets the available default devices,
used to run more comprehensive tests by default,
e.g. many more PCI devices
For general use:
QEMU_ARGS additional command line arguments (default: -serial stdio)
QEMU_EXTRA_CFGS additional config files that can add devices
QEMU_CFG_ARGS gathers config file related arguments,
can be used to override a default config (QEMU_CFG-y)
Examples:
$ # Run coreboot's default config with additional command line args
$ make qemu QEMU_ARGS="-cdrom site-local/grml64-small_2018.12.iso"
$ # Force QEMU's built-in config
$ make qemu QEMU_CFG_ARGS=
Change-Id: I658f86e05df416ae09be6d432f9a80f7f71f9f75
Signed-off-by: Nico Huber <nico.h(a)gmx.de>
---
M Makefile.inc
A util/qemu/Makefile.inc
2 files changed, 47 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/67/46767/1
diff --git a/Makefile.inc b/Makefile.inc
index 297f7b1..dbf702a 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -83,7 +83,7 @@
subdirs-y += $(wildcard src/drivers/*) $(wildcard src/drivers/*/*) $(wildcard src/drivers/*/*/*)
subdirs-y += src/cpu src/vendorcode
subdirs-y += util/cbfstool util/sconfig util/nvramtool util/pgtblgen util/amdfwtool
-subdirs-y += util/futility util/marvell util/bincfg util/supermicro
+subdirs-y += util/futility util/marvell util/bincfg util/supermicro util/qemu
subdirs-y += $(wildcard src/arch/*)
subdirs-y += src/mainboard/$(MAINBOARDDIR)
subdirs-y += src/security
diff --git a/util/qemu/Makefile.inc b/util/qemu/Makefile.inc
new file mode 100644
index 0000000..33463498
--- /dev/null
+++ b/util/qemu/Makefile.inc
@@ -0,0 +1,46 @@
+# SPDX-License-Identifier: BSD-3-Clause
+
+# This automatically adds a `qemu` make target if a compatible
+# configuration is selected. There are some notable variables
+# that can be set or adapted in `Makefile.inc` files, the make
+# command line or the environment:
+#
+# Primarily for `Makefile.inc` use:
+# QEMU-y the QEMU executable
+# QEMU_CFG-y a QEMU config that sets the available default devices,
+# used to run more comprehensive tests by default,
+# e.g. many more PCI devices
+#
+# For general use:
+# QEMU_ARGS additional command line arguments (default: -serial stdio)
+# QEMU_EXTRA_CFGS additional config files that can add devices
+#
+# QEMU_CFG_ARGS gathers config file related arguments,
+# can be used to override a default config (QEMU_CFG-y)
+#
+# Examples:
+#
+# $ # Run coreboot's default config with additional command line args
+# $ make qemu QEMU_ARGS="-cdrom site-local/grml64-small_2018.12.iso"
+#
+# $ # Force QEMU's built-in config
+# $ make qemu QEMU_CFG_ARGS=
+
+QEMU-$(CONFIG_BOARD_EMULATION_QEMU_X86_I440FX) ?= qemu-system-x86_64 -M pc
+QEMU-$(CONFIG_BOARD_EMULATION_QEMU_X86_Q35) ?= qemu-system-x86_64 -M q35
+
+ifneq ($(QEMU-y),)
+
+QEMU_ARGS ?= -serial stdio
+QEMU_EXTRA_CFGS ?=
+
+QEMU_CFG_ARGS ?= \
+ $(if $(QEMU_CFG-y),-nodefaults) \
+ $(addprefix -readconfig ,$(QEMU_CFG-y) $(QEMU_EXTRA_CFGS))
+
+qemu: $(obj)/coreboot.rom
+ $(QEMU-y) $(QEMU_CFG_ARGS) $(QEMU_ARGS) -bios $<
+
+.PHONY: qemu
+
+endif
--
To view, visit https://review.coreboot.org/c/coreboot/+/46767
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I658f86e05df416ae09be6d432f9a80f7f71f9f75
Gerrit-Change-Number: 46767
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-MessageType: newchange