1 # Makefile for GeekOS kernel, userspace, and tools
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 # Based on GeekOS Makefile:
10 # Copyright (c) 2004,2005 David H. Hovemeyer <daveho@cs.umd.edu>
14 # This is free software. You are permitted to use,
15 # redistribute, and modify it as specified in the file "COPYING".
17 # Required software to build GeekOS:
18 # - GNU Make (http://www.gnu.org/software/make)
19 # - gcc 2.95.2 generating code for target (i386/ELF) and host platforms
20 # - nasm (http://nasm.sourceforge.net)
21 # - Perl5, AWK (any version), egrep
23 # Cygwin (http://cygwin.com) may be used to build GeekOS.
24 # Make sure that gcc, binutils, nasm, and perl are installed.
27 # - This makefile has been written carefully to work correctly
28 # with the -j (parallel make) option. I regularly use "make -j 2"
29 # to speed the build process on 2 processor systems.
34 # ----------------------------------------------------------------------
36 # Various options specifying how GeekOS should be built,
37 # what source files to build, which user programs to build,
38 # etc. This is generally the only section of the makefile
39 # that will need to be modified.
40 # ----------------------------------------------------------------------
42 PALACIOS_BUILD_DIR := $(PROJECT_ROOT)/palacios/build
43 GEEKOS_BUILD_DIR := $(PROJECT_ROOT)/geekos/build
44 GUEST_ISO_DIR := /opt/vmm-tools/isos
46 # List of targets to build by default.
47 # These targets encompass everything needed to boot
49 ALL_TARGETS := geekos-full
51 QEMU := /usr/local/qemu/bin/qemu-system-x86_64
55 #when -DNDEBUG is set the kassert functions are disabled
58 # DEBUG=1 means VMM_DEBUG, VMM_INFO, and VMM_TRACE are enabled
59 # as are SERIAL_PRINT_DEBUG
61 DEBUG_SECTIONS := DEBUG=1
64 DEBUG_SECTIONS:= $(DEBUG_SECTIONS) DEBUG_ALL=1
67 ifeq ($(DEBUG_SHADOW_PAGING),1)
68 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_SHADOW_PAGING=1
70 ifeq ($(DEBUG_SHADOW_PAGING),0)
71 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_SHADOW_PAGING=0
75 ifeq ($(DEBUG_CTRL_REGS),1)
76 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_CTRL_REGS=1
78 ifeq ($(DEBUG_CTRL_REGS),0)
79 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_CTRL_REGS=0
83 ifeq ($(DEBUG_INTERRUPTS),1)
84 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_INTERRUPTS=1
86 ifeq ($(DEBUG_INTERRUPTS),0)
87 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_INTERRUPTS=0
92 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_IO=1
95 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_IO=0
99 ifeq ($(DEBUG_KEYBOARD),1)
100 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_KEYBOARD=1
102 ifeq ($(DEBUG_KEYBOARD),0)
103 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_KEYBOARD=0
107 ifeq ($(DEBUG_PIC),1)
108 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_PIC=1
110 ifeq ($(DEBUG_PIC),0)
111 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_PIC=0
115 ifeq ($(DEBUG_PIT),1)
116 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_PIT=1
118 ifeq ($(DEBUG_PIT),0)
119 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_PIT=0
123 ifeq ($(DEBUG_NVRAM),1)
124 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_NVRAM=1
126 ifeq ($(DEBUG_NVRAM),0)
127 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_NVRAM=0
131 ifeq ($(DEBUG_GENERIC),1)
132 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_GENERIC=1
134 ifeq ($(DEBUG_GENERIC),0)
135 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_GENERIC=0
139 ifeq ($(DEBUG_EMULATOR),1)
140 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_EMULATOR=1
142 ifeq ($(DEBUG_EMULATOR),0)
143 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_EMULATOR=0
147 ifeq ($(DEBUG_RAMDISK),1)
148 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_RAMDISK=1
150 ifeq ($(DEBUG_RAMDISK),0)
151 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_RAMDISK=0
155 ifeq ($(DEBUG_XED),1)
156 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_XED=1
158 ifeq ($(DEBUG_XED),0)
159 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_XED=0
163 ifeq ($(DEBUG_HALT),1)
164 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_HALT=1
166 ifeq ($(DEBUG_HALT),0)
167 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_HALT=0
171 ifeq ($(DEBUG_DEV_MGR),1)
172 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_DEV_MGR=1
174 ifeq ($(DEBUG_DEV_MGR),0)
175 DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_DEV_MGR=0
180 # ----------------------------------------------------------------------
182 # Specifies files to be built
183 # ----------------------------------------------------------------------
185 # Default target - see definition of ALL_TARGETS in Configuration section
190 (cd $(PALACIOS_BUILD_DIR) && make ARCH=64 $(DEBUG_SECTIONS))
193 (cd $(PALACIOS_BUILD_DIR) && make $(DEBUG_SECTIONS))
197 (cd $(PALACIOS_BUILD_DIR) && make $(DEBUG_SECTIONS) world)
200 (cd $(PALACIOS_BUILD_DIR) && make ARCH=64 $(DEBUG_SECTIONS) world)
203 (cd $(PALACIOS_BUILD_DIR) && make LEAN_AND_MEAN=1 world)
208 cp $(PALACIOS_BUILD_DIR)/libv3vee.a $(GEEKOS_BUILD_DIR)/palacios/
209 cp $(PALACIOS_BUILD_DIR)/../lib/xed/libxed.a $(GEEKOS_BUILD_DIR)/palacios/
210 cp $(PALACIOS_BUILD_DIR)/vm_kernel $(GEEKOS_BUILD_DIR)/palacios/
211 (cd $(GEEKOS_BUILD_DIR) && make)
214 geekos-full: palacios-full32
215 cp $(PALACIOS_BUILD_DIR)/libv3vee.a $(GEEKOS_BUILD_DIR)/palacios/
216 cp $(PALACIOS_BUILD_DIR)/../lib/xed/libxed.a $(GEEKOS_BUILD_DIR)/palacios/
217 cp $(PALACIOS_BUILD_DIR)/vm_kernel $(GEEKOS_BUILD_DIR)/palacios/
218 (cd $(GEEKOS_BUILD_DIR) && make clean && make)
221 world: geekos-full palacios-full64
223 lean-and-mean: palacios-lean geekos-full
227 # make ready to boot over PXE
229 cp $(GEEKOS_BUILD_DIR)/vmm.img /tftpboot/vmm.img
232 $(QEMU) -m 1024 -serial file:serial.out -cdrom $(GUEST_ISO_DIR)/puppy.iso -fda $(GEEKOS_BUILD_DIR)/vmm.img
235 cp $(GEEKOS_BUILD_DIR)/vmm.img iso/vmm.img
236 mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o test.iso iso
245 # Clean build directories of generated files
247 for d in $(GEEKOS_BUILD_DIR) $(PALACIOS_BUILD_DIR); do \
248 (cd $$d && make clean); \