xref: /openbmc/qemu/roms/Makefile (revision 5a7bd333)
1b1c0d031SGerd Hoffmann
2*5a7bd333SGerd Hoffmannvgabios_variants := stdvga cirrus vmware qxl isavga
3*5a7bd333SGerd Hoffmannvgabios_targets  := $(subst -isavga,,$(patsubst %,vgabios-%.bin,$(vgabios_variants)))
42397edd7SGerd Hoffmannpxerom_variants  := e1000 eepro100 ne2k_pci pcnet rtl8139 virtio
52397edd7SGerd Hoffmann
62f3f430dSGerd Hoffmannpxe-rom-e1000    efi-rom-e1000    : VID := 8086
72f3f430dSGerd Hoffmannpxe-rom-e1000    efi-rom-e1000    : DID := 100e
82f3f430dSGerd Hoffmannpxe-rom-eepro100 efi-rom-eepro100 : VID := 8086
92f3f430dSGerd Hoffmannpxe-rom-eepro100 efi-rom-eepro100 : DID := 1209
102f3f430dSGerd Hoffmannpxe-rom-ne2k_pci efi-rom-ne2k_pci : VID := 1050
112f3f430dSGerd Hoffmannpxe-rom-ne2k_pci efi-rom-ne2k_pci : DID := 0940
122f3f430dSGerd Hoffmannpxe-rom-pcnet    efi-rom-pcnet    : VID := 1022
132f3f430dSGerd Hoffmannpxe-rom-pcnet    efi-rom-pcnet    : DID := 2000
142f3f430dSGerd Hoffmannpxe-rom-rtl8139  efi-rom-rtl8139  : VID := 10ec
152f3f430dSGerd Hoffmannpxe-rom-rtl8139  efi-rom-rtl8139  : DID := 8139
162f3f430dSGerd Hoffmannpxe-rom-virtio   efi-rom-virtio   : VID := 1af4
172f3f430dSGerd Hoffmannpxe-rom-virtio   efi-rom-virtio   : DID := 1000
182f3f430dSGerd Hoffmann
192f3f430dSGerd Hoffmann#
202f3f430dSGerd Hoffmann# EfiRom utility is shipped with edk2 / tianocore, in BaseTools/
212f3f430dSGerd Hoffmann#
222f3f430dSGerd Hoffmann# We need that to combine multiple images (legacy bios,
232f3f430dSGerd Hoffmann# efi ia32, efi x64) into a single rom binary.
242f3f430dSGerd Hoffmann#
252f3f430dSGerd Hoffmann# We try to find it in the path.  You can also pass the location on
262f3f430dSGerd Hoffmann# the command line, i.e. "make EFIROM=/path/to/EfiRom efirom"
272f3f430dSGerd Hoffmann#
282f3f430dSGerd HoffmannEFIROM ?= $(shell which EfiRom 2>/dev/null)
29b4566776SGerd Hoffmann
30b1c0d031SGerd Hoffmanndefault:
31b1c0d031SGerd Hoffmann	@echo "nothing is build by default"
32b1c0d031SGerd Hoffmann	@echo "available build targets:"
33b1c0d031SGerd Hoffmann	@echo "  bios           -- update bios.bin (seabios)"
34b4566776SGerd Hoffmann	@echo "  seavgabios     -- update vgabios binaries (seabios)"
35b4566776SGerd Hoffmann	@echo "  lgplvgabios    -- update vgabios binaries (lgpl)"
362397edd7SGerd Hoffmann	@echo "  pxerom         -- update nic roms (bios only)"
372f3f430dSGerd Hoffmann	@echo "  efirom         -- update nic roms (bios+efi, this needs"
382f3f430dSGerd Hoffmann	@echo "                    the EfiRom utility from edk2 / tianocore)"
39b1c0d031SGerd Hoffmann
40b1c0d031SGerd Hoffmannbios: config.seabios
41b1c0d031SGerd Hoffmann	sh configure-seabios.sh $<
42b1c0d031SGerd Hoffmann	make -C seabios out/bios.bin
43b1c0d031SGerd Hoffmann	cp seabios/out/bios.bin ../pc-bios/bios.bin
447527bd85SGerd Hoffmann	cp seabios/out/*dsdt.aml ../pc-bios/
45b4566776SGerd Hoffmann
46b4566776SGerd Hoffmannseavgabios: $(patsubst %,seavgabios-%,$(vgabios_variants))
47b4566776SGerd Hoffmann
48b4566776SGerd Hoffmannseavgabios-%: config.vga.%
49b4566776SGerd Hoffmann	sh configure-seabios.sh $<
50b4566776SGerd Hoffmann	make -C seabios out/vgabios.bin
51b4566776SGerd Hoffmann	cp seabios/out/vgabios.bin ../pc-bios/vgabios-$*.bin
52b4566776SGerd Hoffmann
531ede4dd0SGerd Hoffmann
54b4566776SGerd Hoffmannlgplvgabios: $(patsubst %,lgplvgabios-%,$(vgabios_variants))
55b4566776SGerd Hoffmann
56*5a7bd333SGerd Hoffmannlgplvgabios-isavga: build-lgplvgabios
57*5a7bd333SGerd Hoffmann	cp vgabios/VGABIOS-lgpl-latest.bin ../pc-bios/vgabios.bin
581ede4dd0SGerd Hoffmannlgplvgabios-%: build-lgplvgabios
59b4566776SGerd Hoffmann	cp vgabios/VGABIOS-lgpl-latest.$*.bin ../pc-bios/vgabios-$*.bin
602397edd7SGerd Hoffmann
611ede4dd0SGerd Hoffmannbuild-lgplvgabios:
621ede4dd0SGerd Hoffmann	$(MAKE) $(MAKEFLAGS) -C vgabios $(vgabios_targets)
631ede4dd0SGerd Hoffmann
641ede4dd0SGerd Hoffmann
652397edd7SGerd Hoffmannpxerom: $(patsubst %,pxe-rom-%,$(pxerom_variants))
662397edd7SGerd Hoffmann
6795ca557dSGerd Hoffmannpxe-rom-%: ipxe/src/config/local/general.h
682397edd7SGerd Hoffmann	make -C ipxe/src bin/$(VID)$(DID).rom
692397edd7SGerd Hoffmann	cp ipxe/src/bin/$(VID)$(DID).rom ../pc-bios/pxe-$*.rom
702f3f430dSGerd Hoffmann
712f3f430dSGerd Hoffmannefirom: $(patsubst %,efi-rom-%,$(pxerom_variants))
722f3f430dSGerd Hoffmann
7395ca557dSGerd Hoffmannefi-rom-%: ipxe/src/config/local/general.h
742f3f430dSGerd Hoffmann	make -C ipxe/src bin/$(VID)$(DID).rom
752f3f430dSGerd Hoffmann	make -C ipxe/src bin-i386-efi/$(VID)$(DID).efidrv
762f3f430dSGerd Hoffmann	make -C ipxe/src bin-x86_64-efi/$(VID)$(DID).efidrv
772f3f430dSGerd Hoffmann	$(EFIROM) -f "0x$(VID)" -i "0x$(DID)" -l 0x02 \
782f3f430dSGerd Hoffmann		-b ipxe/src/bin/$(VID)$(DID).rom \
792f3f430dSGerd Hoffmann		-ec ipxe/src/bin-i386-efi/$(VID)$(DID).efidrv \
802f3f430dSGerd Hoffmann		-ec ipxe/src/bin-x86_64-efi/$(VID)$(DID).efidrv \
812f3f430dSGerd Hoffmann		-o ../pc-bios/efi-$*.rom
8295ca557dSGerd Hoffmann
8395ca557dSGerd Hoffmannipxe/src/config/local/%: config.ipxe.%
8495ca557dSGerd Hoffmann	cp $< $@
8568875817SGerd Hoffmann
8668875817SGerd Hoffmann
8768875817SGerd Hoffmannclean:
8868875817SGerd Hoffmann	rm -rf seabios/.config seabios/out
8968875817SGerd Hoffmann	$(MAKE) $(MAKEFLAGS) -C vgabios clean
9068875817SGerd Hoffmann	rm -f vgabios/VGABIOS-lgpl-latest*
9168875817SGerd Hoffmann	$(MAKE) $(MAKEFLAGS) -C ipxe/src veryclean
92