Makefile 5.2 KB
Newer Older
1

2
vgabios_variants := stdvga cirrus vmware qxl isavga virtio
3
vgabios_targets  := $(subst -isavga,,$(patsubst %,vgabios-%.bin,$(vgabios_variants)))
4
pxerom_variants  := e1000 eepro100 ne2k_pci pcnet rtl8139 virtio
G
Gerd Hoffmann 已提交
5
pxerom_targets   := 8086100e 80861209 10500940 10222000 10ec8139 1af41000
6

7 8 9 10 11 12 13 14 15 16 17 18 19
pxe-rom-e1000    efi-rom-e1000    : VID := 8086
pxe-rom-e1000    efi-rom-e1000    : DID := 100e
pxe-rom-eepro100 efi-rom-eepro100 : VID := 8086
pxe-rom-eepro100 efi-rom-eepro100 : DID := 1209
pxe-rom-ne2k_pci efi-rom-ne2k_pci : VID := 1050
pxe-rom-ne2k_pci efi-rom-ne2k_pci : DID := 0940
pxe-rom-pcnet    efi-rom-pcnet    : VID := 1022
pxe-rom-pcnet    efi-rom-pcnet    : DID := 2000
pxe-rom-rtl8139  efi-rom-rtl8139  : VID := 10ec
pxe-rom-rtl8139  efi-rom-rtl8139  : DID := 8139
pxe-rom-virtio   efi-rom-virtio   : VID := 1af4
pxe-rom-virtio   efi-rom-virtio   : DID := 1000

G
Gerd Hoffmann 已提交
20 21 22 23 24 25 26 27 28 29 30 31 32 33
#
# cross compiler auto detection
#
path := $(subst :, ,$(PATH))
system := $(shell uname -s | tr "A-Z" "a-z")

# first find cross binutils in path
find-cross-ld = $(firstword $(wildcard $(patsubst %,%/$(1)-*$(system)*-ld,$(path))))
# then check we have cross gcc too
find-cross-gcc = $(firstword $(wildcard $(patsubst %ld,%gcc,$(call find-cross-ld,$(1)))))
# finally strip off path + toolname so we get the prefix
find-cross-prefix = $(subst gcc,,$(notdir $(call find-cross-gcc,$(1))))

powerpc64_cross_prefix := $(call find-cross-prefix,powerpc64)
34
powerpc_cross_prefix := $(call find-cross-prefix,powerpc)
G
Gerd Hoffmann 已提交
35
x86_64_cross_prefix := $(call find-cross-prefix,x86_64)
G
Gerd Hoffmann 已提交
36

37 38 39 40 41 42 43 44 45 46
#
# EfiRom utility is shipped with edk2 / tianocore, in BaseTools/
#
# We need that to combine multiple images (legacy bios,
# efi ia32, efi x64) into a single rom binary.
#
# We try to find it in the path.  You can also pass the location on
# the command line, i.e. "make EFIROM=/path/to/EfiRom efirom"
#
EFIROM ?= $(shell which EfiRom 2>/dev/null)
47

48 49 50 51
default:
	@echo "nothing is build by default"
	@echo "available build targets:"
	@echo "  bios           -- update bios.bin (seabios)"
52 53
	@echo "  seavgabios     -- update vgabios binaries (seabios)"
	@echo "  lgplvgabios    -- update vgabios binaries (lgpl)"
54
	@echo "  sgabios        -- update sgabios binaries"
55
	@echo "  pxerom         -- update nic roms (bios only)"
56 57
	@echo "  efirom         -- update nic roms (bios+efi, this needs"
	@echo "                    the EfiRom utility from edk2 / tianocore)"
G
Gerd Hoffmann 已提交
58
	@echo "  slof           -- update slof.bin"
59
	@echo "  u-boot.e500    -- update u-boot.e500"
60

G
Gerd Hoffmann 已提交
61 62 63 64
bios: build-seabios-config-seabios-128k build-seabios-config-seabios-256k
	cp seabios/builds/seabios-128k/bios.bin ../pc-bios/bios.bin
	cp seabios/builds/seabios-256k/bios.bin ../pc-bios/bios-256k.bin
	cp seabios/builds/seabios-256k/src/fw/*dsdt.aml ../pc-bios/
65 66 67

seavgabios: $(patsubst %,seavgabios-%,$(vgabios_variants))

68 69 70 71 72 73 74 75 76
seavgabios-isavga: build-seabios-config-vga-isavga
	cp seabios/builds/vga-isavga/vgabios.bin ../pc-bios/vgabios.bin

seavgabios-%: build-seabios-config-vga-%
	cp seabios/builds/vga-$*/vgabios.bin ../pc-bios/vgabios-$*.bin

build-seabios-config-%: config.%
	mkdir -p seabios/builds/$*
	cp $< seabios/builds/$*/.config
77
	$(MAKE) -C seabios \
G
Gerd Hoffmann 已提交
78
		CROSS_COMPILE=$(x86_64_cross_prefix) \
79 80
		KCONFIG_CONFIG=$(CURDIR)/seabios/builds/$*/.config \
		OUT=$(CURDIR)/seabios/builds/$*/ oldnoconfig
81
	$(MAKE) -C seabios \
G
Gerd Hoffmann 已提交
82
		CROSS_COMPILE=$(x86_64_cross_prefix) \
83 84
		KCONFIG_CONFIG=$(CURDIR)/seabios/builds/$*/.config \
		OUT=$(CURDIR)/seabios/builds/$*/ all
85

86

87 88
lgplvgabios: $(patsubst %,lgplvgabios-%,$(vgabios_variants))

89 90
lgplvgabios-isavga: build-lgplvgabios
	cp vgabios/VGABIOS-lgpl-latest.bin ../pc-bios/vgabios.bin
91
lgplvgabios-%: build-lgplvgabios
92
	cp vgabios/VGABIOS-lgpl-latest.$*.bin ../pc-bios/vgabios-$*.bin
93

94
build-lgplvgabios:
95
	$(MAKE) -C vgabios $(vgabios_targets)
96 97


98 99
.PHONY: sgabios
sgabios:
100
	$(MAKE) -C sgabios
101 102 103
	cp sgabios/sgabios.bin ../pc-bios


104 105
pxerom: $(patsubst %,pxe-rom-%,$(pxerom_variants))

G
Gerd Hoffmann 已提交
106
pxe-rom-%: build-pxe-roms
107
	cp ipxe/src/bin/$(VID)$(DID).rom ../pc-bios/pxe-$*.rom
108 109 110

efirom: $(patsubst %,efi-rom-%,$(pxerom_variants))

G
Gerd Hoffmann 已提交
111
efi-rom-%: build-pxe-roms build-efi-roms
112 113 114 115 116
	$(EFIROM) -f "0x$(VID)" -i "0x$(DID)" -l 0x02 \
		-b ipxe/src/bin/$(VID)$(DID).rom \
		-ec ipxe/src/bin-i386-efi/$(VID)$(DID).efidrv \
		-ec ipxe/src/bin-x86_64-efi/$(VID)$(DID).efidrv \
		-o ../pc-bios/efi-$*.rom
G
Gerd Hoffmann 已提交
117

G
Gerd Hoffmann 已提交
118
build-pxe-roms: ipxe/src/config/local/general.h
119
	$(MAKE) -C ipxe/src GITVERSION="" \
G
Gerd Hoffmann 已提交
120
		CROSS_COMPILE=$(x86_64_cross_prefix) \
G
Gerd Hoffmann 已提交
121 122 123
		$(patsubst %,bin/%.rom,$(pxerom_targets))

build-efi-roms: build-pxe-roms ipxe/src/config/local/general.h
124
	$(MAKE) -C ipxe/src GITVERSION="" \
G
Gerd Hoffmann 已提交
125
		CROSS_COMPILE=$(x86_64_cross_prefix) \
G
Gerd Hoffmann 已提交
126 127 128
		$(patsubst %,bin-i386-efi/%.efidrv,$(pxerom_targets)) \
		$(patsubst %,bin-x86_64-efi/%.efidrv,$(pxerom_targets))

G
Gerd Hoffmann 已提交
129 130
ipxe/src/config/local/%: config.ipxe.%
	cp $< $@
G
Gerd Hoffmann 已提交
131 132


G
Gerd Hoffmann 已提交
133
slof:
134
	$(MAKE) -C SLOF CROSS=$(powerpc64_cross_prefix) qemu
G
Gerd Hoffmann 已提交
135 136
	cp SLOF/boot_rom.bin ../pc-bios/slof.bin

137 138 139 140 141 142
u-boot.e500:
	$(MAKE) -C u-boot O=build.e500 qemu-ppce500_config
	$(MAKE) -C u-boot CROSS_COMPILE=$(powerpc_cross_prefix) \
		O=build.e500
	$(powerpc_cross_prefix)strip u-boot/build.e500/u-boot -o \
		../pc-bios/u-boot.e500
G
Gerd Hoffmann 已提交
143

G
Gerd Hoffmann 已提交
144
clean:
145
	rm -rf seabios/.config seabios/out seabios/builds
146
	$(MAKE) -C vgabios clean
G
Gerd Hoffmann 已提交
147
	rm -f vgabios/VGABIOS-lgpl-latest*
148
	$(MAKE) -C sgabios clean
149
	rm -f sgabios/.depend
150 151
	$(MAKE) -C ipxe/src veryclean
	$(MAKE) -C SLOF clean
152
	rm -rf u-boot/build.e500