1 # Top level Makefile for V3Vee
3 # Northwestern University
4 # (c) 2008, Jack Lange <jarusl@cs.northwestern.edu>
5 # (c) 2008, Peter Dinda <pdinda@northwestern.edu>
6 # (c) 2008, Lei Xia <xiaxlei@gmail.com>
7 # (c) 2008, The V3VEE Project <http://www.v3vee.org>
9 # Required software to build V3Vee:
10 # - GNU Make (http://www.gnu.org/software/make)
11 # - nasm (http://nasm.sourceforge.net)
12 # - Perl5, AWK (any version), egrep
21 PALACIOS_BUILD_DIR := $(PROJECT_ROOT)/palacios/build
22 GEEKOS_BUILD_DIR := $(PROJECT_ROOT)/geekos/build
23 GUEST_ISO_DIR := /opt/vmm-tools/isos
25 # List of targets to build by default.
26 # These targets encompass everything needed to boot
28 ALL_TARGETS := geekos-full
30 QEMU := /usr/local/qemu/bin/qemu-system-x86_64
34 #when -DNDEBUG is set the kassert functions are disabled
37 # DEBUG=1 means VMM_DEBUG, VMM_INFO, and VMM_TRACE are enabled
38 # as are SERIAL_PRINT_DEBUG
40 DEBUG_SECTIONS := DEBUG=1
43 DEBUG_SECTIONS:= $(DEBUG_SECTIONS) DEBUG_ALL=1
46 ifeq ($(DEBUG_SHADOW_PAGING),1)
47 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_SHADOW_PAGING=1
49 ifeq ($(DEBUG_SHADOW_PAGING),0)
50 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_SHADOW_PAGING=0
54 ifeq ($(DEBUG_NESTED_PAGING),1)
55 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_NESTED_PAGING=1
57 ifeq ($(DEBUG_NESTED_PAGING),0)
58 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_NESTED_PAGING=0
62 ifeq ($(DEBUG_CTRL_REGS),1)
63 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_CTRL_REGS=1
65 ifeq ($(DEBUG_CTRL_REGS),0)
66 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_CTRL_REGS=0
70 ifeq ($(DEBUG_INTERRUPTS),1)
71 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_INTERRUPTS=1
73 ifeq ($(DEBUG_INTERRUPTS),0)
74 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_INTERRUPTS=0
79 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_IO=1
82 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_IO=0
86 ifeq ($(DEBUG_KEYBOARD),1)
87 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_KEYBOARD=1
89 ifeq ($(DEBUG_KEYBOARD),0)
90 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_KEYBOARD=0
95 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_PIC=1
98 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_PIC=0
102 ifeq ($(DEBUG_PIT),1)
103 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_PIT=1
105 ifeq ($(DEBUG_PIT),0)
106 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_PIT=0
110 ifeq ($(DEBUG_NVRAM),1)
111 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_NVRAM=1
113 ifeq ($(DEBUG_NVRAM),0)
114 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_NVRAM=0
118 ifeq ($(DEBUG_GENERIC),1)
119 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_GENERIC=1
121 ifeq ($(DEBUG_GENERIC),0)
122 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_GENERIC=0
126 ifeq ($(DEBUG_EMULATOR),1)
127 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_EMULATOR=1
129 ifeq ($(DEBUG_EMULATOR),0)
130 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_EMULATOR=0
134 ifeq ($(DEBUG_RAMDISK),1)
135 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_RAMDISK=1
137 ifeq ($(DEBUG_RAMDISK),0)
138 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_RAMDISK=0
142 ifeq ($(DEBUG_XED),1)
143 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_XED=1
145 ifeq ($(DEBUG_XED),0)
146 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_XED=0
150 ifeq ($(DEBUG_HALT),1)
151 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_HALT=1
153 ifeq ($(DEBUG_HALT),0)
154 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_HALT=0
158 ifeq ($(DEBUG_DEV_MGR),1)
159 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_DEV_MGR=1
161 ifeq ($(DEBUG_DEV_MGR),0)
162 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_DEV_MGR=0
166 ifeq ($(DEBUG_APIC),1)
167 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_APIC=1
169 ifeq ($(DEBUG_APIC),0)
170 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_APIC=0
174 ifeq ($(DEBUG_PCI),1)
175 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_PCI=1
177 ifeq ($(DEBUG_PCI),0)
178 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_PCI=0
183 ifeq ($(PROFILE_VMM),1)
184 GEEKOS_FLAGS:= $(GEEKOS_FLAGS) PROFILE_VMM=1
187 ifeq ($(INSTRUMENT_VMM),1)
188 GEEKOS_FLAGS:= $(GEEKOS_FLAGS) INSTRUMENT_VMM=1
193 # ----------------------------------------------------------------------
195 # Specifies files to be built
196 # ----------------------------------------------------------------------
198 # Default target - see definition of ALL_TARGETS in Configuration section
203 (cd $(PALACIOS_BUILD_DIR) && make ARCH=64 $(DEBUG_SECTIONS))
206 (cd $(PALACIOS_BUILD_DIR) && make $(DEBUG_SECTIONS))
210 (cd $(PALACIOS_BUILD_DIR) && make $(DEBUG_SECTIONS) world)
213 (cd $(PALACIOS_BUILD_DIR) && make ARCH=64 $(DEBUG_SECTIONS) world)
216 (cd $(PALACIOS_BUILD_DIR) && make V=1 ARCH=64 CRAY_XT=1 $(DEBUG_SECTIONS) world)
219 (cd $(PALACIOS_BUILD_DIR) && make LEAN_AND_MEAN=1 world)
224 cp $(PALACIOS_BUILD_DIR)/libv3vee.a $(GEEKOS_BUILD_DIR)/palacios/
225 cp $(PALACIOS_BUILD_DIR)/../lib/xed/libxed.a $(GEEKOS_BUILD_DIR)/palacios/
226 cp $(PALACIOS_BUILD_DIR)/vm_kernel $(GEEKOS_BUILD_DIR)/palacios/
227 (cd $(GEEKOS_BUILD_DIR) && make $(GEEKOS_FLAGS))
230 geekos-full: palacios-full32
231 cp $(PALACIOS_BUILD_DIR)/libv3vee.a $(GEEKOS_BUILD_DIR)/palacios/
232 cp $(PALACIOS_BUILD_DIR)/../lib/xed/libxed.a $(GEEKOS_BUILD_DIR)/palacios/
233 cp $(PALACIOS_BUILD_DIR)/vm_kernel $(GEEKOS_BUILD_DIR)/palacios/
234 (cd $(GEEKOS_BUILD_DIR) && make clean && make $(GEEKOS_FLAGS))
237 world: geekos-full palacios-full64
239 lean-and-mean: palacios-lean geekos-full
243 # make ready to boot over PXE
245 cp $(GEEKOS_BUILD_DIR)/vmm.img /tftpboot/vmm.img
248 $(QEMU) -m 1024 -serial file:serial.out -cdrom $(GUEST_ISO_DIR)/puppy.iso -fda $(GEEKOS_BUILD_DIR)/vmm.img
251 cp $(GEEKOS_BUILD_DIR)/vmm.img iso/vmm.img
252 mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o test.iso iso
261 # Clean build directories of generated files
263 for d in $(GEEKOS_BUILD_DIR) $(PALACIOS_BUILD_DIR); do \
264 (cd $$d && make clean); \