xref: /openbmc/qemu/roms/Makefile (revision 46ef7f33)
1b1c0d031SGerd Hoffmann
25a7bd333SGerd Hoffmannvgabios_variants := stdvga cirrus vmware qxl isavga
35a7bd333SGerd Hoffmannvgabios_targets  := $(subst -isavga,,$(patsubst %,vgabios-%.bin,$(vgabios_variants)))
42397edd7SGerd Hoffmannpxerom_variants  := e1000 eepro100 ne2k_pci pcnet rtl8139 virtio
5*46ef7f33SGerd Hoffmannpxerom_targets   := 8086100e 80861209 10500940 10222000 10ec8139 1af41000
62397edd7SGerd Hoffmann
72f3f430dSGerd Hoffmannpxe-rom-e1000    efi-rom-e1000    : VID := 8086
82f3f430dSGerd Hoffmannpxe-rom-e1000    efi-rom-e1000    : DID := 100e
92f3f430dSGerd Hoffmannpxe-rom-eepro100 efi-rom-eepro100 : VID := 8086
102f3f430dSGerd Hoffmannpxe-rom-eepro100 efi-rom-eepro100 : DID := 1209
112f3f430dSGerd Hoffmannpxe-rom-ne2k_pci efi-rom-ne2k_pci : VID := 1050
122f3f430dSGerd Hoffmannpxe-rom-ne2k_pci efi-rom-ne2k_pci : DID := 0940
132f3f430dSGerd Hoffmannpxe-rom-pcnet    efi-rom-pcnet    : VID := 1022
142f3f430dSGerd Hoffmannpxe-rom-pcnet    efi-rom-pcnet    : DID := 2000
152f3f430dSGerd Hoffmannpxe-rom-rtl8139  efi-rom-rtl8139  : VID := 10ec
162f3f430dSGerd Hoffmannpxe-rom-rtl8139  efi-rom-rtl8139  : DID := 8139
172f3f430dSGerd Hoffmannpxe-rom-virtio   efi-rom-virtio   : VID := 1af4
182f3f430dSGerd Hoffmannpxe-rom-virtio   efi-rom-virtio   : DID := 1000
192f3f430dSGerd Hoffmann
202f3f430dSGerd Hoffmann#
212f3f430dSGerd Hoffmann# EfiRom utility is shipped with edk2 / tianocore, in BaseTools/
222f3f430dSGerd Hoffmann#
232f3f430dSGerd Hoffmann# We need that to combine multiple images (legacy bios,
242f3f430dSGerd Hoffmann# efi ia32, efi x64) into a single rom binary.
252f3f430dSGerd Hoffmann#
262f3f430dSGerd Hoffmann# We try to find it in the path.  You can also pass the location on
272f3f430dSGerd Hoffmann# the command line, i.e. "make EFIROM=/path/to/EfiRom efirom"
282f3f430dSGerd Hoffmann#
292f3f430dSGerd HoffmannEFIROM ?= $(shell which EfiRom 2>/dev/null)
30b4566776SGerd Hoffmann
31b1c0d031SGerd Hoffmanndefault:
32b1c0d031SGerd Hoffmann	@echo "nothing is build by default"
33b1c0d031SGerd Hoffmann	@echo "available build targets:"
34b1c0d031SGerd Hoffmann	@echo "  bios           -- update bios.bin (seabios)"
35b4566776SGerd Hoffmann	@echo "  seavgabios     -- update vgabios binaries (seabios)"
36b4566776SGerd Hoffmann	@echo "  lgplvgabios    -- update vgabios binaries (lgpl)"
372397edd7SGerd Hoffmann	@echo "  pxerom         -- update nic roms (bios only)"
382f3f430dSGerd Hoffmann	@echo "  efirom         -- update nic roms (bios+efi, this needs"
392f3f430dSGerd Hoffmann	@echo "                    the EfiRom utility from edk2 / tianocore)"
40b1c0d031SGerd Hoffmann
41b1c0d031SGerd Hoffmannbios: config.seabios
42b1c0d031SGerd Hoffmann	sh configure-seabios.sh $<
43b1c0d031SGerd Hoffmann	make -C seabios out/bios.bin
44b1c0d031SGerd Hoffmann	cp seabios/out/bios.bin ../pc-bios/bios.bin
457527bd85SGerd Hoffmann	cp seabios/out/*dsdt.aml ../pc-bios/
46b4566776SGerd Hoffmann
47b4566776SGerd Hoffmannseavgabios: $(patsubst %,seavgabios-%,$(vgabios_variants))
48b4566776SGerd Hoffmann
49b4566776SGerd Hoffmannseavgabios-%: config.vga.%
50b4566776SGerd Hoffmann	sh configure-seabios.sh $<
51b4566776SGerd Hoffmann	make -C seabios out/vgabios.bin
52b4566776SGerd Hoffmann	cp seabios/out/vgabios.bin ../pc-bios/vgabios-$*.bin
53b4566776SGerd Hoffmann
541ede4dd0SGerd Hoffmann
55b4566776SGerd Hoffmannlgplvgabios: $(patsubst %,lgplvgabios-%,$(vgabios_variants))
56b4566776SGerd Hoffmann
575a7bd333SGerd Hoffmannlgplvgabios-isavga: build-lgplvgabios
585a7bd333SGerd Hoffmann	cp vgabios/VGABIOS-lgpl-latest.bin ../pc-bios/vgabios.bin
591ede4dd0SGerd Hoffmannlgplvgabios-%: build-lgplvgabios
60b4566776SGerd Hoffmann	cp vgabios/VGABIOS-lgpl-latest.$*.bin ../pc-bios/vgabios-$*.bin
612397edd7SGerd Hoffmann
621ede4dd0SGerd Hoffmannbuild-lgplvgabios:
631ede4dd0SGerd Hoffmann	$(MAKE) $(MAKEFLAGS) -C vgabios $(vgabios_targets)
641ede4dd0SGerd Hoffmann
651ede4dd0SGerd Hoffmann
662397edd7SGerd Hoffmannpxerom: $(patsubst %,pxe-rom-%,$(pxerom_variants))
672397edd7SGerd Hoffmann
68*46ef7f33SGerd Hoffmannpxe-rom-%: build-pxe-roms
692397edd7SGerd Hoffmann	cp ipxe/src/bin/$(VID)$(DID).rom ../pc-bios/pxe-$*.rom
702f3f430dSGerd Hoffmann
712f3f430dSGerd Hoffmannefirom: $(patsubst %,efi-rom-%,$(pxerom_variants))
722f3f430dSGerd Hoffmann
73*46ef7f33SGerd Hoffmannefi-rom-%: build-pxe-roms build-efi-roms
742f3f430dSGerd Hoffmann	$(EFIROM) -f "0x$(VID)" -i "0x$(DID)" -l 0x02 \
752f3f430dSGerd Hoffmann		-b ipxe/src/bin/$(VID)$(DID).rom \
762f3f430dSGerd Hoffmann		-ec ipxe/src/bin-i386-efi/$(VID)$(DID).efidrv \
772f3f430dSGerd Hoffmann		-ec ipxe/src/bin-x86_64-efi/$(VID)$(DID).efidrv \
782f3f430dSGerd Hoffmann		-o ../pc-bios/efi-$*.rom
7995ca557dSGerd Hoffmann
80*46ef7f33SGerd Hoffmannbuild-pxe-roms: ipxe/src/config/local/general.h
81*46ef7f33SGerd Hoffmann	$(MAKE) $(MAKEFLAGS) -C ipxe/src GITVERSION="" \
82*46ef7f33SGerd Hoffmann		$(patsubst %,bin/%.rom,$(pxerom_targets))
83*46ef7f33SGerd Hoffmann
84*46ef7f33SGerd Hoffmannbuild-efi-roms: build-pxe-roms ipxe/src/config/local/general.h
85*46ef7f33SGerd Hoffmann	$(MAKE) $(MAKEFLAGS) -C ipxe/src GITVERSION="" \
86*46ef7f33SGerd Hoffmann		$(patsubst %,bin-i386-efi/%.efidrv,$(pxerom_targets)) \
87*46ef7f33SGerd Hoffmann		$(patsubst %,bin-x86_64-efi/%.efidrv,$(pxerom_targets))
88*46ef7f33SGerd Hoffmann
8995ca557dSGerd Hoffmannipxe/src/config/local/%: config.ipxe.%
9095ca557dSGerd Hoffmann	cp $< $@
9168875817SGerd Hoffmann
9268875817SGerd Hoffmann
9368875817SGerd Hoffmannclean:
9468875817SGerd Hoffmann	rm -rf seabios/.config seabios/out
9568875817SGerd Hoffmann	$(MAKE) $(MAKEFLAGS) -C vgabios clean
9668875817SGerd Hoffmann	rm -f vgabios/VGABIOS-lgpl-latest*
9768875817SGerd Hoffmann	$(MAKE) $(MAKEFLAGS) -C ipxe/src veryclean
98