summaryrefslogtreecommitdiff
path: root/util/qemu/Makefile.mk
diff options
context:
space:
mode:
authorMartin Roth <gaumless@gmail.com>2024-01-18 18:46:58 -0700
committerFelix Singer <service+coreboot-gerrit@felixsinger.de>2024-01-26 12:43:18 +0000
commit1f30b244b296a131f4eaf95962bab048f8b3d481 (patch)
tree390c0dd1e31cd11ce4f2b664445f445d1f1f8996 /util/qemu/Makefile.mk
parentba3a71966876aad1c720d7c385dd4058f844f5e8 (diff)
util: Rename Makefiles from .inc to .mk
The .inc suffix is confusing to various tools as it's not specific to Makefiles. This means that editors don't recognize the files, and don't open them with highlighting and any other specific editor functionality. This issue is also seen in the release notes generation script where Makefiles get renamed before running cloc. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I434940ebb46853980596f7ad55d27a62c90280fa Reviewed-on: https://review.coreboot.org/c/coreboot/+/80123 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'util/qemu/Makefile.mk')
-rw-r--r--util/qemu/Makefile.mk51
1 files changed, 51 insertions, 0 deletions
diff --git a/util/qemu/Makefile.mk b/util/qemu/Makefile.mk
new file mode 100644
index 0000000000..077fde772d
--- /dev/null
+++ b/util/qemu/Makefile.mk
@@ -0,0 +1,51 @@
+# 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.mk` files, the make
+# command line or the environment:
+#
+# Primarily for `Makefile.mk` 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_AARCH64) ?= qemu-system-aarch64 \
+ -M virt,secure=on,virtualization=on -cpu cortex-a53 -m 1G
+
+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
+QEMU_CFG-$(CONFIG_BOARD_EMULATION_QEMU_X86_Q35) ?= util/qemu/q35-base.cfg
+
+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