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 546ef7f33SGerd 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# 21bcf06c15SGerd Hoffmann# cross compiler auto detection 22bcf06c15SGerd Hoffmann# 23bcf06c15SGerd Hoffmannpath := $(subst :, ,$(PATH)) 24bcf06c15SGerd Hoffmannsystem := $(shell uname -s | tr "A-Z" "a-z") 25bcf06c15SGerd Hoffmann 26bcf06c15SGerd Hoffmann# first find cross binutils in path 27bcf06c15SGerd Hoffmannfind-cross-ld = $(firstword $(wildcard $(patsubst %,%/$(1)-*$(system)*-ld,$(path)))) 28bcf06c15SGerd Hoffmann# then check we have cross gcc too 29bcf06c15SGerd Hoffmannfind-cross-gcc = $(firstword $(wildcard $(patsubst %ld,%gcc,$(call find-cross-ld,$(1))))) 30bcf06c15SGerd Hoffmann# finally strip off path + toolname so we get the prefix 31bcf06c15SGerd Hoffmannfind-cross-prefix = $(subst gcc,,$(notdir $(call find-cross-gcc,$(1)))) 32bcf06c15SGerd Hoffmann 33bcf06c15SGerd Hoffmannpowerpc64_cross_prefix := $(call find-cross-prefix,powerpc64) 34779fa9d7SGerd Hoffmannx86_64_cross_prefix := $(call find-cross-prefix,x86_64) 35bcf06c15SGerd Hoffmann 36bcf06c15SGerd Hoffmann# 372f3f430dSGerd Hoffmann# EfiRom utility is shipped with edk2 / tianocore, in BaseTools/ 382f3f430dSGerd Hoffmann# 392f3f430dSGerd Hoffmann# We need that to combine multiple images (legacy bios, 402f3f430dSGerd Hoffmann# efi ia32, efi x64) into a single rom binary. 412f3f430dSGerd Hoffmann# 422f3f430dSGerd Hoffmann# We try to find it in the path. You can also pass the location on 432f3f430dSGerd Hoffmann# the command line, i.e. "make EFIROM=/path/to/EfiRom efirom" 442f3f430dSGerd Hoffmann# 452f3f430dSGerd HoffmannEFIROM ?= $(shell which EfiRom 2>/dev/null) 46b4566776SGerd Hoffmann 47b1c0d031SGerd Hoffmanndefault: 48b1c0d031SGerd Hoffmann @echo "nothing is build by default" 49b1c0d031SGerd Hoffmann @echo "available build targets:" 50b1c0d031SGerd Hoffmann @echo " bios -- update bios.bin (seabios)" 51b4566776SGerd Hoffmann @echo " seavgabios -- update vgabios binaries (seabios)" 52b4566776SGerd Hoffmann @echo " lgplvgabios -- update vgabios binaries (lgpl)" 53774e80eaSGerd Hoffmann @echo " sgabios -- update sgabios binaries" 542397edd7SGerd Hoffmann @echo " pxerom -- update nic roms (bios only)" 552f3f430dSGerd Hoffmann @echo " efirom -- update nic roms (bios+efi, this needs" 562f3f430dSGerd Hoffmann @echo " the EfiRom utility from edk2 / tianocore)" 57bcf06c15SGerd Hoffmann @echo " slof -- update slof.bin" 58b1c0d031SGerd Hoffmann 59*94e68caaSGerd Hoffmannbios: build-seabios-config-seabios-128k build-seabios-config-seabios-256k 60*94e68caaSGerd Hoffmann cp seabios/builds/seabios-128k/bios.bin ../pc-bios/bios.bin 61*94e68caaSGerd Hoffmann cp seabios/builds/seabios-256k/bios.bin ../pc-bios/bios-256k.bin 62*94e68caaSGerd Hoffmann cp seabios/builds/seabios-256k/src/fw/*dsdt.aml ../pc-bios/ 63b4566776SGerd Hoffmann 64b4566776SGerd Hoffmannseavgabios: $(patsubst %,seavgabios-%,$(vgabios_variants)) 65b4566776SGerd Hoffmann 6695f7c680SGerd Hoffmannseavgabios-isavga: build-seabios-config-vga-isavga 6795f7c680SGerd Hoffmann cp seabios/builds/vga-isavga/vgabios.bin ../pc-bios/vgabios.bin 6895f7c680SGerd Hoffmann 6995f7c680SGerd Hoffmannseavgabios-%: build-seabios-config-vga-% 7095f7c680SGerd Hoffmann cp seabios/builds/vga-$*/vgabios.bin ../pc-bios/vgabios-$*.bin 7195f7c680SGerd Hoffmann 7295f7c680SGerd Hoffmannbuild-seabios-config-%: config.% 7395f7c680SGerd Hoffmann mkdir -p seabios/builds/$* 7495f7c680SGerd Hoffmann cp $< seabios/builds/$*/.config 7595f7c680SGerd Hoffmann $(MAKE) $(MAKEFLAGS) -C seabios \ 7695f7c680SGerd Hoffmann KCONFIG_CONFIG=$(CURDIR)/seabios/builds/$*/.config \ 7795f7c680SGerd Hoffmann OUT=$(CURDIR)/seabios/builds/$*/ oldnoconfig 7895f7c680SGerd Hoffmann $(MAKE) $(MAKEFLAGS) -C seabios \ 7995f7c680SGerd Hoffmann KCONFIG_CONFIG=$(CURDIR)/seabios/builds/$*/.config \ 8095f7c680SGerd Hoffmann OUT=$(CURDIR)/seabios/builds/$*/ all 81b4566776SGerd Hoffmann 821ede4dd0SGerd Hoffmann 83b4566776SGerd Hoffmannlgplvgabios: $(patsubst %,lgplvgabios-%,$(vgabios_variants)) 84b4566776SGerd Hoffmann 855a7bd333SGerd Hoffmannlgplvgabios-isavga: build-lgplvgabios 865a7bd333SGerd Hoffmann cp vgabios/VGABIOS-lgpl-latest.bin ../pc-bios/vgabios.bin 871ede4dd0SGerd Hoffmannlgplvgabios-%: build-lgplvgabios 88b4566776SGerd Hoffmann cp vgabios/VGABIOS-lgpl-latest.$*.bin ../pc-bios/vgabios-$*.bin 892397edd7SGerd Hoffmann 901ede4dd0SGerd Hoffmannbuild-lgplvgabios: 911ede4dd0SGerd Hoffmann $(MAKE) $(MAKEFLAGS) -C vgabios $(vgabios_targets) 921ede4dd0SGerd Hoffmann 931ede4dd0SGerd Hoffmann 94774e80eaSGerd Hoffmann.PHONY: sgabios 95774e80eaSGerd Hoffmannsgabios: 96774e80eaSGerd Hoffmann $(MAKE) $(MAKEFLAGS) -C sgabios 97774e80eaSGerd Hoffmann cp sgabios/sgabios.bin ../pc-bios 98774e80eaSGerd Hoffmann 99774e80eaSGerd Hoffmann 1002397edd7SGerd Hoffmannpxerom: $(patsubst %,pxe-rom-%,$(pxerom_variants)) 1012397edd7SGerd Hoffmann 10246ef7f33SGerd Hoffmannpxe-rom-%: build-pxe-roms 1032397edd7SGerd Hoffmann cp ipxe/src/bin/$(VID)$(DID).rom ../pc-bios/pxe-$*.rom 1042f3f430dSGerd Hoffmann 1052f3f430dSGerd Hoffmannefirom: $(patsubst %,efi-rom-%,$(pxerom_variants)) 1062f3f430dSGerd Hoffmann 10746ef7f33SGerd Hoffmannefi-rom-%: build-pxe-roms build-efi-roms 1082f3f430dSGerd Hoffmann $(EFIROM) -f "0x$(VID)" -i "0x$(DID)" -l 0x02 \ 1092f3f430dSGerd Hoffmann -b ipxe/src/bin/$(VID)$(DID).rom \ 1102f3f430dSGerd Hoffmann -ec ipxe/src/bin-i386-efi/$(VID)$(DID).efidrv \ 1112f3f430dSGerd Hoffmann -ec ipxe/src/bin-x86_64-efi/$(VID)$(DID).efidrv \ 1122f3f430dSGerd Hoffmann -o ../pc-bios/efi-$*.rom 11395ca557dSGerd Hoffmann 11446ef7f33SGerd Hoffmannbuild-pxe-roms: ipxe/src/config/local/general.h 11546ef7f33SGerd Hoffmann $(MAKE) $(MAKEFLAGS) -C ipxe/src GITVERSION="" \ 116779fa9d7SGerd Hoffmann CROSS_COMPILE=$(x86_64_cross_prefix) \ 11746ef7f33SGerd Hoffmann $(patsubst %,bin/%.rom,$(pxerom_targets)) 11846ef7f33SGerd Hoffmann 11946ef7f33SGerd Hoffmannbuild-efi-roms: build-pxe-roms ipxe/src/config/local/general.h 12046ef7f33SGerd Hoffmann $(MAKE) $(MAKEFLAGS) -C ipxe/src GITVERSION="" \ 121779fa9d7SGerd Hoffmann CROSS_COMPILE=$(x86_64_cross_prefix) \ 12246ef7f33SGerd Hoffmann $(patsubst %,bin-i386-efi/%.efidrv,$(pxerom_targets)) \ 12346ef7f33SGerd Hoffmann $(patsubst %,bin-x86_64-efi/%.efidrv,$(pxerom_targets)) 12446ef7f33SGerd Hoffmann 12595ca557dSGerd Hoffmannipxe/src/config/local/%: config.ipxe.% 12695ca557dSGerd Hoffmann cp $< $@ 12768875817SGerd Hoffmann 12868875817SGerd Hoffmann 129bcf06c15SGerd Hoffmannslof: 130bcf06c15SGerd Hoffmann $(MAKE) $(MAKEFLAGS) -C SLOF CROSS=$(powerpc64_cross_prefix) qemu 131bcf06c15SGerd Hoffmann cp SLOF/boot_rom.bin ../pc-bios/slof.bin 132bcf06c15SGerd Hoffmann 133bcf06c15SGerd Hoffmann 13468875817SGerd Hoffmannclean: 13595f7c680SGerd Hoffmann rm -rf seabios/.config seabios/out seabios/builds 13668875817SGerd Hoffmann $(MAKE) $(MAKEFLAGS) -C vgabios clean 13768875817SGerd Hoffmann rm -f vgabios/VGABIOS-lgpl-latest* 138774e80eaSGerd Hoffmann $(MAKE) $(MAKEFLAGS) -C sgabios clean 139774e80eaSGerd Hoffmann rm -f sgabios/.depend 14068875817SGerd Hoffmann $(MAKE) $(MAKEFLAGS) -C ipxe/src veryclean 141bcf06c15SGerd Hoffmann $(MAKE) $(MAKEFLAGS) -C SLOF clean 142