aboutsummaryrefslogtreecommitdiffstats
path: root/tools/firmware/hvmloader/Makefile
blob: 41a4369ff066f874cced7b489f00e0e8fcd6122b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#
# Makefile
#
# Leendert van Doorn, leendert@watson.ibm.com
# Copyright (c) 2005, International Business Machines Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place - Suite 330, Boston, MA 02111-1307 USA.
#

XEN_ROOT = $(CURDIR)/../../..
include $(XEN_ROOT)/tools/firmware/Rules.mk

SUBDIRS := acpi

# The HVM loader is started in 32-bit mode at the address below:
LOADADDR = 0x100000

CFLAGS += $(CFLAGS_xeninclude)

OBJS  = hvmloader.o mp_tables.o util.o smbios.o 
OBJS += 32bitbios_support.o smp.o cacheattr.o xenbus.o
OBJS += e820.o pci.o pir.o ctype.o
ifeq ($(debug),y)
OBJS += tests.o
endif

CIRRUSVGA_DEBUG ?= n

ROMBIOS_DIR := ../rombios
ifneq ($(ROMBIOS_DIR),)
OBJS += rombios.o
CFLAGS += -DENABLE_ROMBIOS
ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest
endif

SEABIOS_DIR := ../seabios-dir
ifneq ($(SEABIOS_DIR),)
OBJS += seabios.o
CFLAGS += -DENABLE_SEABIOS
SEABIOS_ROM := $(SEABIOS_DIR)/out/bios.bin
endif

STDVGA_ROM    := ../vgabios/VGABIOS-lgpl-latest.bin
ifeq ($(CIRRUSVGA_DEBUG),y)
CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.debug.bin
else
CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.bin
endif

.PHONY: all
all: subdirs-all
	$(MAKE) hvmloader

rombios.o seabios.o hvmloader.o: roms.inc
smbios.o: CFLAGS += -D__SMBIOS_DATE__="\"$(shell date +%m/%d/%Y)\""

hvmloader: $(OBJS) acpi/acpi.a
	$(LD) $(LDFLAGS_DIRECT) -N -Ttext $(LOADADDR) -o hvmloader.tmp $^
	$(OBJCOPY) hvmloader.tmp hvmloader
	rm -f hvmloader.tmp

roms.inc: $(ROMBIOS_ROM) $(SEABIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM) ../etherboot/eb-roms.h
	echo "/* Autogenerated file. DO NOT EDIT */" > $@.new

ifneq ($(ROMBIOS_ROM),)
	echo "#ifdef ROM_INCLUDE_ROMBIOS" >> $@.new
	sh ./mkhex rombios $(ROMBIOS_ROM) >> $@.new
	echo "#endif" >> $@.new
endif

ifneq ($(SEABIOS_ROM),)
	echo "#ifdef ROM_INCLUDE_SEABIOS" >> $@.new
	sh ./mkhex seabios $(SEABIOS_ROM) >> $@.new
	echo "#endif" >> $@.new
endif

ifneq ($(STDVGA_ROM),)
	echo "#ifdef ROM_INCLUDE_VGABIOS" >> $@.new
	sh ./mkhex vgabios_stdvga $(STDVGA_ROM) >> $@.new
	echo "#endif" >> $@.new
endif
ifneq ($(CIRRUSVGA_ROM),)
	echo "#ifdef ROM_INCLUDE_VGABIOS" >> $@.new
	sh ./mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> $@.new
	echo "#endif" >> $@.new
endif

	echo "#ifdef ROM_INCLUDE_ETHERBOOT" >> $@.new
	cat ../etherboot/eb-roms.h >> $@.new
	echo "#endif" >> $@.new

	mv $@.new $@

.PHONY: clean
clean: subdirs-clean
	rm -f roms.inc roms.inc.new acpi.h
	rm -f hvmloader hvmloader.tmp *.o $(DEPS)

-include $(DEPS)