blob: 651ef2163520f45e3c427c7adb65e444ffa61f8f [file] [log] [blame]
Nico Hubera08328ec2020-10-25 12:37:21 +01001# SPDX-License-Identifier: BSD-3-Clause
2
3# This automatically adds a `qemu` make target if a compatible
4# configuration is selected. There are some notable variables
5# that can be set or adapted in `Makefile.inc` files, the make
6# command line or the environment:
7#
8# Primarily for `Makefile.inc` use:
9# QEMU-y the QEMU executable
10# QEMU_CFG-y a QEMU config that sets the available default devices,
11# used to run more comprehensive tests by default,
12# e.g. many more PCI devices
13#
14# For general use:
15# QEMU_ARGS additional command line arguments (default: -serial stdio)
16# QEMU_EXTRA_CFGS additional config files that can add devices
17#
18# QEMU_CFG_ARGS gathers config file related arguments,
19# can be used to override a default config (QEMU_CFG-y)
20#
21# Examples:
22#
23# $ # Run coreboot's default config with additional command line args
24# $ make qemu QEMU_ARGS="-cdrom site-local/grml64-small_2018.12.iso"
25#
26# $ # Force QEMU's built-in config
27# $ make qemu QEMU_CFG_ARGS=
28
29QEMU-$(CONFIG_BOARD_EMULATION_QEMU_X86_I440FX) ?= qemu-system-x86_64 -M pc
Nico Huber9e20e2f2020-10-25 14:41:40 +010030
Nico Hubera08328ec2020-10-25 12:37:21 +010031QEMU-$(CONFIG_BOARD_EMULATION_QEMU_X86_Q35) ?= qemu-system-x86_64 -M q35
Nico Huber9e20e2f2020-10-25 14:41:40 +010032QEMU_CFG-$(CONFIG_BOARD_EMULATION_QEMU_X86_Q35) ?= util/qemu/q35-base.cfg
Nico Hubera08328ec2020-10-25 12:37:21 +010033
34ifneq ($(QEMU-y),)
35
36QEMU_ARGS ?= -serial stdio
37QEMU_EXTRA_CFGS ?=
38
39QEMU_CFG_ARGS ?= \
40 $(if $(QEMU_CFG-y),-nodefaults) \
41 $(addprefix -readconfig ,$(QEMU_CFG-y) $(QEMU_EXTRA_CFGS))
42
43qemu: $(obj)/coreboot.rom
44 $(QEMU-y) $(QEMU_CFG_ARGS) $(QEMU_ARGS) -bios $<
45
46.PHONY: qemu
47
48endif