xref: /openbmc/qemu/roms/Makefile (revision 60c85ec8)
1b1c0d031SGerd Hoffmann
275056cefSGerd Hoffmannvgabios_variants := stdvga cirrus vmware qxl isavga virtio bochs-display ramfb
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
37bcf06c15SGerd Hoffmannpowerpc64_cross_prefix := $(call find-cross-prefix,powerpc64)
384e73c781SAlexander Grafpowerpc_cross_prefix := $(call find-cross-prefix,powerpc)
39779fa9d7SGerd Hoffmannx86_64_cross_prefix := $(call find-cross-prefix,x86_64)
40bcf06c15SGerd Hoffmann
417edf2f0eSGerd Hoffmann# tag our seabios builds
42af51dbedSGerd HoffmannSEABIOS_EXTRAVERSION="-prebuilt.qemu.org"
437edf2f0eSGerd Hoffmann
44bcf06c15SGerd Hoffmann#
452f3f430dSGerd Hoffmann# EfiRom utility is shipped with edk2 / tianocore, in BaseTools/
462f3f430dSGerd Hoffmann#
472f3f430dSGerd Hoffmann# We need that to combine multiple images (legacy bios,
482f3f430dSGerd Hoffmann# efi ia32, efi x64) into a single rom binary.
492f3f430dSGerd Hoffmann#
50d912e795SPhilippe Mathieu-DaudéEDK2_EFIROM = edk2/BaseTools/Source/C/bin/EfiRom
51b4566776SGerd Hoffmann
52b1c0d031SGerd Hoffmanndefault:
53b1c0d031SGerd Hoffmann	@echo "nothing is build by default"
54b1c0d031SGerd Hoffmann	@echo "available build targets:"
55b1c0d031SGerd Hoffmann	@echo "  bios           -- update bios.bin (seabios)"
5691b8eba9SGerd Hoffmann	@echo "  vgabios        -- update vgabios binaries (seabios)"
57774e80eaSGerd Hoffmann	@echo "  sgabios        -- update sgabios binaries"
582397edd7SGerd Hoffmann	@echo "  pxerom         -- update nic roms (bios only)"
59f590a812SLaszlo Ersek	@echo "  efirom         -- update nic roms (bios+efi)"
60bcf06c15SGerd Hoffmann	@echo "  slof           -- update slof.bin"
61bcad45deSCédric Le Goater	@echo "  skiboot        -- update skiboot.lid"
624e73c781SAlexander Graf	@echo "  u-boot.e500    -- update u-boot.e500"
63b41a162cSBALATON Zoltan	@echo "  u-boot.sam460  -- update u-boot.sam460"
64536d2173SLaszlo Ersek	@echo "  efi            -- update UEFI (edk2) platform firmware"
65*60c85ec8SPhilippe Mathieu-Daudé	@echo "  clean          -- delete the files generated by the previous" \
66*60c85ec8SPhilippe Mathieu-Daudé	                          "build targets"
67b1c0d031SGerd Hoffmann
6894e68caaSGerd Hoffmannbios: build-seabios-config-seabios-128k build-seabios-config-seabios-256k
6994e68caaSGerd Hoffmann	cp seabios/builds/seabios-128k/bios.bin ../pc-bios/bios.bin
7094e68caaSGerd Hoffmann	cp seabios/builds/seabios-256k/bios.bin ../pc-bios/bios-256k.bin
71b4566776SGerd Hoffmann
7291b8eba9SGerd Hoffmannvgabios seavgabios: $(patsubst %,seavgabios-%,$(vgabios_variants))
73b4566776SGerd Hoffmann
7495f7c680SGerd Hoffmannseavgabios-isavga: build-seabios-config-vga-isavga
7595f7c680SGerd Hoffmann	cp seabios/builds/vga-isavga/vgabios.bin ../pc-bios/vgabios.bin
7695f7c680SGerd Hoffmann
7795f7c680SGerd Hoffmannseavgabios-%: build-seabios-config-vga-%
7895f7c680SGerd Hoffmann	cp seabios/builds/vga-$*/vgabios.bin ../pc-bios/vgabios-$*.bin
7995f7c680SGerd Hoffmann
8095f7c680SGerd Hoffmannbuild-seabios-config-%: config.%
8195f7c680SGerd Hoffmann	mkdir -p seabios/builds/$*
8295f7c680SGerd Hoffmann	cp $< seabios/builds/$*/.config
8350df8d5dSBruce Rogers	$(MAKE) -C seabios \
84437b8d8cSGerd Hoffmann		EXTRAVERSION=$(SEABIOS_EXTRAVERSION) \
8578ac44afSRoman Bolshakov		CROSS_PREFIX=$(x86_64_cross_prefix) \
8695f7c680SGerd Hoffmann		KCONFIG_CONFIG=$(CURDIR)/seabios/builds/$*/.config \
8795f7c680SGerd Hoffmann		OUT=$(CURDIR)/seabios/builds/$*/ oldnoconfig
8850df8d5dSBruce Rogers	$(MAKE) -C seabios \
89437b8d8cSGerd Hoffmann		EXTRAVERSION=$(SEABIOS_EXTRAVERSION) \
9078ac44afSRoman Bolshakov		CROSS_PREFIX=$(x86_64_cross_prefix) \
9195f7c680SGerd Hoffmann		KCONFIG_CONFIG=$(CURDIR)/seabios/builds/$*/.config \
9295f7c680SGerd Hoffmann		OUT=$(CURDIR)/seabios/builds/$*/ all
93b4566776SGerd Hoffmann
941ede4dd0SGerd Hoffmann
95bcad45deSCédric Le Goater.PHONY: sgabios skiboot
96774e80eaSGerd Hoffmannsgabios:
9750df8d5dSBruce Rogers	$(MAKE) -C sgabios
98774e80eaSGerd Hoffmann	cp sgabios/sgabios.bin ../pc-bios
99774e80eaSGerd Hoffmann
100774e80eaSGerd Hoffmann
1012397edd7SGerd Hoffmannpxerom: $(patsubst %,pxe-rom-%,$(pxerom_variants))
1022397edd7SGerd Hoffmann
10346ef7f33SGerd Hoffmannpxe-rom-%: build-pxe-roms
1042397edd7SGerd Hoffmann	cp ipxe/src/bin/$(VID)$(DID).rom ../pc-bios/pxe-$*.rom
1052f3f430dSGerd Hoffmann
1062f3f430dSGerd Hoffmannefirom: $(patsubst %,efi-rom-%,$(pxerom_variants))
1072f3f430dSGerd Hoffmann
108ee5ef780SLaszlo Ersekefi-rom-%: build-pxe-roms build-efi-roms edk2-basetools
109d912e795SPhilippe Mathieu-Daudé	$(EDK2_EFIROM) -f "0x$(VID)" -i "0x$(DID)" -l 0x02 \
1102f3f430dSGerd Hoffmann		-b ipxe/src/bin/$(VID)$(DID).rom \
1112f3f430dSGerd Hoffmann		-ec ipxe/src/bin-i386-efi/$(VID)$(DID).efidrv \
1122f3f430dSGerd Hoffmann		-ec ipxe/src/bin-x86_64-efi/$(VID)$(DID).efidrv \
1132f3f430dSGerd Hoffmann		-o ../pc-bios/efi-$*.rom
11495ca557dSGerd Hoffmann
115cf2b4b5bSGerd Hoffmannbuild-pxe-roms:
116cf2b4b5bSGerd Hoffmann	$(MAKE) -C ipxe/src CONFIG=qemu \
117779fa9d7SGerd Hoffmann		CROSS_COMPILE=$(x86_64_cross_prefix) \
11846ef7f33SGerd Hoffmann		$(patsubst %,bin/%.rom,$(pxerom_targets))
11946ef7f33SGerd Hoffmann
120cf2b4b5bSGerd Hoffmannbuild-efi-roms: build-pxe-roms
121cf2b4b5bSGerd Hoffmann	$(MAKE) -C ipxe/src CONFIG=qemu \
122779fa9d7SGerd Hoffmann		CROSS_COMPILE=$(x86_64_cross_prefix) \
12346ef7f33SGerd Hoffmann		$(patsubst %,bin-i386-efi/%.efidrv,$(pxerom_targets)) \
12446ef7f33SGerd Hoffmann		$(patsubst %,bin-x86_64-efi/%.efidrv,$(pxerom_targets))
12546ef7f33SGerd Hoffmann
126652141e4SPhilippe Mathieu-Daudé# Build scripts can pass compiler/linker flags to the EDK2
127652141e4SPhilippe Mathieu-Daudé# build tools via the EDK2_BASETOOLS_OPTFLAGS (CFLAGS) and
1281cab4641SPhilippe Mathieu-Daudé# EDK2_BASETOOLS_LDFLAGS (LDFLAGS) environment variables.
1291cab4641SPhilippe Mathieu-Daudé#
1301cab4641SPhilippe Mathieu-Daudé# Example:
1311cab4641SPhilippe Mathieu-Daudé#
1321cab4641SPhilippe Mathieu-Daudé#  make -C roms \
1331cab4641SPhilippe Mathieu-Daudé#    EDK2_BASETOOLS_OPTFLAGS='...' \
1341cab4641SPhilippe Mathieu-Daudé#    EDK2_BASETOOLS_LDFLAGS='...' \
1351cab4641SPhilippe Mathieu-Daudé#    efirom
1361cab4641SPhilippe Mathieu-Daudé#
137ee5ef780SLaszlo Ersekedk2-basetools:
1381cab4641SPhilippe Mathieu-Daudé	$(MAKE) -C edk2/BaseTools \
1391cab4641SPhilippe Mathieu-Daudé		EXTRA_OPTFLAGS='$(EDK2_BASETOOLS_OPTFLAGS)' \
1401cab4641SPhilippe Mathieu-Daudé		EXTRA_LDFLAGS='$(EDK2_BASETOOLS_LDFLAGS)'
14168875817SGerd Hoffmann
142bcf06c15SGerd Hoffmannslof:
14350df8d5dSBruce Rogers	$(MAKE) -C SLOF CROSS=$(powerpc64_cross_prefix) qemu
144bcf06c15SGerd Hoffmann	cp SLOF/boot_rom.bin ../pc-bios/slof.bin
145bcf06c15SGerd Hoffmann
1464e73c781SAlexander Grafu-boot.e500:
1474e73c781SAlexander Graf	$(MAKE) -C u-boot O=build.e500 qemu-ppce500_config
1484e73c781SAlexander Graf	$(MAKE) -C u-boot CROSS_COMPILE=$(powerpc_cross_prefix) \
1494e73c781SAlexander Graf		O=build.e500
1504e73c781SAlexander Graf	$(powerpc_cross_prefix)strip u-boot/build.e500/u-boot -o \
1514e73c781SAlexander Graf		../pc-bios/u-boot.e500
152bcf06c15SGerd Hoffmann
153b41a162cSBALATON Zoltanu-boot.sam460:
154b41a162cSBALATON Zoltan	$(MAKE) -C u-boot-sam460ex Sam460ex_config
155b41a162cSBALATON Zoltan	$(MAKE) -C u-boot-sam460ex CROSS_COMPILE=$(powerpc_cross_prefix)
156b41a162cSBALATON Zoltan	cp u-boot-sam460ex/u-boot.bin ../pc-bios/u-boot-sam460-20100605.bin
157b41a162cSBALATON Zoltan
158bcad45deSCédric Le Goaterskiboot:
159bcad45deSCédric Le Goater	$(MAKE) -C skiboot CROSS=$(powerpc64_cross_prefix)
160bcad45deSCédric Le Goater	cp skiboot/skiboot.lid ../pc-bios/skiboot.lid
161bcad45deSCédric Le Goater
162536d2173SLaszlo Ersekefi: edk2-basetools
163536d2173SLaszlo Ersek	$(MAKE) -f Makefile.edk2
164536d2173SLaszlo Ersek
16568875817SGerd Hoffmannclean:
16695f7c680SGerd Hoffmann	rm -rf seabios/.config seabios/out seabios/builds
16750df8d5dSBruce Rogers	$(MAKE) -C sgabios clean
168774e80eaSGerd Hoffmann	rm -f sgabios/.depend
16950df8d5dSBruce Rogers	$(MAKE) -C ipxe/src veryclean
170f590a812SLaszlo Ersek	$(MAKE) -C edk2/BaseTools clean
17150df8d5dSBruce Rogers	$(MAKE) -C SLOF clean
1724e73c781SAlexander Graf	rm -rf u-boot/build.e500
173b41a162cSBALATON Zoltan	$(MAKE) -C u-boot-sam460ex distclean
174bcad45deSCédric Le Goater	$(MAKE) -C skiboot clean
175536d2173SLaszlo Ersek	$(MAKE) -f Makefile.edk2 clean
176