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