]> git.proxmox.com Git - mirror_qemu.git/blobdiff - roms/Makefile
roms: Add virtual Boot ROM for NPCM7xx SoCs
[mirror_qemu.git] / roms / Makefile
index a6043eff37e9f1ed862dae7b4617b16cb10f4c0d..3726f06fe7ebadccc797cb4b47227e33170b4849 100644 (file)
@@ -1,5 +1,5 @@
 
-vgabios_variants := stdvga cirrus vmware qxl isavga virtio bochs-display ramfb
+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
@@ -34,9 +34,12 @@ find-cross-gcc = $(firstword $(wildcard $(patsubst %ld,%gcc,$(call find-cross-ld
 # 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"
@@ -47,24 +50,27 @@ SEABIOS_EXTRAVERSION="-prebuilt.qemu.org"
 # We need that to combine multiple images (legacy bios,
 # efi ia32, efi x64) into a single rom binary.
 #
-# We try to find it in the path.  You can also pass the location on
-# the command line, i.e. "make EFIROM=/path/to/EfiRom efirom"
-#
-EFIROM ?= $(shell which EfiRom 2>/dev/null)
+EDK2_EFIROM = edk2/BaseTools/Source/C/bin/EfiRom
 
-default:
+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, this needs"
-       @echo "                    the EfiRom utility from edk2 / tianocore)"
-       @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 "  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 "  bios-microvm       -- update bios-microvm.bin (qboot)"
+       @echo "  clean              -- delete the files generated by the previous" \
+                                     "build targets"
 
 bios: build-seabios-config-seabios-128k build-seabios-config-seabios-256k
        cp seabios/builds/seabios-128k/bios.bin ../pc-bios/bios.bin
@@ -106,10 +112,9 @@ pxe-rom-%: build-pxe-roms
 
 efirom: $(patsubst %,efi-rom-%,$(pxerom_variants))
 
-efi-rom-%: build-pxe-roms build-efi-roms
-       $(EFIROM) -f "0x$(VID)" -i "0x$(DID)" -l 0x02 \
+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-i386-efi/$(VID)$(DID).efidrv \
                -ec ipxe/src/bin-x86_64-efi/$(VID)$(DID).efidrv \
                -o ../pc-bios/efi-$*.rom
 
@@ -121,9 +126,25 @@ build-pxe-roms:
 build-efi-roms: build-pxe-roms
        $(MAKE) -C ipxe/src CONFIG=qemu \
                CROSS_COMPILE=$(x86_64_cross_prefix) \
-               $(patsubst %,bin-i386-efi/%.efidrv,$(pxerom_targets)) \
                $(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
+       $(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
@@ -145,12 +166,42 @@ 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
+
+bios-microvm:
+       $(MAKE) -C qboot
+       cp qboot/bios.bin ../pc-bios/bios-microvm.bin
+
+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