aboutsummaryrefslogtreecommitdiffstats
path: root/roms
diff options
context:
space:
mode:
Diffstat (limited to 'roms')
-rw-r--r--roms/Makefile215
-rw-r--r--roms/Makefile.edk2166
-rw-r--r--roms/config.seabios-128k21
-rw-r--r--roms/config.seabios-256k4
-rw-r--r--roms/config.seabios-microvm26
-rw-r--r--roms/config.vga-ati4
-rw-r--r--roms/config.vga-bochs-display3
-rw-r--r--roms/config.vga-cirrus3
-rw-r--r--roms/config.vga-isavga3
-rw-r--r--roms/config.vga-qxl6
-rw-r--r--roms/config.vga-ramfb3
-rw-r--r--roms/config.vga-stdvga3
-rw-r--r--roms/config.vga-virtio6
-rw-r--r--roms/config.vga-vmware6
-rwxr-xr-xroms/configure-seabios.sh5
-rwxr-xr-xroms/edk2-build.sh55
-rw-r--r--roms/edk2-funcs.sh273
17 files changed, 802 insertions, 0 deletions
diff --git a/roms/Makefile b/roms/Makefile
new file mode 100644
index 000000000..b967b53bb
--- /dev/null
+++ b/roms/Makefile
@@ -0,0 +1,215 @@
+
+vgabios_variants := stdvga cirrus vmware qxl isavga virtio bochs-display ramfb ati
+vgabios_targets := $(subst -isavga,,$(patsubst %,vgabios-%.bin,$(vgabios_variants)))
+pxerom_variants := e1000 e1000e eepro100 ne2k_pci pcnet rtl8139 virtio vmxnet3
+pxerom_targets := 8086100e 808610d3 80861209 10500940 10222000 10ec8139 1af41000 15ad07b0
+
+pxe-rom-e1000 efi-rom-e1000 : VID := 8086
+pxe-rom-e1000 efi-rom-e1000 : DID := 100e
+pxe-rom-e1000e efi-rom-e1000e : VID := 8086
+pxe-rom-e1000e efi-rom-e1000e : DID := 10d3
+pxe-rom-eepro100 efi-rom-eepro100 : VID := 8086
+pxe-rom-eepro100 efi-rom-eepro100 : DID := 1209
+pxe-rom-ne2k_pci efi-rom-ne2k_pci : VID := 1050
+pxe-rom-ne2k_pci efi-rom-ne2k_pci : DID := 0940
+pxe-rom-pcnet efi-rom-pcnet : VID := 1022
+pxe-rom-pcnet efi-rom-pcnet : DID := 2000
+pxe-rom-rtl8139 efi-rom-rtl8139 : VID := 10ec
+pxe-rom-rtl8139 efi-rom-rtl8139 : DID := 8139
+pxe-rom-virtio efi-rom-virtio : VID := 1af4
+pxe-rom-virtio efi-rom-virtio : DID := 1000
+pxe-rom-vmxnet3 efi-rom-vmxnet3 : VID := 15ad
+pxe-rom-vmxnet3 efi-rom-vmxnet3 : DID := 07b0
+
+#
+# cross compiler auto detection
+#
+path := $(subst :, ,$(PATH))
+system := $(shell uname -s | tr "A-Z" "a-z")
+
+# first find cross binutils in path
+find-cross-ld = $(firstword $(wildcard $(patsubst %,%/$(1)-*$(system)*-ld,$(path))))
+# then check we have cross gcc too
+find-cross-gcc = $(firstword $(wildcard $(patsubst %ld,%gcc,$(call find-cross-ld,$(1)))))
+# finally strip off path + toolname so we get the prefix
+find-cross-prefix = $(subst gcc,,$(notdir $(call find-cross-gcc,$(1))))
+
+arm_cross_prefix := $(call find-cross-prefix,arm)
+powerpc64_cross_prefix := $(call find-cross-prefix,powerpc64)
+powerpc_cross_prefix := $(call find-cross-prefix,powerpc)
+x86_64_cross_prefix := $(call find-cross-prefix,x86_64)
+riscv32_cross_prefix := $(call find-cross-prefix,riscv32)
+riscv64_cross_prefix := $(call find-cross-prefix,riscv64)
+
+# tag our seabios builds
+SEABIOS_EXTRAVERSION="-prebuilt.qemu.org"
+
+#
+# EfiRom utility is shipped with edk2 / tianocore, in BaseTools/
+#
+# We need that to combine multiple images (legacy bios,
+# efi ia32, efi x64) into a single rom binary.
+#
+EDK2_EFIROM = edk2/BaseTools/Source/C/bin/EfiRom
+
+default help:
+ @echo "nothing is build by default"
+ @echo "available build targets:"
+ @echo " bios -- update bios.bin (seabios)"
+ @echo " vgabios -- update vgabios binaries (seabios)"
+ @echo " sgabios -- update sgabios binaries"
+ @echo " pxerom -- update nic roms (bios only)"
+ @echo " efirom -- update nic roms (bios+efi)"
+ @echo " slof -- update slof.bin"
+ @echo " skiboot -- update skiboot.lid"
+ @echo " u-boot.e500 -- update u-boot.e500"
+ @echo " u-boot.sam460 -- update u-boot.sam460"
+ @echo " npcm7xx_bootrom -- update vbootrom for npcm7xx"
+ @echo " efi -- update UEFI (edk2) platform firmware"
+ @echo " opensbi32-generic -- update OpenSBI for 32-bit generic machine"
+ @echo " opensbi64-generic -- update OpenSBI for 64-bit generic machine"
+ @echo " qboot -- update qboot"
+ @echo " clean -- delete the files generated by the previous" \
+ "build targets"
+
+bios: build-seabios-config-seabios-128k \
+ build-seabios-config-seabios-256k \
+ build-seabios-config-seabios-microvm
+ cp seabios/builds/seabios-128k/bios.bin ../pc-bios/bios.bin
+ cp seabios/builds/seabios-256k/bios.bin ../pc-bios/bios-256k.bin
+ cp seabios/builds/seabios-microvm/bios.bin ../pc-bios/bios-microvm.bin
+
+vgabios seavgabios: $(patsubst %,seavgabios-%,$(vgabios_variants))
+
+seavgabios-isavga: build-seabios-config-vga-isavga
+ cp seabios/builds/vga-isavga/vgabios.bin ../pc-bios/vgabios.bin
+
+seavgabios-%: build-seabios-config-vga-%
+ cp seabios/builds/vga-$*/vgabios.bin ../pc-bios/vgabios-$*.bin
+
+build-seabios-config-%: config.%
+ mkdir -p seabios/builds/$*
+ cp $< seabios/builds/$*/.config
+ $(MAKE) -C seabios \
+ EXTRAVERSION=$(SEABIOS_EXTRAVERSION) \
+ CROSS_PREFIX=$(x86_64_cross_prefix) \
+ KCONFIG_CONFIG=$(CURDIR)/seabios/builds/$*/.config \
+ OUT=$(CURDIR)/seabios/builds/$*/ oldnoconfig
+ $(MAKE) -C seabios \
+ EXTRAVERSION=$(SEABIOS_EXTRAVERSION) \
+ CROSS_PREFIX=$(x86_64_cross_prefix) \
+ KCONFIG_CONFIG=$(CURDIR)/seabios/builds/$*/.config \
+ OUT=$(CURDIR)/seabios/builds/$*/ all
+
+
+.PHONY: sgabios skiboot qboot
+sgabios:
+ $(MAKE) -C sgabios
+ cp sgabios/sgabios.bin ../pc-bios
+
+
+pxerom: $(patsubst %,pxe-rom-%,$(pxerom_variants))
+
+pxe-rom-%: build-pxe-roms
+ cp ipxe/src/bin/$(VID)$(DID).rom ../pc-bios/pxe-$*.rom
+
+efirom: $(patsubst %,efi-rom-%,$(pxerom_variants))
+
+efi-rom-%: build-pxe-roms build-efi-roms edk2-basetools
+ $(EDK2_EFIROM) -f "0x$(VID)" -i "0x$(DID)" -l 0x02 \
+ -b ipxe/src/bin/$(VID)$(DID).rom \
+ -ec ipxe/src/bin-x86_64-efi/$(VID)$(DID).efidrv \
+ -o ../pc-bios/efi-$*.rom
+
+build-pxe-roms:
+ $(MAKE) -C ipxe/src CONFIG=qemu \
+ CROSS_COMPILE=$(x86_64_cross_prefix) \
+ $(patsubst %,bin/%.rom,$(pxerom_targets))
+
+build-efi-roms: build-pxe-roms
+ $(MAKE) -C ipxe/src CONFIG=qemu \
+ CROSS_COMPILE=$(x86_64_cross_prefix) \
+ $(patsubst %,bin-x86_64-efi/%.efidrv,$(pxerom_targets))
+
+# Build scripts can pass compiler/linker flags to the EDK2
+# build tools via the EDK2_BASETOOLS_OPTFLAGS (CFLAGS) and
+# EDK2_BASETOOLS_LDFLAGS (LDFLAGS) environment variables.
+#
+# Example:
+#
+# make -C roms \
+# EDK2_BASETOOLS_OPTFLAGS='...' \
+# EDK2_BASETOOLS_LDFLAGS='...' \
+# efirom
+#
+edk2-basetools:
+ cd edk2/BaseTools && git submodule update --init --force \
+ Source/C/BrotliCompress/brotli
+ $(MAKE) -C edk2/BaseTools \
+ PYTHON_COMMAND=$${EDK2_PYTHON_COMMAND:-python3} \
+ EXTRA_OPTFLAGS='$(EDK2_BASETOOLS_OPTFLAGS)' \
+ EXTRA_LDFLAGS='$(EDK2_BASETOOLS_LDFLAGS)'
+
+slof:
+ $(MAKE) -C SLOF CROSS=$(powerpc64_cross_prefix) qemu
+ cp SLOF/boot_rom.bin ../pc-bios/slof.bin
+
+u-boot.e500:
+ $(MAKE) -C u-boot O=build-e500 qemu-ppce500_config
+ $(MAKE) -C u-boot CROSS_COMPILE=$(powerpc_cross_prefix) \
+ O=build-e500
+ $(powerpc_cross_prefix)strip u-boot/build-e500/u-boot -o \
+ ../pc-bios/u-boot.e500
+
+u-boot.sam460:
+ $(MAKE) -C u-boot-sam460ex Sam460ex_config
+ $(MAKE) -C u-boot-sam460ex CROSS_COMPILE=$(powerpc_cross_prefix)
+ cp u-boot-sam460ex/u-boot.bin ../pc-bios/u-boot-sam460-20100605.bin
+
+skiboot:
+ $(MAKE) -C skiboot CROSS=$(powerpc64_cross_prefix)
+ cp skiboot/skiboot.lid ../pc-bios/skiboot.lid
+
+efi: edk2-basetools
+ $(MAKE) -f Makefile.edk2
+
+opensbi32-generic:
+ $(MAKE) -C opensbi \
+ CROSS_COMPILE=$(riscv32_cross_prefix) \
+ PLATFORM="generic"
+ cp opensbi/build/platform/generic/firmware/fw_dynamic.bin ../pc-bios/opensbi-riscv32-generic-fw_dynamic.bin
+ cp opensbi/build/platform/generic/firmware/fw_dynamic.elf ../pc-bios/opensbi-riscv32-generic-fw_dynamic.elf
+
+opensbi64-generic:
+ $(MAKE) -C opensbi \
+ CROSS_COMPILE=$(riscv64_cross_prefix) \
+ PLATFORM="generic"
+ cp opensbi/build/platform/generic/firmware/fw_dynamic.bin ../pc-bios/opensbi-riscv64-generic-fw_dynamic.bin
+ cp opensbi/build/platform/generic/firmware/fw_dynamic.elf ../pc-bios/opensbi-riscv64-generic-fw_dynamic.elf
+
+MESON = meson
+NINJA = ninja
+qboot:
+ mkdir -p qboot/build
+ $(MESON) setup $(if $(wildcard qboot/build/meson-private),--wipe,) qboot qboot/build
+ $(NINJA) -C qboot/build
+ cp qboot/build/bios.bin ../pc-bios/qboot.rom
+
+npcm7xx_bootrom:
+ $(MAKE) -C vbootrom CROSS_COMPILE=$(arm_cross_prefix)
+ cp vbootrom/npcm7xx_bootrom.bin ../pc-bios/npcm7xx_bootrom.bin
+
+clean:
+ rm -rf seabios/.config seabios/out seabios/builds
+ $(MAKE) -C sgabios clean
+ rm -f sgabios/.depend
+ $(MAKE) -C ipxe/src veryclean
+ $(MAKE) -C edk2/BaseTools clean
+ $(MAKE) -C SLOF clean
+ rm -rf u-boot/build-e500
+ $(MAKE) -C u-boot-sam460ex distclean
+ $(MAKE) -C skiboot clean
+ $(MAKE) -f Makefile.edk2 clean
+ $(MAKE) -C opensbi clean
+ $(MAKE) -C qboot clean
+ $(MAKE) -C vbootrom clean
diff --git a/roms/Makefile.edk2 b/roms/Makefile.edk2
new file mode 100644
index 000000000..fdae0b511
--- /dev/null
+++ b/roms/Makefile.edk2
@@ -0,0 +1,166 @@
+# Makefile for building firmware binaries and variable store templates for a
+# number of virtual platforms in edk2.
+#
+# Copyright (C) 2019 Red Hat, Inc.
+#
+# This program and the accompanying materials are licensed and made available
+# under the terms and conditions of the BSD License that accompanies this
+# distribution. The full text of the license may be found at
+# <http://opensource.org/licenses/bsd-license.php>.
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
+# WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+SHELL = /bin/bash
+
+toolchain = $(shell source ./edk2-funcs.sh && qemu_edk2_get_toolchain $(1))
+
+licenses := \
+ edk2/License.txt \
+ edk2/License-History.txt \
+ edk2/OvmfPkg/License.txt \
+ edk2/ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3/COPYING.txt \
+ edk2/CryptoPkg/Library/OpensslLib/openssl/LICENSE
+
+# The "edk2-arm-vars.fd" varstore template is suitable for aarch64 as well.
+# Similarly, the "edk2-i386-vars.fd" varstore template is suitable for x86_64
+# as well, independently of "secure" too.
+flashdevs := \
+ aarch64-code \
+ arm-code \
+ i386-code \
+ i386-secure-code \
+ x86_64-code \
+ x86_64-secure-code \
+ \
+ arm-vars \
+ i386-vars
+
+all: $(foreach flashdev,$(flashdevs),../pc-bios/edk2-$(flashdev).fd.bz2) \
+ ../pc-bios/edk2-licenses.txt
+
+../pc-bios/edk2-%.fd.bz2: ../pc-bios/edk2-%.fd
+ bzip2 -9 -c $< > $@
+
+# When the build completes, we need not keep the uncompressed flash device
+# files.
+.INTERMEDIATE: $(foreach flashdev,$(flashdevs),../pc-bios/edk2-$(flashdev).fd)
+
+# Fetch edk2 submodule's submodules. If it is not in a git tree, assume
+# we're building from a tarball and that they've already been fetched by
+# make-release/tarball scripts.
+submodules:
+ if test -d edk2/.git; then \
+ cd edk2 && git submodule update --init --force -- \
+ ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3 \
+ BaseTools/Source/C/BrotliCompress/brotli \
+ CryptoPkg/Library/OpensslLib/openssl \
+ MdeModulePkg/Library/BrotliCustomDecompressLib/brotli \
+ ; \
+ fi
+
+# See notes on the ".NOTPARALLEL" target and the "+" indicator in
+# "tests/uefi-test-tools/Makefile".
+.NOTPARALLEL:
+
+../pc-bios/edk2-aarch64-code.fd: submodules
+ +./edk2-build.sh \
+ aarch64 \
+ --arch=AARCH64 \
+ --platform=ArmVirtPkg/ArmVirtQemu.dsc \
+ -D NETWORK_IP6_ENABLE \
+ -D NETWORK_HTTP_BOOT_ENABLE \
+ -D NETWORK_TLS_ENABLE \
+ -D TPM2_ENABLE \
+ -D TPM2_CONFIG_ENABLE
+ cp edk2/Build/ArmVirtQemu-AARCH64/DEBUG_$(call toolchain,aarch64)/FV/QEMU_EFI.fd \
+ $@
+ truncate --size=64M $@
+
+../pc-bios/edk2-arm-code.fd: submodules
+ +./edk2-build.sh \
+ arm \
+ --arch=ARM \
+ --platform=ArmVirtPkg/ArmVirtQemu.dsc \
+ -D NETWORK_IP6_ENABLE \
+ -D NETWORK_HTTP_BOOT_ENABLE \
+ -D NETWORK_TLS_ENABLE \
+ -D TPM2_ENABLE \
+ -D TPM2_CONFIG_ENABLE
+ cp edk2/Build/ArmVirtQemu-ARM/DEBUG_$(call toolchain,arm)/FV/QEMU_EFI.fd \
+ $@
+ truncate --size=64M $@
+
+../pc-bios/edk2-i386-code.fd: submodules
+ +./edk2-build.sh \
+ i386 \
+ --arch=IA32 \
+ --platform=OvmfPkg/OvmfPkgIa32.dsc \
+ -D NETWORK_IP6_ENABLE \
+ -D NETWORK_HTTP_BOOT_ENABLE \
+ -D NETWORK_TLS_ENABLE \
+ -D TPM_ENABLE \
+ -D TPM_CONFIG_ENABLE
+ cp edk2/Build/OvmfIa32/DEBUG_$(call toolchain,i386)/FV/OVMF_CODE.fd $@
+
+../pc-bios/edk2-i386-secure-code.fd: submodules
+ +./edk2-build.sh \
+ i386 \
+ --arch=IA32 \
+ --platform=OvmfPkg/OvmfPkgIa32.dsc \
+ -D NETWORK_IP6_ENABLE \
+ -D NETWORK_HTTP_BOOT_ENABLE \
+ -D NETWORK_TLS_ENABLE \
+ -D TPM_ENABLE \
+ -D TPM_CONFIG_ENABLE \
+ -D SECURE_BOOT_ENABLE \
+ -D SMM_REQUIRE
+ cp edk2/Build/OvmfIa32/DEBUG_$(call toolchain,i386)/FV/OVMF_CODE.fd $@
+
+../pc-bios/edk2-x86_64-code.fd: submodules
+ +./edk2-build.sh \
+ x86_64 \
+ --arch=X64 \
+ --platform=OvmfPkg/OvmfPkgX64.dsc \
+ -D NETWORK_IP6_ENABLE \
+ -D NETWORK_HTTP_BOOT_ENABLE \
+ -D NETWORK_TLS_ENABLE \
+ -D TPM_ENABLE \
+ -D TPM_CONFIG_ENABLE
+ cp edk2/Build/OvmfX64/DEBUG_$(call toolchain,x86_64)/FV/OVMF_CODE.fd $@
+
+../pc-bios/edk2-x86_64-secure-code.fd: submodules
+ +./edk2-build.sh \
+ x86_64 \
+ --arch=IA32 \
+ --arch=X64 \
+ --platform=OvmfPkg/OvmfPkgIa32X64.dsc \
+ -D NETWORK_IP6_ENABLE \
+ -D NETWORK_HTTP_BOOT_ENABLE \
+ -D NETWORK_TLS_ENABLE \
+ -D TPM_ENABLE \
+ -D TPM_CONFIG_ENABLE \
+ -D SECURE_BOOT_ENABLE \
+ -D SMM_REQUIRE
+ cp edk2/Build/Ovmf3264/DEBUG_$(call toolchain,x86_64)/FV/OVMF_CODE.fd $@
+
+../pc-bios/edk2-arm-vars.fd: ../pc-bios/edk2-arm-code.fd
+ cp edk2/Build/ArmVirtQemu-ARM/DEBUG_$(call toolchain,arm)/FV/QEMU_VARS.fd \
+ $@
+ truncate --size=64M $@
+
+../pc-bios/edk2-i386-vars.fd: ../pc-bios/edk2-i386-code.fd
+ cp edk2/Build/OvmfIa32/DEBUG_$(call toolchain,i386)/FV/OVMF_VARS.fd $@
+
+# The license file accumulates several individual licenses from under edk2,
+# prefixing each individual license with a header (generated by "tail") that
+# states its pathname.
+../pc-bios/edk2-licenses.txt: submodules
+ tail -n $(shell cat $(licenses) | wc -l) $(licenses) > $@
+ dos2unix $@
+
+clean:
+ rm -rf edk2/Build
+ cd edk2/Conf && \
+ rm -rf .cache BuildEnv.sh build_rule.txt target.txt \
+ tools_def.txt
diff --git a/roms/config.seabios-128k b/roms/config.seabios-128k
new file mode 100644
index 000000000..d18c802c4
--- /dev/null
+++ b/roms/config.seabios-128k
@@ -0,0 +1,21 @@
+# for qemu machine types 1.7 + older
+# need to turn off features (xhci,uas) to make it fit into 128k
+CONFIG_QEMU=y
+CONFIG_ROM_SIZE=128
+CONFIG_ATA_DMA=n
+CONFIG_BOOTSPLASH=n
+CONFIG_XEN=n
+CONFIG_USB_OHCI=n
+CONFIG_USB_XHCI=n
+CONFIG_USB_UAS=n
+CONFIG_SDCARD=n
+CONFIG_TCGBIOS=n
+CONFIG_MPT_SCSI=n
+CONFIG_ESP_SCSI=n
+CONFIG_MEGASAS=n
+CONFIG_PVSCSI=n
+CONFIG_NVME=n
+CONFIG_USE_SMM=n
+CONFIG_VGAHOOKS=n
+CONFIG_HOST_BIOS_GEOMETRY=n
+CONFIG_ACPI_PARSE=n
diff --git a/roms/config.seabios-256k b/roms/config.seabios-256k
new file mode 100644
index 000000000..d1bcc9453
--- /dev/null
+++ b/roms/config.seabios-256k
@@ -0,0 +1,4 @@
+# for qemu machine types 2.0 + newer
+CONFIG_QEMU=y
+CONFIG_ROM_SIZE=256
+CONFIG_ATA_DMA=n
diff --git a/roms/config.seabios-microvm b/roms/config.seabios-microvm
new file mode 100644
index 000000000..a253e2edc
--- /dev/null
+++ b/roms/config.seabios-microvm
@@ -0,0 +1,26 @@
+CONFIG_QEMU=y
+CONFIG_QEMU_HARDWARE=y
+CONFIG_PERMIT_UNALIGNED_PCIROM=y
+CONFIG_ROM_SIZE=128
+CONFIG_XEN=n
+CONFIG_BOOTSPLASH=n
+CONFIG_ATA=n
+CONFIG_AHCI=n
+CONFIG_SDCARD=n
+CONFIG_PVSCSI=n
+CONFIG_ESP_SCSI=n
+CONFIG_LSI_SCSI=n
+CONFIG_MEGASAS=n
+CONFIG_MPT_SCSI=n
+CONFIG_FLOPPY=n
+CONFIG_FLASH_FLOPPY=n
+CONFIG_NVME=n
+CONFIG_PS2PORT=n
+CONFIG_USB=n
+CONFIG_LPT=n
+CONFIG_RTC_TIMER=n
+CONFIG_USE_SMM=n
+CONFIG_PMTIMER=n
+CONFIG_TCGBIOS=n
+CONFIG_HARDWARE_IRQ=n
+CONFIG_ACPI_PARSE=y
diff --git a/roms/config.vga-ati b/roms/config.vga-ati
new file mode 100644
index 000000000..12506b664
--- /dev/null
+++ b/roms/config.vga-ati
@@ -0,0 +1,4 @@
+CONFIG_QEMU=y
+CONFIG_BUILD_VGABIOS=y
+CONFIG_VGA_ATI=y
+CONFIG_VGA_PCI=y
diff --git a/roms/config.vga-bochs-display b/roms/config.vga-bochs-display
new file mode 100644
index 000000000..d2adaaef6
--- /dev/null
+++ b/roms/config.vga-bochs-display
@@ -0,0 +1,3 @@
+CONFIG_BUILD_VGABIOS=y
+CONFIG_DISPLAY_BOCHS=y
+CONFIG_VGA_PCI=y
diff --git a/roms/config.vga-cirrus b/roms/config.vga-cirrus
new file mode 100644
index 000000000..c8fe58239
--- /dev/null
+++ b/roms/config.vga-cirrus
@@ -0,0 +1,3 @@
+CONFIG_BUILD_VGABIOS=y
+CONFIG_VGA_CIRRUS=y
+CONFIG_VGA_PCI=y
diff --git a/roms/config.vga-isavga b/roms/config.vga-isavga
new file mode 100644
index 000000000..e55e294a0
--- /dev/null
+++ b/roms/config.vga-isavga
@@ -0,0 +1,3 @@
+CONFIG_BUILD_VGABIOS=y
+CONFIG_VGA_BOCHS=y
+CONFIG_VGA_PCI=n
diff --git a/roms/config.vga-qxl b/roms/config.vga-qxl
new file mode 100644
index 000000000..d393f0c34
--- /dev/null
+++ b/roms/config.vga-qxl
@@ -0,0 +1,6 @@
+CONFIG_BUILD_VGABIOS=y
+CONFIG_VGA_BOCHS=y
+CONFIG_VGA_PCI=y
+CONFIG_OVERRIDE_PCI_ID=y
+CONFIG_VGA_VID=0x1b36
+CONFIG_VGA_DID=0x0100
diff --git a/roms/config.vga-ramfb b/roms/config.vga-ramfb
new file mode 100644
index 000000000..c809c799b
--- /dev/null
+++ b/roms/config.vga-ramfb
@@ -0,0 +1,3 @@
+CONFIG_BUILD_VGABIOS=y
+CONFIG_VGA_RAMFB=y
+CONFIG_VGA_PCI=n
diff --git a/roms/config.vga-stdvga b/roms/config.vga-stdvga
new file mode 100644
index 000000000..7d063b787
--- /dev/null
+++ b/roms/config.vga-stdvga
@@ -0,0 +1,3 @@
+CONFIG_BUILD_VGABIOS=y
+CONFIG_VGA_BOCHS=y
+CONFIG_VGA_PCI=y
diff --git a/roms/config.vga-virtio b/roms/config.vga-virtio
new file mode 100644
index 000000000..aa7a15ba1
--- /dev/null
+++ b/roms/config.vga-virtio
@@ -0,0 +1,6 @@
+CONFIG_BUILD_VGABIOS=y
+CONFIG_VGA_BOCHS=y
+CONFIG_VGA_PCI=y
+CONFIG_OVERRIDE_PCI_ID=y
+CONFIG_VGA_VID=0x1af4
+CONFIG_VGA_DID=0x1050
diff --git a/roms/config.vga-vmware b/roms/config.vga-vmware
new file mode 100644
index 000000000..eb10427af
--- /dev/null
+++ b/roms/config.vga-vmware
@@ -0,0 +1,6 @@
+CONFIG_BUILD_VGABIOS=y
+CONFIG_VGA_BOCHS=y
+CONFIG_VGA_PCI=y
+CONFIG_OVERRIDE_PCI_ID=y
+CONFIG_VGA_VID=0x15ad
+CONFIG_VGA_DID=0x0405
diff --git a/roms/configure-seabios.sh b/roms/configure-seabios.sh
new file mode 100755
index 000000000..98f59a24b
--- /dev/null
+++ b/roms/configure-seabios.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+config="$1"
+make -C seabios clean distclean
+cp "$config" seabios/.config
+make -C seabios oldnoconfig
diff --git a/roms/edk2-build.sh b/roms/edk2-build.sh
new file mode 100755
index 000000000..d5391c763
--- /dev/null
+++ b/roms/edk2-build.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+# Wrapper shell script for building a virtual platform firmware in edk2.
+#
+# Copyright (C) 2019 Red Hat, Inc.
+#
+# This program and the accompanying materials are licensed and made available
+# under the terms and conditions of the BSD License that accompanies this
+# distribution. The full text of the license may be found at
+# <http://opensource.org/licenses/bsd-license.php>.
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
+# WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+set -e -u -C
+
+# Save the command line arguments. We need to reset $# to 0 before sourcing
+# "edksetup.sh", as it will inherit $@.
+emulation_target=$1
+shift
+num_args=0
+args=()
+for arg in "$@"; do
+ args[num_args++]="$arg"
+done
+shift $num_args
+
+cd edk2
+
+export PYTHON_COMMAND=${EDK2_PYTHON_COMMAND:-python3}
+
+# Source "edksetup.sh" carefully.
+set +e +u +C
+source ./edksetup.sh
+ret=$?
+set -e -u -C
+if [ $ret -ne 0 ]; then
+ exit $ret
+fi
+
+# Fetch some option arguments, and set the cross-compilation environment (if
+# any), for the edk2 "build" utility.
+source ../edk2-funcs.sh
+edk2_toolchain=$(qemu_edk2_get_toolchain "$emulation_target")
+MAKEFLAGS=$(qemu_edk2_quirk_tianocore_1607 "$MAKEFLAGS")
+edk2_thread_count=$(qemu_edk2_get_thread_count "$MAKEFLAGS")
+qemu_edk2_set_cross_env "$emulation_target"
+
+# Build the platform firmware.
+build \
+ --cmd-len=65536 \
+ -n "$edk2_thread_count" \
+ --buildtarget=DEBUG \
+ --tagname="$edk2_toolchain" \
+ "${args[@]}"
diff --git a/roms/edk2-funcs.sh b/roms/edk2-funcs.sh
new file mode 100644
index 000000000..cd6e4f2c8
--- /dev/null
+++ b/roms/edk2-funcs.sh
@@ -0,0 +1,273 @@
+# Shell script that defines functions for determining some environmental
+# characteristics for the edk2 "build" utility.
+#
+# This script is meant to be sourced, in a bash environment.
+#
+# Copyright (C) 2019 Red Hat, Inc.
+#
+# This program and the accompanying materials are licensed and made available
+# under the terms and conditions of the BSD License that accompanies this
+# distribution. The full text of the license may be found at
+# <http://opensource.org/licenses/bsd-license.php>.
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
+# WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+
+# Verify whether the QEMU system emulation target is supported by the UEFI spec
+# and edk2. Print a message to the standard error, and return with nonzero
+# status, if verification fails.
+#
+# Parameters:
+# $1: QEMU system emulation target
+qemu_edk2_verify_arch()
+{
+ local emulation_target="$1"
+ local program_name=$(basename -- "$0")
+
+ case "$emulation_target" in
+ (arm|aarch64|i386|x86_64)
+ ;;
+ (*)
+ printf '%s: unknown/unsupported QEMU system emulation target "%s"\n' \
+ "$program_name" "$emulation_target" >&2
+ return 1
+ ;;
+ esac
+}
+
+
+# Translate the QEMU system emulation target to the edk2 architecture
+# identifier. Print the result to the standard output.
+#
+# Parameters:
+# $1: QEMU system emulation target
+qemu_edk2_get_arch()
+{
+ local emulation_target="$1"
+
+ if ! qemu_edk2_verify_arch "$emulation_target"; then
+ return 1
+ fi
+
+ case "$emulation_target" in
+ (arm)
+ printf 'ARM\n'
+ ;;
+ (aarch64)
+ printf 'AARCH64\n'
+ ;;
+ (i386)
+ printf 'IA32\n'
+ ;;
+ (x86_64)
+ printf 'X64\n'
+ ;;
+ esac
+}
+
+
+# Translate the QEMU system emulation target to the gcc cross-compilation
+# architecture identifier. Print the result to the standard output.
+#
+# Parameters:
+# $1: QEMU system emulation target
+qemu_edk2_get_gcc_arch()
+{
+ local emulation_target="$1"
+
+ if ! qemu_edk2_verify_arch "$emulation_target"; then
+ return 1
+ fi
+
+ case "$emulation_target" in
+ (arm|aarch64|x86_64)
+ printf '%s\n' "$emulation_target"
+ ;;
+ (i386)
+ printf 'i686\n'
+ ;;
+ esac
+}
+
+
+# Determine the gcc cross-compiler prefix (if any) for use with the edk2
+# toolchain. Print the result to the standard output.
+#
+# Parameters:
+# $1: QEMU system emulation target
+qemu_edk2_get_cross_prefix()
+{
+ local emulation_target="$1"
+ local gcc_arch
+ local host_arch
+
+ if ! gcc_arch=$(qemu_edk2_get_gcc_arch "$emulation_target"); then
+ return 1
+ fi
+
+ host_arch=$(uname -m)
+
+ if [ "$gcc_arch" == "$host_arch" ] ||
+ ( [ "$gcc_arch" == i686 ] && [ "$host_arch" == x86_64 ] ); then
+ # no cross-compiler needed
+ :
+ elif ( [ -e /etc/debian_version ] && [ "$gcc_arch" == arm ] ); then
+ # force soft-float cross-compiler on Debian
+ printf 'arm-linux-gnueabi-'
+ else
+ printf '%s-linux-gnu-\n' "$gcc_arch"
+ fi
+}
+
+
+# Determine the edk2 toolchain tag for the QEMU system emulation target. Print
+# the result to the standard output. Print a message to the standard error, and
+# return with nonzero status, if the (conditional) gcc version check fails.
+#
+# Parameters:
+# $1: QEMU system emulation target
+qemu_edk2_get_toolchain()
+{
+ local emulation_target="$1"
+ local program_name=$(basename -- "$0")
+ local cross_prefix
+ local gcc_version
+
+ if ! qemu_edk2_verify_arch "$emulation_target"; then
+ return 1
+ fi
+
+ case "$emulation_target" in
+ (arm|aarch64)
+ printf 'GCC5\n'
+ ;;
+
+ (i386|x86_64)
+ if ! cross_prefix=$(qemu_edk2_get_cross_prefix "$emulation_target"); then
+ return 1
+ fi
+
+ gcc_version=$("${cross_prefix}gcc" -v 2>&1 | tail -1 | awk '{print $3}')
+ # Run "git-blame" on "OvmfPkg/build.sh" in edk2 for more information on
+ # the mapping below.
+ case "$gcc_version" in
+ ([1-3].*|4.[0-7].*)
+ printf '%s: unsupported gcc version "%s"\n' \
+ "$program_name" "$gcc_version" >&2
+ return 1
+ ;;
+ (4.8.*)
+ printf 'GCC48\n'
+ ;;
+ (4.9.*|6.[0-2].*)
+ printf 'GCC49\n'
+ ;;
+ (*)
+ printf 'GCC5\n'
+ ;;
+ esac
+ ;;
+ esac
+}
+
+
+# Determine the name of the environment variable that exposes the
+# cross-compiler prefix to the edk2 "build" utility. Print the result to the
+# standard output.
+#
+# Parameters:
+# $1: QEMU system emulation target
+qemu_edk2_get_cross_prefix_var()
+{
+ local emulation_target="$1"
+ local edk2_toolchain
+ local edk2_arch
+
+ if ! edk2_toolchain=$(qemu_edk2_get_toolchain "$emulation_target"); then
+ return 1
+ fi
+
+ case "$emulation_target" in
+ (arm|aarch64)
+ if ! edk2_arch=$(qemu_edk2_get_arch "$emulation_target"); then
+ return 1
+ fi
+ printf '%s_%s_PREFIX\n' "$edk2_toolchain" "$edk2_arch"
+ ;;
+ (i386|x86_64)
+ printf '%s_BIN\n' "$edk2_toolchain"
+ ;;
+ esac
+}
+
+
+# Set and export the environment variable(s) necessary for cross-compilation,
+# whenever needed by the edk2 "build" utility.
+#
+# Parameters:
+# $1: QEMU system emulation target
+qemu_edk2_set_cross_env()
+{
+ local emulation_target="$1"
+ local cross_prefix
+ local cross_prefix_var
+
+ if ! cross_prefix=$(qemu_edk2_get_cross_prefix "$emulation_target"); then
+ return 1
+ fi
+
+ if [ -z "$cross_prefix" ]; then
+ # Nothing to do.
+ return 0
+ fi
+
+ if ! cross_prefix_var=$(qemu_edk2_get_cross_prefix_var \
+ "$emulation_target"); then
+ return 1
+ fi
+
+ eval "export $cross_prefix_var=\$cross_prefix"
+}
+
+
+# Determine the "-n" option argument (that is, the number of modules to build
+# in parallel) for the edk2 "build" utility. Print the result to the standard
+# output.
+#
+# Parameters:
+# $1: the value of the MAKEFLAGS variable
+qemu_edk2_get_thread_count()
+{
+ local makeflags="$1"
+
+ if [[ "$makeflags" == *--jobserver-auth=* ]] ||
+ [[ "$makeflags" == *--jobserver-fds=* ]]; then
+ # If there is a job server, allow the edk2 "build" utility to parallelize
+ # as many module builds as there are logical CPUs in the system. The "make"
+ # instances forked by "build" are supposed to limit themselves through the
+ # job server. The zero value below causes the edk2 "build" utility to fetch
+ # the logical CPU count with Python's multiprocessing.cpu_count() method.
+ printf '0\n'
+ else
+ # Build a single module at a time.
+ printf '1\n'
+ fi
+}
+
+
+# Work around <https://bugzilla.tianocore.org/show_bug.cgi?id=1607> by
+# filtering jobserver-related flags out of MAKEFLAGS. Print the result to the
+# standard output.
+#
+# Parameters:
+# $1: the value of the MAKEFLAGS variable
+qemu_edk2_quirk_tianocore_1607()
+{
+ local makeflags="$1"
+
+ printf %s "$makeflags" \
+ | LC_ALL=C sed --regexp-extended \
+ --expression='s/--jobserver-(auth|fds)=[0-9]+,[0-9]+//' \
+ --expression='s/-j([0-9]+)?//'
+}