Nico Huber | a08328ec | 2020-10-25 12:37:21 +0100 | [diff] [blame] | 1 | # 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 |
Martin Roth | 1f30b24 | 2024-01-18 18:46:58 -0700 | [diff] [blame] | 5 | # that can be set or adapted in `Makefile.mk` files, the make |
Nico Huber | a08328ec | 2020-10-25 12:37:21 +0100 | [diff] [blame] | 6 | # command line or the environment: |
| 7 | # |
Martin Roth | 1f30b24 | 2024-01-18 18:46:58 -0700 | [diff] [blame] | 8 | # Primarily for `Makefile.mk` use: |
Nico Huber | a08328ec | 2020-10-25 12:37:21 +0100 | [diff] [blame] | 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 | |
Nico Huber | 558d8b7 | 2023-06-21 19:44:59 +0200 | [diff] [blame] | 29 | QEMU-$(CONFIG_BOARD_EMULATION_QEMU_AARCH64) ?= qemu-system-aarch64 \ |
| 30 | -M virt,secure=on,virtualization=on -cpu cortex-a53 -m 1G |
| 31 | |
Philipp Hug | 1d3838b | 2024-02-01 21:57:22 +0400 | [diff] [blame^] | 32 | QEMU-$(CONFIG_BOARD_EMULATION_QEMU_RISCV_RV64) ?= qemu-system-riscv64 -M virt |
| 33 | |
| 34 | QEMU-$(CONFIG_BOARD_EMULATION_QEMU_RISCV_RV32) ?= qemu-system-riscv32 -M virt |
| 35 | |
Nico Huber | a08328ec | 2020-10-25 12:37:21 +0100 | [diff] [blame] | 36 | QEMU-$(CONFIG_BOARD_EMULATION_QEMU_X86_I440FX) ?= qemu-system-x86_64 -M pc |
Nico Huber | 9e20e2f | 2020-10-25 14:41:40 +0100 | [diff] [blame] | 37 | |
Nico Huber | a08328ec | 2020-10-25 12:37:21 +0100 | [diff] [blame] | 38 | QEMU-$(CONFIG_BOARD_EMULATION_QEMU_X86_Q35) ?= qemu-system-x86_64 -M q35 |
Nico Huber | 9e20e2f | 2020-10-25 14:41:40 +0100 | [diff] [blame] | 39 | QEMU_CFG-$(CONFIG_BOARD_EMULATION_QEMU_X86_Q35) ?= util/qemu/q35-base.cfg |
Nico Huber | a08328ec | 2020-10-25 12:37:21 +0100 | [diff] [blame] | 40 | |
| 41 | ifneq ($(QEMU-y),) |
| 42 | |
| 43 | QEMU_ARGS ?= -serial stdio |
| 44 | QEMU_EXTRA_CFGS ?= |
| 45 | |
| 46 | QEMU_CFG_ARGS ?= \ |
| 47 | $(if $(QEMU_CFG-y),-nodefaults) \ |
| 48 | $(addprefix -readconfig ,$(QEMU_CFG-y) $(QEMU_EXTRA_CFGS)) |
| 49 | |
| 50 | qemu: $(obj)/coreboot.rom |
| 51 | $(QEMU-y) $(QEMU_CFG_ARGS) $(QEMU_ARGS) -bios $< |
| 52 | |
| 53 | .PHONY: qemu |
| 54 | |
| 55 | endif |