1b1c0d031SGerd Hoffmann 20221d73cSGerd Hoffmannvgabios_variants := stdvga cirrus vmware qxl isavga virtio bochs-display ramfb ati 35a7bd333SGerd Hoffmannvgabios_targets := $(subst -isavga,,$(patsubst %,vgabios-%.bin,$(vgabios_variants))) 44d9dc8b7SGerd Hoffmannpxerom_variants := e1000 e1000e eepro100 ne2k_pci pcnet rtl8139 virtio vmxnet3 54d9dc8b7SGerd Hoffmannpxerom_targets := 8086100e 808610d3 80861209 10500940 10222000 10ec8139 1af41000 15ad07b0 62397edd7SGerd Hoffmann 72f3f430dSGerd Hoffmannpxe-rom-e1000 efi-rom-e1000 : VID := 8086 82f3f430dSGerd Hoffmannpxe-rom-e1000 efi-rom-e1000 : DID := 100e 9c9c3dc5fSGerd Hoffmannpxe-rom-e1000e efi-rom-e1000e : VID := 8086 10c9c3dc5fSGerd Hoffmannpxe-rom-e1000e efi-rom-e1000e : DID := 10d3 112f3f430dSGerd Hoffmannpxe-rom-eepro100 efi-rom-eepro100 : VID := 8086 122f3f430dSGerd Hoffmannpxe-rom-eepro100 efi-rom-eepro100 : DID := 1209 132f3f430dSGerd Hoffmannpxe-rom-ne2k_pci efi-rom-ne2k_pci : VID := 1050 142f3f430dSGerd Hoffmannpxe-rom-ne2k_pci efi-rom-ne2k_pci : DID := 0940 152f3f430dSGerd Hoffmannpxe-rom-pcnet efi-rom-pcnet : VID := 1022 162f3f430dSGerd Hoffmannpxe-rom-pcnet efi-rom-pcnet : DID := 2000 172f3f430dSGerd Hoffmannpxe-rom-rtl8139 efi-rom-rtl8139 : VID := 10ec 182f3f430dSGerd Hoffmannpxe-rom-rtl8139 efi-rom-rtl8139 : DID := 8139 192f3f430dSGerd Hoffmannpxe-rom-virtio efi-rom-virtio : VID := 1af4 202f3f430dSGerd Hoffmannpxe-rom-virtio efi-rom-virtio : DID := 1000 214d9dc8b7SGerd Hoffmannpxe-rom-vmxnet3 efi-rom-vmxnet3 : VID := 15ad 224d9dc8b7SGerd Hoffmannpxe-rom-vmxnet3 efi-rom-vmxnet3 : DID := 07b0 232f3f430dSGerd Hoffmann 242f3f430dSGerd Hoffmann# 25bcf06c15SGerd Hoffmann# cross compiler auto detection 26bcf06c15SGerd Hoffmann# 27bcf06c15SGerd Hoffmannpath := $(subst :, ,$(PATH)) 28bcf06c15SGerd Hoffmannsystem := $(shell uname -s | tr "A-Z" "a-z") 29bcf06c15SGerd Hoffmann 30bcf06c15SGerd Hoffmann# first find cross binutils in path 31bcf06c15SGerd Hoffmannfind-cross-ld = $(firstword $(wildcard $(patsubst %,%/$(1)-*$(system)*-ld,$(path)))) 32bcf06c15SGerd Hoffmann# then check we have cross gcc too 33bcf06c15SGerd Hoffmannfind-cross-gcc = $(firstword $(wildcard $(patsubst %ld,%gcc,$(call find-cross-ld,$(1))))) 34bcf06c15SGerd Hoffmann# finally strip off path + toolname so we get the prefix 35bcf06c15SGerd Hoffmannfind-cross-prefix = $(subst gcc,,$(notdir $(call find-cross-gcc,$(1)))) 36bcf06c15SGerd Hoffmann 37d1cb5edaSHavard Skinnemoenarm_cross_prefix := $(call find-cross-prefix,arm) 38bcf06c15SGerd Hoffmannpowerpc64_cross_prefix := $(call find-cross-prefix,powerpc64) 394e73c781SAlexander Grafpowerpc_cross_prefix := $(call find-cross-prefix,powerpc) 40779fa9d7SGerd Hoffmannx86_64_cross_prefix := $(call find-cross-prefix,x86_64) 4191f3a2f0SAlistair Francisriscv32_cross_prefix := $(call find-cross-prefix,riscv32) 4291f3a2f0SAlistair Francisriscv64_cross_prefix := $(call find-cross-prefix,riscv64) 43bcf06c15SGerd Hoffmann 447edf2f0eSGerd Hoffmann# tag our seabios builds 45af51dbedSGerd HoffmannSEABIOS_EXTRAVERSION="-prebuilt.qemu.org" 467edf2f0eSGerd Hoffmann 47bcf06c15SGerd Hoffmann# 482f3f430dSGerd Hoffmann# EfiRom utility is shipped with edk2 / tianocore, in BaseTools/ 492f3f430dSGerd Hoffmann# 502f3f430dSGerd Hoffmann# We need that to combine multiple images (legacy bios, 512f3f430dSGerd Hoffmann# efi ia32, efi x64) into a single rom binary. 522f3f430dSGerd Hoffmann# 53d912e795SPhilippe Mathieu-DaudéEDK2_EFIROM = edk2/BaseTools/Source/C/bin/EfiRom 54b4566776SGerd Hoffmann 556f8a70f6SPhilippe Mathieu-Daudédefault help: 56b1c0d031SGerd Hoffmann @echo "nothing is build by default" 57b1c0d031SGerd Hoffmann @echo "available build targets:" 58b1c0d031SGerd Hoffmann @echo " bios -- update bios.bin (seabios)" 5991b8eba9SGerd Hoffmann @echo " vgabios -- update vgabios binaries (seabios)" 602397edd7SGerd Hoffmann @echo " pxerom -- update nic roms (bios only)" 61f590a812SLaszlo Ersek @echo " efirom -- update nic roms (bios+efi)" 62bcf06c15SGerd Hoffmann @echo " slof -- update slof.bin" 63bcad45deSCédric Le Goater @echo " skiboot -- update skiboot.lid" 644e73c781SAlexander Graf @echo " u-boot.e500 -- update u-boot.e500" 65b41a162cSBALATON Zoltan @echo " u-boot.sam460 -- update u-boot.sam460" 66d1cb5edaSHavard Skinnemoen @echo " npcm7xx_bootrom -- update vbootrom for npcm7xx" 67536d2173SLaszlo Ersek @echo " efi -- update UEFI (edk2) platform firmware" 6800db05fbSBin Meng @echo " opensbi32-generic -- update OpenSBI for 32-bit generic machine" 6900db05fbSBin Meng @echo " opensbi64-generic -- update OpenSBI for 64-bit generic machine" 703bee1d1dSGerd Hoffmann @echo " qboot -- update qboot" 7160c85ec8SPhilippe Mathieu-Daudé @echo " clean -- delete the files generated by the previous" \ 7260c85ec8SPhilippe Mathieu-Daudé "build targets" 73b1c0d031SGerd Hoffmann 74be404fa5SGerd Hoffmannbios: build-seabios-config-seabios-128k \ 75be404fa5SGerd Hoffmann build-seabios-config-seabios-256k \ 76be404fa5SGerd Hoffmann build-seabios-config-seabios-microvm 7794e68caaSGerd Hoffmann cp seabios/builds/seabios-128k/bios.bin ../pc-bios/bios.bin 7894e68caaSGerd Hoffmann cp seabios/builds/seabios-256k/bios.bin ../pc-bios/bios-256k.bin 79be404fa5SGerd Hoffmann cp seabios/builds/seabios-microvm/bios.bin ../pc-bios/bios-microvm.bin 80b4566776SGerd Hoffmann 8191b8eba9SGerd Hoffmannvgabios seavgabios: $(patsubst %,seavgabios-%,$(vgabios_variants)) 82b4566776SGerd Hoffmann 8395f7c680SGerd Hoffmannseavgabios-isavga: build-seabios-config-vga-isavga 8495f7c680SGerd Hoffmann cp seabios/builds/vga-isavga/vgabios.bin ../pc-bios/vgabios.bin 8595f7c680SGerd Hoffmann 8695f7c680SGerd Hoffmannseavgabios-%: build-seabios-config-vga-% 8795f7c680SGerd Hoffmann cp seabios/builds/vga-$*/vgabios.bin ../pc-bios/vgabios-$*.bin 8895f7c680SGerd Hoffmann 8995f7c680SGerd Hoffmannbuild-seabios-config-%: config.% 9095f7c680SGerd Hoffmann mkdir -p seabios/builds/$* 9195f7c680SGerd Hoffmann cp $< seabios/builds/$*/.config 9250df8d5dSBruce Rogers $(MAKE) -C seabios \ 93437b8d8cSGerd Hoffmann EXTRAVERSION=$(SEABIOS_EXTRAVERSION) \ 9478ac44afSRoman Bolshakov CROSS_PREFIX=$(x86_64_cross_prefix) \ 9595f7c680SGerd Hoffmann KCONFIG_CONFIG=$(CURDIR)/seabios/builds/$*/.config \ 9695f7c680SGerd Hoffmann OUT=$(CURDIR)/seabios/builds/$*/ oldnoconfig 9750df8d5dSBruce Rogers $(MAKE) -C seabios \ 98437b8d8cSGerd Hoffmann EXTRAVERSION=$(SEABIOS_EXTRAVERSION) \ 9978ac44afSRoman Bolshakov CROSS_PREFIX=$(x86_64_cross_prefix) \ 10095f7c680SGerd Hoffmann KCONFIG_CONFIG=$(CURDIR)/seabios/builds/$*/.config \ 10195f7c680SGerd Hoffmann OUT=$(CURDIR)/seabios/builds/$*/ all 102b4566776SGerd Hoffmann 1031ede4dd0SGerd Hoffmann 104b482fb43SThomas Huth.PHONY: skiboot qboot 105774e80eaSGerd Hoffmann 1062397edd7SGerd Hoffmannpxerom: $(patsubst %,pxe-rom-%,$(pxerom_variants)) 1072397edd7SGerd Hoffmann 10846ef7f33SGerd Hoffmannpxe-rom-%: build-pxe-roms 1092397edd7SGerd Hoffmann cp ipxe/src/bin/$(VID)$(DID).rom ../pc-bios/pxe-$*.rom 1102f3f430dSGerd Hoffmann 1112f3f430dSGerd Hoffmannefirom: $(patsubst %,efi-rom-%,$(pxerom_variants)) 1122f3f430dSGerd Hoffmann 113ee5ef780SLaszlo Ersekefi-rom-%: build-pxe-roms build-efi-roms edk2-basetools 114d912e795SPhilippe Mathieu-Daudé $(EDK2_EFIROM) -f "0x$(VID)" -i "0x$(DID)" -l 0x02 \ 1152f3f430dSGerd Hoffmann -b ipxe/src/bin/$(VID)$(DID).rom \ 1162f3f430dSGerd Hoffmann -ec ipxe/src/bin-x86_64-efi/$(VID)$(DID).efidrv \ 1172f3f430dSGerd Hoffmann -o ../pc-bios/efi-$*.rom 11895ca557dSGerd Hoffmann 119cf2b4b5bSGerd Hoffmannbuild-pxe-roms: 120cf2b4b5bSGerd Hoffmann $(MAKE) -C ipxe/src CONFIG=qemu \ 121779fa9d7SGerd Hoffmann CROSS_COMPILE=$(x86_64_cross_prefix) \ 12246ef7f33SGerd Hoffmann $(patsubst %,bin/%.rom,$(pxerom_targets)) 12346ef7f33SGerd Hoffmann 124cf2b4b5bSGerd Hoffmannbuild-efi-roms: build-pxe-roms 125cf2b4b5bSGerd Hoffmann $(MAKE) -C ipxe/src CONFIG=qemu \ 126779fa9d7SGerd Hoffmann CROSS_COMPILE=$(x86_64_cross_prefix) \ 12746ef7f33SGerd Hoffmann $(patsubst %,bin-x86_64-efi/%.efidrv,$(pxerom_targets)) 12846ef7f33SGerd Hoffmann 129bcf06c15SGerd Hoffmannslof: 13050df8d5dSBruce Rogers $(MAKE) -C SLOF CROSS=$(powerpc64_cross_prefix) qemu 131bcf06c15SGerd Hoffmann cp SLOF/boot_rom.bin ../pc-bios/slof.bin 132bcf06c15SGerd Hoffmann 1334e73c781SAlexander Grafu-boot.e500: 1348c8a7ed5SBin Meng $(MAKE) -C u-boot O=build-e500 qemu-ppce500_config 1354e73c781SAlexander Graf $(MAKE) -C u-boot CROSS_COMPILE=$(powerpc_cross_prefix) \ 1368c8a7ed5SBin Meng O=build-e500 1378c8a7ed5SBin Meng $(powerpc_cross_prefix)strip u-boot/build-e500/u-boot -o \ 1384e73c781SAlexander Graf ../pc-bios/u-boot.e500 139bcf06c15SGerd Hoffmann 140b41a162cSBALATON Zoltanu-boot.sam460: 141b41a162cSBALATON Zoltan $(MAKE) -C u-boot-sam460ex Sam460ex_config 142b41a162cSBALATON Zoltan $(MAKE) -C u-boot-sam460ex CROSS_COMPILE=$(powerpc_cross_prefix) 143b41a162cSBALATON Zoltan cp u-boot-sam460ex/u-boot.bin ../pc-bios/u-boot-sam460-20100605.bin 144b41a162cSBALATON Zoltan 145bcad45deSCédric Le Goaterskiboot: 146bcad45deSCédric Le Goater $(MAKE) -C skiboot CROSS=$(powerpc64_cross_prefix) 147bcad45deSCédric Le Goater cp skiboot/skiboot.lid ../pc-bios/skiboot.lid 148bcad45deSCédric Le Goater 149*22e11539SGerd Hoffmannefi: 150*22e11539SGerd Hoffmann python3 edk2-build.py --config edk2-build.config \ 151*22e11539SGerd Hoffmann --version-override "edk2-stable202302-for-qemu" \ 152*22e11539SGerd Hoffmann --release-date "03/01/2023" 153*22e11539SGerd Hoffmann rm -f ../pc-bios/edk2-*.fd.bz2 154*22e11539SGerd Hoffmann bzip2 --verbose ../pc-bios/edk2-*.fd 155536d2173SLaszlo Ersek 15600db05fbSBin Mengopensbi32-generic: 15791f3a2f0SAlistair Francis $(MAKE) -C opensbi \ 15891f3a2f0SAlistair Francis CROSS_COMPILE=$(riscv32_cross_prefix) \ 15900db05fbSBin Meng PLATFORM="generic" 16000db05fbSBin Meng cp opensbi/build/platform/generic/firmware/fw_dynamic.bin ../pc-bios/opensbi-riscv32-generic-fw_dynamic.bin 16191f3a2f0SAlistair Francis 16200db05fbSBin Mengopensbi64-generic: 16391f3a2f0SAlistair Francis $(MAKE) -C opensbi \ 16491f3a2f0SAlistair Francis CROSS_COMPILE=$(riscv64_cross_prefix) \ 16500db05fbSBin Meng PLATFORM="generic" 16600db05fbSBin Meng cp opensbi/build/platform/generic/firmware/fw_dynamic.bin ../pc-bios/opensbi-riscv64-generic-fw_dynamic.bin 16791f3a2f0SAlistair Francis 1685983021eSPaolo BonziniMESON = meson 1695983021eSPaolo BonziniNINJA = ninja 1703bee1d1dSGerd Hoffmannqboot: 1715983021eSPaolo Bonzini mkdir -p qboot/build 1725983021eSPaolo Bonzini $(MESON) setup $(if $(wildcard qboot/build/meson-private),--wipe,) qboot qboot/build 1735983021eSPaolo Bonzini $(NINJA) -C qboot/build 1745983021eSPaolo Bonzini cp qboot/build/bios.bin ../pc-bios/qboot.rom 1750d5fae3eSSergio Lopez 176d1cb5edaSHavard Skinnemoennpcm7xx_bootrom: 177d1cb5edaSHavard Skinnemoen $(MAKE) -C vbootrom CROSS_COMPILE=$(arm_cross_prefix) 178d1cb5edaSHavard Skinnemoen cp vbootrom/npcm7xx_bootrom.bin ../pc-bios/npcm7xx_bootrom.bin 179d1cb5edaSHavard Skinnemoen 18068875817SGerd Hoffmannclean: 18195f7c680SGerd Hoffmann rm -rf seabios/.config seabios/out seabios/builds 18250df8d5dSBruce Rogers $(MAKE) -C ipxe/src veryclean 183f590a812SLaszlo Ersek $(MAKE) -C edk2/BaseTools clean 18450df8d5dSBruce Rogers $(MAKE) -C SLOF clean 1858c8a7ed5SBin Meng rm -rf u-boot/build-e500 186b41a162cSBALATON Zoltan $(MAKE) -C u-boot-sam460ex distclean 187bcad45deSCédric Le Goater $(MAKE) -C skiboot clean 188*22e11539SGerd Hoffmann rm -rf Build 18991f3a2f0SAlistair Francis $(MAKE) -C opensbi clean 1900d5fae3eSSergio Lopez $(MAKE) -C qboot clean 191d1cb5edaSHavard Skinnemoen $(MAKE) -C vbootrom clean 192