1 --------------------------------------------------------------------------
2 -- Copyright (c) 2007-2010, 2012, 2013, 2015 ETH Zurich.
3 -- Copyright (c) 2014, HP Labs.
4 -- All rights reserved.
6 -- This file is distributed under the terms in the attached LICENSE file.
7 -- If you do not find this file, copies can be found by writing to:
8 -- ETH Zurich D-INFK, CAB F.78, Universitaetstr. 6, CH-8092 Zurich,
9 -- Attn: Systems Group.
11 -- Configuration options for Hake
13 --------------------------------------------------------------------------
21 import System.FilePath
24 -- Toolchain definitions. By default, these rely on $PATH
26 findTool path prefix tool = path </> (prefix ++ tool)
30 arm_gnu_prefix = "arm-linux-gnueabi-"
31 arm_gnu_tool = findTool arm_gnu_path arm_gnu_prefix
33 arm_cc = arm_gnu_tool "gcc"
34 arm_objcopy = arm_gnu_tool "objcopy"
35 arm_objdump = arm_gnu_tool "objdump"
36 arm_ar = arm_gnu_tool "ar"
37 arm_ranlib = arm_gnu_tool "ranlib"
38 arm_cxx = arm_gnu_tool "g++"
40 -- ARM thumb (e.g. -M profile) toolchain
41 thumb_gnu_path = "/opt/gcc-arm-none-eabi-4_6-2012q4/bin"
42 thumb_gnu_prefix = "arm-none-eabi-"
43 thumb_gnu_tool = findTool thumb_gnu_path thumb_gnu_prefix
45 thumb_cc = thumb_gnu_tool "gcc"
46 thumb_objcopy = thumb_gnu_tool "objcopy"
47 thumb_objdump = thumb_gnu_tool "objdump"
48 thumb_ar = thumb_gnu_tool "ar"
49 thumb_ranlib = thumb_gnu_tool "ranlib"
50 thumb_cxx = thumb_gnu_tool "g++"
52 -- X86 (32/64) toolchain
55 x86_gnu_tool = findTool x86_gnu_path x86_gnu_prefix
57 x86_cc = x86_gnu_tool "gcc"
58 x86_cxx = x86_gnu_tool "g++"
62 k1om_gnu_prefix = "k1om-mpss-linux-"
63 k1om_gnu_tool = findTool k1om_gnu_path k1om_gnu_prefix
65 k1om_cc = k1om_gnu_tool "gcc"
66 k1om_objcopy = k1om_gnu_tool "objcopy"
67 k1om_objdump = k1om_gnu_tool "objdump"
68 k1om_ar = k1om_gnu_tool "ar"
69 k1om_ranlib = k1om_gnu_tool "ranlib"
70 k1om_cxx = k1om_gnu_tool "g++"
73 runghc = "runghc" -- run GHC interactively
74 circo = "circo" -- from graphviz
78 -- path to source and install directories; these are automatically set by hake.sh at setup time
80 -- source_dir = undefined -- (set by hake.sh, see end of file)
83 -- install_dir = undefined -- (set by hake.sh, see end of file)
85 -- Set of architectures for which to generate rules
86 architectures :: [String]
87 -- architectures = undefined -- (set by hake.sh, see end of file)
89 -- Optimisation flags (-Ox -g etc.) passed to compiler
91 cOptFlags = ["-g", "-O2"]
93 -- Selects which libc to compile with, "oldc" or "newlib"
98 newlib_malloc :: String
99 --newlib_malloc = "sbrk" -- use sbrk and newlib's malloc()
100 --newlib_malloc = "dlmalloc" -- use dlmalloc
101 newlib_malloc = "oldmalloc"
103 -- Configure pagesize for libbarrelfish's morecore implementation
104 -- x86_64 accepts "small", "large", and "huge" for 4kB, 2MB and 1GB pages
105 -- respectively. x86_32 accepts "small" and "large" for 4kB and 2MB/4MB pages
106 -- respectively. All other architectures default to their default page size.
107 morecore_pagesize :: String
108 morecore_pagesize = "small"
110 -- Use a frame pointer
114 -- Default timeslice duration in milliseconds
118 -- Put kernel into microbenchmarks mode
119 microbenchmarks :: Bool
120 microbenchmarks = False
126 -- Enable QEMU networking. (ie. make network work in small memory)
127 support_qemu_networking :: Bool
128 support_qemu_networking = False
130 -- armv7 platform to build for
131 -- Currently available: gem5, pandaboard
132 armv7_platform :: String
133 --armv7_platform = "gem5"
134 armv7_platform = "pandaboard"
136 -- on pandaboard, build a heterogenous image and let the cortex-A9 set up and start the
137 -- cortex-M3 processor (build targets "heteropanda_slave" and "heteropanda_master_image")
141 -- enable network tracing
142 trace_network_subsystem :: Bool
143 trace_network_subsystem = False
145 -- May want to disable LRPC to improve trace visuals
146 trace_disable_lrpc :: Bool
147 trace_disable_lrpc = False
150 use_kaluga_dvm :: Bool
151 use_kaluga_dvm = True
153 -- Domain and driver debugging
163 rtl8029_debug :: Bool
164 rtl8029_debug = False
169 libahci_debug :: Bool
170 libahci_debug = False
175 ethersrv_debug :: Bool
176 ethersrv_debug = False
181 libacpi_debug :: Bool
182 libacpi_debug = False
184 acpi_interface_debug :: Bool
185 acpi_interface_debug = False
187 lpc_timer_debug :: Bool
188 lpc_timer_debug = False
202 eclipse_kernel_debug :: Bool
203 eclipse_kernel_debug = False
208 skb_client_debug :: Bool
209 skb_client_debug = False
211 flounder_debug :: Bool
212 flounder_debug = False
214 flounder_failed_debug :: Bool
215 flounder_failed_debug = False
217 webserver_debug :: Bool
218 webserver_debug = False
220 sqlclient_debug :: Bool
221 sqlclient_debug = False
226 sqlite_backend_debug :: Bool
227 sqlite_backend_debug = False
235 loopback_debug :: Bool
236 loopback_debug = False
238 octopus_debug :: Bool
239 octopus_debug = False
247 -- Deadlock debugging
248 debug_deadlocks :: Bool
249 debug_deadlocks = False
251 -- Partitioned memory server
252 memserv_percore :: Bool
253 memserv_percore = False
255 -- Lazy THC implementation (requires use_fp = True)
257 lazy_thc | elem "armv7" architectures = False
258 | elem "armv5" architectures = False
259 | elem "xscale" architectures = False
262 -- Enable capability tracing debug facility
266 -- Mapping Database configuration options (this affects lib/mdb/)
267 -- enable extensive tracing of mapping db implementation
271 -- enable tracing of top level mdb_insert, mdb_remove calls
272 mdb_trace_no_recursive :: Bool
273 mdb_trace_no_recursive = False
275 -- fail on invariant violations
276 mdb_fail_invariants :: Bool
277 mdb_fail_invariants = True
279 -- check invariants before/after mdb_insert/mdb_remove.
280 mdb_check_invariants :: Bool
281 mdb_check_invariants = False
283 -- recheck invariants at each tracing point
284 mdb_recheck_invariants :: Bool
285 mdb_recheck_invariants = False
287 -- enable extensive tracing of mapping db implementation (userspace version)
288 mdb_trace_user :: Bool
289 mdb_trace_user = False
291 -- fail on invariant violations
292 mdb_fail_invariants_user :: Bool
293 mdb_fail_invariants_user = True
295 -- recheck invariants at each tracing point
296 mdb_recheck_invariants_user :: Bool
297 mdb_recheck_invariants_user = True
299 -- check invariants before/after mdb_insert/mdb_remove.
300 mdb_check_invariants_user :: Bool
301 mdb_check_invariants_user = True
304 data Scheduler = RBED | RR deriving (Show,Eq)
305 scheduler :: Scheduler
308 -- Physical Address Extensions (PAE)-enabled paging on x86-32
312 -- Page Size Extensions (PSE)-enabled paging on x86-32
313 -- Always enabled when pae_paging == True, regardless of value
317 -- No Execute Extensions (NXE)-enabled paging on x86-32
318 -- May not be True when pae_paging == False
322 oneshot_timer :: Bool
323 oneshot_timer = False
325 -- Enable hardware VM support for AMD's Secure Virtual Machine (SVM)
326 -- If disabled, Intel's VMX hardware is supported instead
330 -- Enable the use of only Arrakis domains (with arrakismon)
331 -- If disabled, use normal VM-guests (with vmkitmon)
332 config_arrakismon :: Bool
333 config_arrakismon = True
335 defines :: [RuleToken]
336 defines = [ Str ("-D" ++ d) | d <- [
337 if microbenchmarks then "CONFIG_MICROBENCHMARKS" else "",
338 if trace then "CONFIG_TRACE" else "",
339 if support_qemu_networking then "CONFIG_QEMU_NETWORK" else "",
340 if trace_network_subsystem then "NETWORK_STACK_TRACE" else "",
341 if trace_disable_lrpc then "TRACE_DISABLE_LRPC" else "",
342 if global_debug then "GLOBAL_DEBUG" else "",
343 if e1000n_debug then "E1000N_SERVICE_DEBUG" else "",
344 if ahcid_debug then "AHCI_SERVICE_DEBUG" else "",
345 if libahci_debug then "AHCI_LIB_DEBUG" else "",
346 if vfs_debug then "VFS_DEBUG" else "",
347 if eMAC_debug then "EMAC_SERVICE_DEBUG" else "",
348 if rtl8029_debug then "RTL8029_SERVICE_DEBUG" else "",
349 if ethersrv_debug then "ETHERSRV_SERVICE_DEBUG" else "",
350 if netd_debug then "NETD_SERVICE_DEBUG" else "",
351 if libacpi_debug then "ACPI_DEBUG_OUTPUT" else "",
352 if acpi_interface_debug then "ACPI_BF_DEBUG" else "",
353 if lpc_timer_debug then "LPC_TIMER_DEBUG" else "",
354 if lwip_debug then "LWIP_BARRELFISH_DEBUG" else "",
355 if libpci_debug then "PCI_CLIENT_DEBUG" else "",
356 if usrpci_debug then "PCI_SERVICE_DEBUG" else "",
357 if timer_debug then "TIMER_CLIENT_DEBUG" else "",
358 if eclipse_kernel_debug then "ECLIPSE_KERNEL_DEBUG" else "",
359 if skb_debug then "SKB_SERVICE_DEBUG" else "",
360 if skb_client_debug then "SKB_CLIENT_DEBUG" else "",
361 if flounder_debug then "FLOUNDER_DEBUG" else "",
362 if flounder_failed_debug then "FLOUNDER_FAILED_DEBUG" else "",
363 if webserver_debug then "WEBSERVER_DEBUG" else "",
364 if sqlclient_debug then "SQL_CLIENT_DEBUG" else "",
365 if sqlite_debug then "SQL_SERVICE_DEBUG" else "",
366 if sqlite_backend_debug then "SQL_BACKEND_DEBUG" else "",
367 if nfs_debug then "NFS_CLIENT_DEBUG" else "",
368 if rpc_debug then "RPC_DEBUG" else "",
369 if loopback_debug then "LOOPBACK_DEBUG" else "",
370 if octopus_debug then "DIST_SERVICE_DEBUG" else "",
371 if term_debug then "TERMINAL_LIBRARY_DEBUG" else "",
372 if serial_debug then "SERIAL_DRIVER_DEBUG" else "",
373 if debug_deadlocks then "CONFIG_DEBUG_DEADLOCKS" else "",
374 if memserv_percore then "CONFIG_MEMSERV_PERCORE" else "",
375 if lazy_thc then "CONFIG_LAZY_THC" else "",
376 if pae_paging then "CONFIG_PAE" else "",
377 if pse_paging then "CONFIG_PSE" else "",
378 if nxe_paging then "CONFIG_NXE" else "",
379 if libc == "oldc" then "CONFIG_OLDC" else "CONFIG_NEWLIB",
380 if oneshot_timer then "CONFIG_ONESHOT_TIMER" else "",
381 if config_svm then "CONFIG_SVM" else "",
382 if config_arrakismon then "CONFIG_ARRAKISMON" else "",
383 if use_kaluga_dvm then "USE_KALUGA_DVM" else "",
384 if heteropanda then "HETEROPANDA" else "",
385 if caps_trace then "TRACE_PMEM_CAPS" else ""
388 -- Sets the include path for the libc
390 libcInc = if libc == "oldc" then "/include/oldc"
391 else "/lib/newlib/newlib/libc/include"
393 -- Sets the include path for lwIP
395 lwipInc = "/lib/lwip/src/include"
397 lwipxxxInc = "/lib/lwip/src/include/ipv4"
399 -- some defines depend on the architecture/compile options
400 arch_defines :: Options -> [RuleToken]
402 -- enable config flags for interconnect drivers in use for this arch
404 | d <- ["CONFIG_INTERCONNECT_DRIVER_" ++ (map toUpper n)
405 | n <- optInterconnectDrivers opts]
407 -- enable config flags for flounder backends in use for this arch
409 | d <- ["CONFIG_FLOUNDER_BACKEND_" ++ (map toUpper n)
410 | n <- optFlounderBackends opts]
413 -- newlib common compile flags (maybe put these in a config.h file?)
414 newlibAddCFlags :: [String]
415 newlibAddCFlags = [ "-DPACKAGE_NAME=\"newlib\"" ,
416 "-DPACKAGE_TARNAME=\"newlib\"",
417 "-DPACKAGE_VERSION=\"1.19.0\"",
418 "-DPACKAGE_BUGREPORT=\"\"",
419 "-DPACKAGE_URL=\"\"",
420 "-D_I386MACH_ALLOW_HW_INTERRUPTS",
421 "-DMISSING_SYSCALL_NAMES",
422 "-D_WANT_IO_C99_FORMATS",
423 "-D_COMPILING_NEWLIB",
424 "-D_WANT_IO_LONG_LONG",
425 "-D_WANT_IO_LONG_DOUBLE",