1XEN_ROOT = $(CURDIR)/../.. 2include $(XEN_ROOT)/tools/Rules.mk 3 4# hvmloader is a 32-bit protected mode binary. 5TARGET := hvmloader/hvmloader 6INST_DIR := $(DESTDIR)$(XENFIRMWAREDIR) 7DEBG_DIR := $(DESTDIR)$(DEBUG_DIR)$(XENFIRMWAREDIR) 8 9SUBDIRS-y := 10SUBDIRS-$(CONFIG_OVMF) += ovmf-dir 11SUBDIRS-$(CONFIG_SEABIOS) += seabios-dir 12SUBDIRS-$(CONFIG_ROMBIOS) += rombios 13SUBDIRS-$(CONFIG_ROMBIOS) += vgabios 14SUBDIRS-$(CONFIG_IPXE) += etherboot 15SUBDIRS-$(CONFIG_PV_SHIM) += xen-dir 16SUBDIRS-y += hvmloader 17 18SEABIOSCC ?= $(CC) 19SEABIOSLD ?= $(LD) 20SEABIOS_EXTRAVERSION ?= "-Xen" 21 22ovmf-dir: 23 GIT=$(GIT) $(XEN_ROOT)/scripts/git-checkout.sh $(OVMF_UPSTREAM_URL) $(OVMF_UPSTREAM_REVISION) ovmf-dir 24 cp ovmf-makefile ovmf-dir/Makefile; 25 26seabios-dir: 27 GIT=$(GIT) $(XEN_ROOT)/scripts/git-checkout.sh $(SEABIOS_UPSTREAM_URL) $(SEABIOS_UPSTREAM_REVISION) seabios-dir 28 cp seabios-config seabios-dir/.config; 29 $(MAKE) -C seabios-dir olddefconfig CC=$(SEABIOSCC) LD=$(SEABIOSLD) 30 rm -f seabios-dir/.version 31 echo '$(SEABIOS_UPSTREAM_REVISION)' > seabios-dir/.version 32 33.PHONY: all 34all: $(SUBDIRS-y) 35ifeq ($(CONFIG_ROMBIOS),y) 36 @set -e; if [ $$((`( bcc -v 2>&1 | grep version || echo 0.0.0 ) | cut -d' ' -f 3 | awk -F. '{ printf "0x%02x%02x%02x", $$1, $$2, $$3}'`)) -lt $$((0x00100e)) ] ; then \ 37 echo "==========================================================================="; \ 38 echo "Require dev86 rpm or bin86 & bcc debs version >= 0.16.14 to build firmware!"; \ 39 echo "(visit http://www.debath.co.uk/dev86/ for more information)"; \ 40 echo "==========================================================================="; \ 41 false ; \ 42 fi 43endif 44 $(MAKE) CC=$(CC) PYTHON=$(PYTHON) subdirs-$@ 45 46.PHONY: install 47install: all 48 [ -d $(INST_DIR) ] || $(INSTALL_DIR) $(INST_DIR) 49 [ -d $(DEBG_DIR) ] || $(INSTALL_DIR) $(DEBG_DIR) 50 [ ! -e $(TARGET) ] || $(INSTALL_DATA) $(TARGET) $(INST_DIR) 51ifeq ($(CONFIG_SEABIOS),y) 52 $(INSTALL_DATA) seabios-dir/out/bios.bin $(INST_DIR)/seabios.bin 53endif 54ifeq ($(CONFIG_OVMF),y) 55 $(INSTALL_DATA) ovmf-dir/ovmf.bin $(INST_DIR)/ovmf.bin 56endif 57ifeq ($(CONFIG_IPXE),y) 58 $(INSTALL_DATA) etherboot/ipxe/src/bin/ipxe.bin $(INST_DIR)/ipxe.bin 59endif 60ifeq ($(CONFIG_PV_SHIM),y) 61 $(INSTALL_DATA) xen-dir/xen-shim $(INST_DIR)/xen-shim 62 $(INSTALL_DATA) xen-dir/xen-shim-syms $(DEBG_DIR)/xen-shim-syms 63endif 64 65.PHONY: uninstall 66uninstall: 67 rm -f $(addprefix $(INST_DIR)/, $(notdir $(TARGET))) 68ifeq ($(CONFIG_SEABIOS),y) 69 rm -f $(INST_DIR)/seabios.bin 70endif 71ifeq ($(CONFIG_OVMF),y) 72 rm -f $(INST_DIR)/ovmf.bin 73endif 74ifeq ($(CONFIG_IPXE),y) 75 rm -r $(INST_DIR)/ipxe.bin 76endif 77ifeq ($(CONFIG_PV_SHIM),y) 78 rm -f $(INST_DIR)/xen-shim 79 rm -f $(DEBG_DIR)/xen-shim-syms 80endif 81 82.PHONY: clean 83clean: subdirs-clean 84 85.PHONY: distclean 86distclean: subdirs-distclean 87 88subdir-distclean-etherboot: .phony 89 $(MAKE) -C etherboot distclean 90 91subdir-distclean-ovmf-dir: .phony 92 rm -rf ovmf-dir ovmf-dir-remote 93 94subdir-distclean-seabios-dir: .phony 95 rm -rf seabios-dir seabios-dir-remote 96 97.PHONY: ovmf-dir-force-update 98ovmf-dir-force-update: ovmf-dir 99 set -ex; \ 100 if [ "$(OVMF_UPSTREAM_REVISION)" ]; then \ 101 cd ovmf-dir-remote; \ 102 $(GIT) fetch origin; \ 103 $(GIT) reset --hard $(OVMF_UPSTREAM_REVISION); \ 104 fi 105 106subdir-clean-ovmf-dir: 107 set -e; if test -d ovmf-dir/.; then \ 108 $(MAKE) -C ovmf-dir clean; \ 109 fi 110 111.PHONY: seabios-dir-force-update 112seabios-dir-force-update: seabios-dir 113 set -ex; \ 114 if [ "$(SEABIOS_UPSTREAM_REVISION)" ]; then \ 115 cd seabios-dir-remote; \ 116 $(GIT) fetch origin; \ 117 $(GIT) reset --hard $(SEABIOS_UPSTREAM_REVISION); \ 118 fi 119 120subdir-clean-seabios-dir: 121 set -e; if test -d seabios-dir/.; then \ 122 $(MAKE) -C seabios-dir CC=$(SEABIOSCC) LD=$(SEABIOSLD) clean; \ 123 fi 124 125subtree-force-update: 126ifeq ($(CONFIG_SEABIOS),y) 127 $(MAKE) seabios-dir-force-update 128endif 129ifeq ($(CONFIG_OVMF),y) 130 $(MAKE) ovmf-dir-force-update 131endif 132 133subtree-force-update-all: 134 $(MAKE) seabios-dir-force-update 135 $(MAKE) ovmf-dir-force-update 136 137subdir-all-seabios-dir: seabios-dir 138 $(MAKE) -C $< CC=$(SEABIOSCC) LD=$(SEABIOSLD) PYTHON=$(PYTHON) EXTRAVERSION=$(SEABIOS_EXTRAVERSION) all; 139