Merge large page support code.
[barrelfish] / hake / symbolic_targets.mk
1 ##########################################################################
2 # Copyright (c) 2009-2014 ETH Zurich.
3 # All rights reserved.
4 #
5 # This file is distributed under the terms in the attached LICENSE file.
6 # If you do not find this file, copies can be found by writing to:
7 # ETH Zurich D-INFK, CAB F.78, Universitaetstr. 6, CH-8092 Zurich,
8 # Attn: Systems Group.
9 #
10 # This file defines symbolic (i.e. non-file) targets for the Makefile
11 # generated by Hake.  Edit this to add your own symbolic targets.
12 #
13 ##########################################################################
14
15 # Disable built-in implicit rules. GNU make adds environment's MAKEFLAGS too.
16 MAKEFLAGS=r
17
18 # Explicitly disable the flex and bison implicit rules
19 %.c : %.y
20
21 %.c : %.l
22
23 # Set default architecture to the first specified by Hake in generated Makefile.
24 ARCH ?= $(word 1, $(HAKE_ARCHS))
25 ARM_GCC?=arm-linux-gnueabi-gcc
26 ARM_OBJCOPY?=arm-linux-gnueabi-objcopy
27 K1OM_OBJCOPY?=k1om-mpss-linux-objcopy
28
29 # upload Xeon Phi images to nfs share (leave blank to cancel)
30 BARRELFISH_NFS_DIR ?="emmentaler.ethz.ch:/mnt/local/nfs/barrelfish/xeon_phi"
31
32 # All binaries of the RCCE LU benchmark
33 BIN_RCCE_LU= \
34         sbin/rcce_lu_A1 \
35         sbin/rcce_lu_A2 \
36         sbin/rcce_lu_A4 \
37         sbin/rcce_lu_A8 \
38         sbin/rcce_lu_A16 \
39         sbin/rcce_lu_A32 \
40         sbin/rcce_lu_A64
41
42 # All binaries of the RCCE BT benchmark
43 BIN_RCCE_BT= \
44         sbin/rcce_bt_A1 \
45         sbin/rcce_bt_A4 \
46         sbin/rcce_bt_A9  \
47         sbin/rcce_bt_A16 \
48         sbin/rcce_bt_A25 \
49         sbin/rcce_bt_A36
50
51 # All test domains
52 TESTS_COMMON= \
53         sbin/fputest \
54         sbin/fread_test \
55         sbin/fscanf_test \
56         sbin/hellotest \
57         sbin/idctest \
58         sbin/memtest \
59         sbin/schedtest \
60         sbin/testerror \
61         sbin/yield_test
62
63 TESTS_x86= \
64         sbin/tests/luatest \
65         sbin/tests/numatest
66
67 TESTS_x86_64= \
68         $(TESTS_x86) \
69         sbin/arrakis_hellotest \
70         sbin/ata_rw28_test \
71         sbin/bomp_cpu_bound \
72         sbin/bomp_cpu_bound_progress \
73         sbin/bomp_sync \
74         sbin/bomp_sync_progress \
75         sbin/bomp_test \
76         sbin/bulk_shm \
77         sbin/cryptotest \
78         sbin/mdbtest_addr_zero \
79         sbin/mdbtest_range_query \
80         sbin/mem_affinity \
81         sbin/multihoptest \
82         sbin/net-test \
83         sbin/net_openport_test \
84         sbin/perfmontest \
85         sbin/phoenix_kmeans \
86         sbin/socketpipetest \
87         sbin/spantest \
88         sbin/spin \
89         sbin/testconcurrent \
90         sbin/testdesc \
91         sbin/testdesc-child \
92         sbin/tests/cxxtest \
93         sbin/tests/dma_test \
94         sbin/tests/xphi_nameservice_test \
95         sbin/thcidctest \
96         sbin/thcminitest \
97         sbin/thctest \
98         sbin/timer_test \
99         sbin/tlstest \
100         sbin/tweedtest \
101         sbin/xcorecap \
102         sbin/xcorecapserv
103
104 TESTS_k1om= \
105         $(TESTS_x86) \
106         sbin/tests/dma_test \
107         sbin/tests/xeon_phi_inter \
108         sbin/tests/xeon_phi_test \
109         sbin/tests/xphi_nameservice_test
110
111
112 # All benchmark domains
113 BENCH_COMMON= \
114         sbin/channel_cost_bench \
115         sbin/flounder_stubs_buffer_bench \
116         sbin/flounder_stubs_empty_bench \
117         sbin/flounder_stubs_payload_bench \
118         sbin/xcorecapbench
119
120 BENCH_x86= \
121         sbin/multihop_latency_bench \
122         sbin/net_openport_test \
123         sbin/perfmontest \
124         sbin/thc_v_flounder_empty \
125         sbin/timer_test \
126         sbin/udp_throughput \
127         sbin/ump_exchange \
128         sbin/ump_latency \
129         sbin/ump_latency_cache \
130         sbin/ump_receive \
131         sbin/ump_send \
132         sbin/ump_throughput
133
134 BENCH_x86_64= \
135         $(BENCH_x86) \
136         $(BIN_RCCE_BT) \
137         $(BIN_RCCE_LU) \
138         sbin/ahci_bench \
139         sbin/apicdrift_bench \
140         sbin/benchmarks/bomp_mm \
141         sbin/benchmarks/dma_bench \
142         sbin/benchmarks/xomp_share \
143         sbin/benchmarks/xomp_spawn \
144         sbin/benchmarks/xomp_work \
145         sbin/benchmarks/xphi_ump_bench \
146         sbin/bomp_benchmark_cg \
147         sbin/bomp_benchmark_ft \
148         sbin/bomp_benchmark_is \
149         sbin/bulk_transfer_passthrough \
150         sbin/bulkbench \
151         sbin/bulkbench_micro_echo \
152         sbin/bulkbench_micro_rtt \
153         sbin/bulkbench_micro_throughput \
154         sbin/elb_app \
155         sbin/elb_app_tcp \
156         sbin/lrpc_bench \
157         sbin/mdb_bench \
158         sbin/mdb_bench_old \
159         sbin/netthroughput \
160         sbin/phases_bench \
161         sbin/phases_scale_bench \
162         sbin/placement_bench \
163         sbin/rcce_pingpong \
164         sbin/shared_mem_clock_bench \
165         sbin/tsc_bench
166
167 BENCH_k1om=\
168         $(BENCH_x86) \
169         sbin/benchmarks/bomp_mm \
170         sbin/benchmarks/dma_bench \
171         sbin/benchmarks/xomp_share \
172         sbin/benchmarks/xomp_spawn \
173         sbin/benchmarks/xomp_work \
174         sbin/benchmarks/xphi_ump_bench \
175         sbin/benchmarks/xphi_xump_bench
176
177
178 # Default list of modules to build/install for all enabled architectures
179 MODULES_COMMON= \
180         sbin/init \
181         sbin/chips \
182         sbin/skb \
183         sbin/spawnd \
184         sbin/startd \
185         sbin/mem_serv \
186         sbin/monitor \
187         sbin/ramfsd
188
189 # List of modules that are arch-independent and always built
190 MODULES_GENERIC= \
191         skb_ramfs.cpio.gz \
192         sshd_ramfs.cpio.gz
193
194 # x86_64-specific modules to build by default
195 # this should shrink as targets are ported and move into the generic list above
196 MODULES_x86_64= \
197         sbin/elver \
198         sbin/cpu \
199         sbin/arrakismon \
200         sbin/bench \
201         sbin/bfscope \
202         sbin/boot_perfmon \
203         sbin/datagatherer \
204         sbin/ahcid \
205         sbin/e1000n \
206         sbin/NGD_mng \
207         sbin/e10k \
208         sbin/sfxge \
209         sbin/e10k_queue \
210         sbin/rtl8029 \
211         sbin/netd \
212         sbin/echoserver \
213         sbin/fbdemo \
214         sbin/fish \
215         sbin/hpet \
216         sbin/lpc_kbd \
217         sbin/lpc_timer \
218         sbin/mem_serv_dist \
219         sbin/lo_queue \
220         sbin/pci \
221         sbin/acpi \
222         sbin/kaluga \
223         sbin/serial \
224         sbin/angler \
225         sbin/sshd \
226         sbin/lshw \
227         sbin/sif \
228         sbin/slideshow \
229         sbin/vbe \
230         sbin/vmkitmon \
231         sbin/vnode_map_test \
232         sbin/webserver \
233         sbin/routing_setup \
234         sbin/bcached \
235         sbin/xeon_phi_mgr \
236         sbin/xeon_phi \
237         sbin/dma_mgr \
238         sbin/ioat_dma \
239         sbin/virtio_blk_host \
240         sbin/virtio_blk \
241         sbin/block_server \
242         sbin/block_server_client \
243         sbin/bs_user \
244         sbin/bulk_shm \
245         sbin/corectrl
246
247 MODULES_k1om= \
248         sbin/weever \
249         sbin/cpu \
250         sbin/xeon_phi \
251         sbin/corectrl \
252         xeon_phi_multiboot \
253
254 # the following are broken in the newidc system
255 MODULES_x86_64_broken= \
256         sbin/barriers \
257         sbin/ipi_bench \
258         sbin/ring_barriers \
259         sbin/ssf_bcast \
260         sbin/lamport_bcast
261
262 # x86-32-specific module to build by default
263 MODULES_x86_32=\
264         sbin/cpu \
265         sbin/lpc_kbd \
266         sbin/serial \
267         $(BIN_RCCE_BT) \
268         $(BIN_RCCE_LU) \
269         sbin/rcce_pingpong \
270         sbin/bench \
271         sbin/fbdemo \
272         sbin/fish \
273         sbin/fputest \
274         sbin/pci \
275         sbin/acpi \
276         sbin/kaluga \
277         sbin/slideshow \
278         sbin/thc_v_flounder_empty \
279         sbin/thcidctest \
280         sbin/thcminitest \
281         sbin/thctest \
282         sbin/vbe \
283         sbin/mem_serv_dist \
284         sbin/routing_setup \
285         sbin/multihoptest \
286         sbin/multihop_latency_bench \
287         sbin/angler \
288         sbin/sshd \
289         sbin/corectrl
290
291 # SCC-specific module to build by default
292 MODULES_scc=\
293         sbin/cpu \
294         $(BIN_RCCE_BT) \
295         $(BIN_RCCE_LU) \
296         sbin/rcce_pingpong \
297         sbin/bench \
298         sbin/eMAC \
299         sbin/netd \
300         sbin/NGD_mng \
301         sbin/webserver \
302         sbin/ipirc_test \
303         sbin/thc_v_flounder_empty \
304         sbin/thcidctest \
305         sbin/thcminitest \
306         sbin/thctest \
307         sbin/mem_serv_dist \
308         sbin/net-test \
309         sbin/netthroughput \
310         sbin/udp_throughput
311
312 # ARM-specific modules to build by default
313 MODULES_armv5=\
314         sbin/cpu \
315         sbin/cpu.bin
316
317 # XScale-specific modules to build by default
318 MODULES_xscale=\
319         sbin/cpu_ixp2800 \
320         sbin/cpu_ixp2800.bin
321
322 # ARMv7-specific modules to build by default
323 # XXX: figure out armv7 default
324 MODULES_armv7=\
325         sbin/cpu_omap44xx \
326         sbin/usb_manager \
327         sbin/usb_keyboard \
328         sbin/kaluga \
329         sbin/fish \
330         sbin/corectrl
331
332 # ARM11MP-specific modules to build by default
333 MODULES_arm11mp=\
334         sbin/cpu \
335         sbin/cpu.bin
336
337 # construct list of all modules to be built (arch-specific and common for each arch)
338 MODULES=$(foreach a,$(HAKE_ARCHS),$(foreach m,$(MODULES_$(a)),$(a)/$(m)) \
339                                   $(foreach m,$(MODULES_COMMON),$(a)/$(m))) \
340                 $(foreach a,$(HAKE_ARCHS),$(foreach m,$(TESTS_$(a)),$(a)/$(m)) \
341                                           $(foreach m,$(TESTS_COMMON),$(a)/$(m))) \
342                 $(foreach a,$(HAKE_ARCHS),$(foreach m,$(BENCH_$(a)),$(a)/$(m)) \
343                                   $(foreach m,$(BENCH_COMMON),$(a)/$(m))) \
344         $(MODULES_GENERIC)
345
346 all: $(MODULES) menu.lst
347         @echo "You've just run the default ("all") target for Barrelfish"
348         @echo "using Hake.  The following modules have been built:"
349         @echo $(MODULES)
350         @echo "If you want to change this target, edit the file called"
351         @echo "'symbolic_targets.mk' in your build directory."
352 .PHONY: all
353
354 # XXX: this should be overridden in some local settings file?
355 INSTALL_PREFIX ?= /home/netos/tftpboot/$(USER)
356
357 # Only install a binary if it doesn't exist in INSTALL_PREFIX or the modification timestamp differs
358 install: $(MODULES)
359         @echo ""; \
360         echo "Installing modules..." ; \
361         for m in ${MODULES}; do \
362           if [ ! -f ${INSTALL_PREFIX}/$$m ] || \
363               [ $$(stat -c%Y $$m) -ne $$(stat -c%Y ${INSTALL_PREFIX}/$$m) ]; then \
364                if [ "$$m" != "k1om/xeon_phi_multiboot" ]; then \
365                  do_update=1; \
366                  echo "  > Installing $$m" ; \
367                  mkdir -p ${INSTALL_PREFIX}/$$(dirname $$m); \
368                  install -p $$m ${INSTALL_PREFIX}/$$m; \
369                fi; \
370           fi; \
371         done; \
372         if [ ! $$do_update ]; then \
373                 echo "  > All up to date" ; \
374         else \
375                 if [ -f "k1om/xeon_phi_multiboot" ] && [ $(BARRELFISH_NFS_DIR)  ]; then \
376                         echo ""; \
377                         echo "Uploading to NFS share $(BARRELFISH_NFS_DIR) ..." ; \
378                         scp k1om/xeon_phi_multiboot $(BARRELFISH_NFS_DIR); \
379                         scp     k1om/sbin/weever $(BARRELFISH_NFS_DIR); \
380                 fi; \
381         fi; \
382         echo ""; \
383         echo "done." ; \
384
385 .PHONY : install
386
387
388 install_headers:
389         echo "Installing header files..." ; \
390         for a in ${HAKE_ARCHS}; do \
391           mkdir -p "$$a" ; \
392           cp -rv "${SRCDIR}/include" "$$a/" ; \
393         done; \
394         echo "done." ; \
395
396 .PHONY : install_headers
397
398 sim: simulate
399 .PHONY : sim
400
401 QEMU=unknown-arch-error
402 GDB=unknown-arch-error
403 CLEAN_HD=
404
405 DISK=hd.img
406 AHCI=-device ahci,id=ahci -device ide-drive,drive=disk,bus=ahci.0 -drive id=disk,file=$(DISK),if=none
407
408 MENU_LST=-kernel $(shell sed -rne 's,^kernel[ \t]*/([^ ]*).*,\1,p' menu.lst) \
409         -append '$(shell sed -rne 's,^kernel[ \t]*[^ ]*[ \t]*(.*),\1,p' menu.lst)' \
410         -initrd '$(shell sed -rne 's,^module(nounzip)?[ \t]*/(.*),\2,p' menu.lst | awk '{ if(NR == 1) printf($$0); else printf("," $$0) } END { printf("\n") }')'
411
412 ifeq ($(ARCH),x86_64)
413     QEMU_CMD=qemu-system-x86_64 -smp 2 -m 1024 -net nic,model=e1000 -net user $(AHCI) -nographic $(MENU_LST)
414         GDB=x86_64-pc-linux-gdb
415         CLEAN_HD=qemu-img create $(DISK) 10M
416 else ifeq ($(ARCH),x86_32)
417         QEMU_CMD=qemu-system-i386 -no-kvm -smp 2 -m 1024 -net nic,model=ne2k_pci -net user -fda $(SRCDIR)/tools/grub-qemu.img -tftp $(PWD) -nographic
418         GDB=gdb
419 else ifeq ($(ARCH),scc)
420         QEMU_CMD=qemu-system-i386 -no-kvm -smp 2 -m 1024 -cpu pentium -net nic,model=ne2k_pci -net user -fda $(SRCDIR)/tools/grub-qemu.img -tftp $(PWD) -nographic
421         GDB=gdb
422 else ifeq ($(ARCH),armv5)
423         ARM_QEMU_CMD=qemu-system-arm -M integratorcp -kernel armv5/sbin/cpu.bin -nographic -no-reboot -m 256 -initrd armv5/romfs.cpio
424         GDB=xterm -e arm-linux-gnueabi-gdb
425 simulate: $(MODULES) armv5/romfs.cpio
426         $(ARM_QEMU_CMD)
427 .PHONY: simulate
428
429 armv5/tools/debug.arm.gdb: $(SRCDIR)/tools/debug.arm.gdb
430         cp $< $@
431
432 debugsim: $(MODULES) armv5/romfs.cpio armv5/tools/debug.arm.gdb
433         $(SRCDIR)/tools/debug.sh "$(ARM_QEMU_CMD) -initrd armv5/romfs.cpio" "$(GDB)" "-s $(ARCH)/sbin/cpu -x armv5/tools/debug.arm.gdb $(GDB_ARGS)"
434 .PHONY : debugsim
435 else ifeq ($(ARCH),arm11mp)
436         QEMU_CMD=qemu-system-arm -cpu mpcore -M realview -kernel arm11mp/sbin/cpu.bin
437         GDB=arm-linux-gnueabi-gdb
438 else ifeq ($(ARCH), k1om)
439         # what is the emulation option for the xeon phi ?
440         QEMU=unknown-arch-error
441         GDB=x86_64-k1om-barrelfish-gdb
442 endif
443
444
445 ifdef QEMU_CMD
446
447 simulate: $(MODULES)
448         $(CLEAN_HD)
449         $(QEMU_CMD)
450 .PHONY : simulate
451
452 debugsim: $(MODULES)
453         $(CLEAN_HD)
454         $(SRCDIR)/tools/debug.sh "$(QEMU_CMD)" "$(GDB)" "-x $(SRCDIR)/tools/debug.gdb $(GDB_ARGS)" "file:/dev/stdout"
455 .PHONY : debugsim
456
457 endif
458
459
460
461 $(ARCH)/menu.lst: $(SRCDIR)/hake/menu.lst.$(ARCH)
462         cp $< $@
463
464 $(ARCH)/romfs.cpio: $(SRCDIR)/tools/arm-mkbootcpio.sh $(MODULES) $(ARCH)/menu.lst
465         $(SRCDIR)/tools/arm-mkbootcpio.sh $(ARCH)/menu.lst $@
466
467 # Location of hardcoded size of romfs CPIO image
468 arm_romfs_cpio = "$(ARCH)/include/romfs_size.h"
469
470 # XXX: Horrid hack to hardcode size of romfs CPIO image into ARM kernel
471 # This works in several recursive make steps:
472 # 1. Create a dummy romfs_size.h header file
473 # 2. Compile everything
474 # 3. Create the romfs CPIO image
475 # 4. Determine its size and write to romfs_size.h
476 # 5. Re-compile kernel (but not the romfs) with correct size information
477 # 6. Install romfs to installation location
478 arm:
479         $(MAKE)
480         $(MAKE) $(ARCH)/romfs.cpio
481         echo "//Autogenerated size of romfs.cpio because the bootloader cannot calculate it" > $(arm_romfs_cpio)
482         echo "size_t romfs_cpio_archive_size = `ls -asl $(ARCH)/romfs.cpio | sed -e 's/ /\n/g' | head -6 | tail -1`;" >> $(arm_romfs_cpio)
483         $(MAKE)
484 .PHONY: arm
485
486 # Builds a dummy romfs_size.h
487 $(ARCH)/include/romfs_size.h:
488         mkdir -p $(shell dirname $@)
489         echo "size_t romfs_cpio_archive_size = 0; //should not see this" > $@
490
491 arminstall:
492         $(MAKE) arm
493         $(MAKE) install
494         install -p $(ARCH)/romfs.cpio ${INSTALL_PREFIX}/$(ARCH)/romfs.cpio
495 .PHONY: arminstall
496
497 # Copy the scc-specific menu.lst from the source directory to the build directory
498 menu.lst.scc: $(SRCDIR)/hake/menu.lst.scc
499         cp $< $@
500
501 scc: all tools/bin/dite menu.lst.scc
502         $(shell find scc/sbin -type f -print0 | xargs -0 strip -d)
503         tools/bin/dite -32 -o bigimage.dat menu.lst.scc
504         cp $(SRCDIR)/tools/scc/bootvector.dat .
505         bin2obj -m $(SRCDIR)/tools/scc/bigimage.map -o barrelfish0.obj
506         bin2obj -m $(SRCDIR)/tools/scc/bootvector.map -o barrelfish1.obj
507         @echo Taking the barrelfish.obj files to SCC host
508         scp barrelfish[01].obj user@tomme1.in.barrelfish.org:
509
510 # Source indexing targets
511 cscope.files:
512         find $(abspath .) $(abspath $(SRCDIR)) -name '*.[ch]' -type f -print | sort | uniq > $@
513 .PHONY: cscope.files
514
515 cscope.out: cscope.files
516         cscope -k -b -i$<
517
518 TAGS: cscope.files
519         etags - < $< # for emacs
520         cat $< | xargs ctags -o TAGS_VI # for vim
521
522 # force rebuild of the Makefile
523 rehake: ./hake/hake
524         ./hake/hake --source-dir $(SRCDIR)
525 .PHONY: rehake
526
527 clean::
528         $(RM) -r tools $(HAKE_ARCHS)
529 .PHONY: clean
530
531 realclean:: clean
532         $(RM) hake/*.o hake/*.hi hake/hake Hakefiles.hs cscope.*
533 .PHONY: realclean
534
535 # Documentation
536 DOCS= \
537         ./docs/TN-000-Overview.pdf \
538         ./docs/TN-001-Glossary.pdf \
539         ./docs/TN-002-Mackerel.pdf \
540         ./docs/TN-003-Hake.pdf \
541         ./docs/TN-004-VirtualMemory.pdf \
542         ./docs/TN-005-SCC.pdf \
543         ./docs/TN-006-Routing.pdf \
544         ./docs/TN-008-Tracing.pdf \
545         ./docs/TN-009-Notifications.pdf \
546         ./docs/TN-010-Spec.pdf \
547         ./docs/TN-011-IDC.pdf \
548         ./docs/TN-012-Services.pdf \
549         ./docs/TN-013-CapabilityManagement.pdf \
550         ./docs/TN-014-bulk-transfer.pdf \
551         ./docs/TN-015-DiskDriverArchitecture.pdf \
552         ./docs/TN-016-Serial.pdf \
553         ./docs/TN-017-ARM.pdf \
554         ./docs/TN-018-PracticalGuide.pdf \
555         ./docs/TN-019-DeviceDriver.pdf
556
557 docs doc: $(DOCS)
558 .PHONY: docs doc
559
560 clean::
561         $(RM) $(DOCS)
562 .PHONY: clean
563
564 doxygen: Doxyfile
565         doxygen $<
566 .PHONY: doxygen
567
568 # pretend to be CMake's CONFIGURE_FILE command
569 # TODO: clean this up
570 Doxyfile: $(SRCDIR)/doc/Doxyfile.cmake
571         sed -r 's#@CMAKE_SOURCE_DIR@#$(SRCDIR)#g' $< > $@
572
573 # Scheduler simulator test cases
574 RUNTIME = 1000
575 TESTS = $(addsuffix .txt,$(basename $(wildcard $(SRCDIR)/tools/schedsim/*.cfg)))
576
577 schedsim-regen: $(TESTS)
578
579 $(TESTS): %.txt: %.cfg tools/bin/simulator
580         tools/bin/simulator $< $(RUNTIME) > $@
581
582 schedsim-check: $(wildcard $(SRCDIR)/tools/schedsim/*.cfg)
583         for f in $^; do tools/bin/simulator $$f $(RUNTIME) | diff -q - `dirname $$f`/`basename $$f .cfg`.txt || exit 1; done
584
585 ######################################################################
586 #
587 # Intel Xeon Phi Builds
588 #
589 ######################################################################
590
591 # we have to filter out the moduels that are generated below
592 MODULES_k1om_filtered = $(filter-out xeon_phi_multiboot, \
593                                                 $(filter-out sbin/weever,$(MODULES_k1om)))
594
595 # Intel Xeon Phi-specific modules
596 XEON_PHI_MODULES =\
597         $(foreach m,$(MODULES_COMMON),k1om/$(m)) \
598         $(foreach m,$(MODULES_k1om_filtered),k1om/$(m)) \
599         $(foreach m,$(BENCH_COMMON),k1om/$(m)) \
600         $(foreach m,$(TESTS_COMMON),k1om/$(m)) \
601         $(foreach m,$(BENCH_k1om),k1om/$(m)) \
602         $(foreach m,$(TESTS_k1om),k1om/$(m))
603
604 menu.lst.k1om: $(SRCDIR)/hake/menu.lst.k1om
605         cp $< $@
606
607 k1om/tools/weever/mbi.c: tools/bin/weever_multiboot \
608                                                  k1om/xeon_phi_multiboot \
609                                                  k1om/tools/weever/.marker
610         tools/bin/weever_multiboot k1om/multiboot.menu.lst.k1om k1om/tools/weever/mbi.c
611
612 k1om/sbin/weever: k1om/sbin/weever.bin tools/bin/weever_creator
613         tools/bin/weever_creator ./k1om/sbin/weever.bin > ./k1om/sbin/weever
614
615 k1om/sbin/weever.bin: k1om/sbin/weever_elf
616         $(K1OM_OBJCOPY) -O binary -R .note -R .comment -S k1om/sbin/weever_elf ./k1om/sbin/weever.bin
617
618 k1om/xeon_phi_multiboot: $(XEON_PHI_MODULES) menu.lst.k1om
619         $(SRCDIR)/tools/weever/multiboot/build_data_files.sh menu.lst.k1om k1om
620
621
622 #######################################################################
623 #
624 # Pandaboard builds
625 #
626 #######################################################################
627
628 PANDABOARD_MODULES=\
629         armv7/sbin/cpu_omap44xx \
630         armv7/sbin/init \
631         armv7/sbin/mem_serv \
632         armv7/sbin/monitor \
633         armv7/sbin/ramfsd \
634         armv7/sbin/spawnd \
635         armv7/sbin/startd \
636         armv7/sbin/skb \
637         armv7/sbin/memtest \
638         armv7/sbin/kaluga \
639         armv7/sbin/fish \
640         armv7/sbin/sdma \
641         armv7/sbin/sdmatest \
642         armv7/sbin/sdma_bench \
643         armv7/sbin/bulk_sdma \
644         armv7/sbin/usb_manager \
645         armv7/sbin/usb_keyboard \
646         armv7/sbin/serial \
647         armv7/sbin/angler \
648         armv7/sbin/corectrl \
649
650
651 menu.lst.pandaboard: $(SRCDIR)/hake/menu.lst.pandaboard
652         cp $< $@
653
654 pandaboard_image: $(PANDABOARD_MODULES) \
655                 tools/bin/arm_molly \
656                 menu.lst.pandaboard
657         # Translate each of the binary files we need
658         $(SRCDIR)/tools/arm_molly/build_data_files.sh menu.lst.pandaboard molly_panda
659         # Generate appropriate linker script
660         cpp -P -DBASE_ADDR=0x82001000 $(SRCDIR)/tools/arm_molly/molly_ld_script.in \
661                 molly_panda/molly_ld_script
662         # Build a C file to link into a single image for the 2nd-stage
663         # bootloader
664         tools/bin/arm_molly menu.lst.pandaboard panda_mbi.c
665         # Compile the complete boot image into a single executable
666         $(ARM_GCC) -std=c99 -g -fPIC -pie -Wl,-N -fno-builtin \
667                 -nostdlib -march=armv7-a -mapcs -fno-unwind-tables \
668                 -Tmolly_panda/molly_ld_script \
669                 -I$(SRCDIR)/include \
670                 -I$(SRCDIR)/include/arch/arm \
671                 -I./armv7/include \
672                 -I$(SRCDIR)/include/oldc \
673                 -I$(SRCDIR)/include/c \
674                 -imacros $(SRCDIR)/include/deputy/nodeputy.h \
675                 $(SRCDIR)/tools/arm_molly/molly_boot.S \
676                 $(SRCDIR)/tools/arm_molly/molly_init.c \
677                 $(SRCDIR)/tools/arm_molly/lib.c \
678                 ./panda_mbi.c \
679                 $(SRCDIR)/lib/elf/elf32.c \
680                 ./molly_panda/* \
681                 -o pandaboard_image
682         @echo "OK - pandaboard boot image is built."
683         @echo "If your boot environment is correctly set up, you can now:"
684         @echo "$ usbboot ./pandaboard_image"
685
686 ########################################################################
687 #
688 # GEM5 build
689 #
690 ########################################################################
691
692 menu.lst.arm_gem5: $(SRCDIR)/hake/menu.lst.arm_gem5
693         cp $< $@
694
695 menu.lst.arm_gem5_mc: $(SRCDIR)/hake/menu.lst.arm_gem5_mc
696         cp $< $@
697
698 GEM5_MODULES=\
699         armv7/sbin/cpu_arm_gem5 \
700         armv7/sbin/init \
701         armv7/sbin/mem_serv \
702         armv7/sbin/monitor \
703         armv7/sbin/ramfsd \
704         armv7/sbin/spawnd \
705         armv7/sbin/startd \
706         armv7/sbin/corectrl \
707         armv7/sbin/skb \
708         armv7/sbin/memtest
709
710
711 arm_gem5_image: $(GEM5_MODULES) \
712                 tools/bin/arm_molly \
713                 menu.lst.arm_gem5_mc
714         # Translate each of the binary files we need
715         $(SRCDIR)/tools/arm_molly/build_data_files.sh menu.lst.arm_gem5_mc molly_gem5
716         # Generate appropriate linker script
717         cpp -P -DBASE_ADDR=0x00100000 $(SRCDIR)/tools/arm_molly/molly_ld_script.in \
718                 molly_gem5/molly_ld_script
719         # Build a C file to link into a single image for the 2nd-stage
720         # bootloader
721         tools/bin/arm_molly menu.lst.arm_gem5_mc arm_mbi.c
722         # Compile the complete boot image into a single executable
723         $(ARM_GCC) -std=c99 -g -fPIC -pie -Wl,-N -fno-builtin \
724                 -nostdlib -march=armv7-a -mapcs -fno-unwind-tables \
725                 -Tmolly_gem5/molly_ld_script \
726                 -I$(SRCDIR)/include \
727                 -I$(SRCDIR)/include/arch/arm \
728                 -I./armv7/include \
729                 -I$(SRCDIR)/include/oldc \
730                 -I$(SRCDIR)/include/c \
731                 -imacros $(SRCDIR)/include/deputy/nodeputy.h \
732                 $(SRCDIR)/tools/arm_molly/molly_boot.S \
733                 $(SRCDIR)/tools/arm_molly/molly_init.c \
734                 $(SRCDIR)/tools/arm_molly/lib.c \
735                 ./arm_mbi.c \
736                 $(SRCDIR)/lib/elf/elf32.c \
737                 ./molly_gem5/* \
738                 -o arm_gem5_image
739
740 # ARM GEM5 Simulation Targets
741 ARM_FLAGS=$(SRCDIR)/tools/arm_gem5/gem5script.py --caches --l2cache --n=2 --kernel=arm_gem5_image
742
743 arm_gem5: arm_gem5_image $(SRCDIR)/tools/arm_gem5/gem5script.py
744         gem5.fast $(ARM_FLAGS)
745
746 arm_gem5_detailed: arm_gem5_image $(SRCDIR)/tools/arm_gem5/gem5script.py
747         gem5.fast $(ARM_FLAGS) --cpu-type=arm_detailed
748
749 .PHONY: arm_gem5 arm_gem5_detailed
750
751 #######################################################################
752 #
753 # Pandaboard build for the armv7-M slave image (to be used in conjunction with a master image)
754 # (basically a normal pandaboard_image, but compiled for the cortex-m3)
755 #
756 #######################################################################
757
758 HETEROPANDA_SLAVE_MODULES=\
759         armv7-m/sbin/cpu_omap44xx \
760         armv7-m/sbin/init \
761         armv7-m/sbin/mem_serv \
762         armv7-m/sbin/monitor \
763         armv7-m/sbin/ramfsd \
764         armv7-m/sbin/spawnd \
765         armv7-m/sbin/startd \
766         armv7-m/sbin/skb \
767         armv7-m/sbin/memtest
768
769 menu.lst.armv7-m: $(SRCDIR)/hake/menu.lst.armv7-m
770         cp $< $@
771
772 heteropanda_slave: $(HETEROPANDA_SLAVE_MODULES) \
773                 tools/bin/arm_molly \
774                 menu.lst.armv7-m
775         # Translate each of the binary files we need
776         $(SRCDIR)/tools/arm_molly/build_data_files.sh menu.lst.armv7-m molly_panda_slave
777         # Generate appropriate linker script
778         cpp -P -DBASE_ADDR=0x0 $(SRCDIR)/tools/arm_molly/molly_ld_script.in \
779                 molly_panda_slave/molly_ld_script
780         # Build a C file to link into a single image for the 2nd-stage
781         # bootloader
782         tools/bin/arm_molly menu.lst.armv7-m panda_mbi_slave.c
783         # Compile the complete boot image into a single executable
784         $(ARM_GCC) -std=c99 -g -fPIC -pie -Wl,-N -fno-builtin \
785                 -nostdlib -march=armv7-m -mcpu=cortex-m3 -mthumb -mapcs -fno-unwind-tables \
786                 -Tmolly_panda_slave/molly_ld_script \
787                 -I$(SRCDIR)/include \
788                 -I$(SRCDIR)/include/arch/arm \
789                 -I./armv7-m/include \
790                 -I$(SRCDIR)/include/oldc \
791                 -I$(SRCDIR)/include/c \
792                 -imacros $(SRCDIR)/include/deputy/nodeputy.h \
793                 $(SRCDIR)/tools/arm_molly/molly_boot.S \
794                 $(SRCDIR)/tools/arm_molly/molly_init.c \
795                 $(SRCDIR)/tools/arm_molly/lib.c \
796                 ./panda_mbi_slave.c \
797                 $(SRCDIR)/lib/elf/elf32.c \
798                 ./molly_panda_slave/* \
799                 -o heteropanda_slave
800         @echo "OK - heteropanda slave image is built."
801         @echo "you can now use this image to link into a regular pandaboard image"
802
803
804
805
806 #######################################################################
807 #
808 # Pandaboard build for the heteropanda_master:
809 # basically a regular pandaboard_image, except that it contains
810 # a heteropanda_slave image, and arm_molly is called with -DHETEROPANDA
811 #
812 #######################################################################
813
814 menu.lst.heteropanda_master: $(SRCDIR)/hake/menu.lst.heteropanda_master
815         cp $< $@
816
817 heteropanda_master_image: $(PANDABOARD_MODULES) \
818                 tools/bin/arm_molly \
819                 menu.lst.heteropanda_master \
820                 heteropanda_slave \
821                 $(SRCDIR)/tools/arm_molly/molly_ld_script.in
822         # Translate each of the binary files we need
823         $(SRCDIR)/tools/arm_molly/build_data_files.sh menu.lst.heteropanda_master molly_panda
824         # Generate appropriate linker script
825         cpp -P -DBASE_ADDR=0x82001000 $(SRCDIR)/tools/arm_molly/molly_ld_script.in \
826                 molly_panda/molly_ld_script
827
828         # HETEROPANDA: convert slave image into a form we can insert in our image
829         $(ARM_OBJCOPY) -I binary -O elf32-littlearm -B arm --rename-section \
830             .data=.rodata_thumb,alloc,load,readonly,data,contents heteropanda_slave \
831             molly_panda/heteropanda_slave
832
833         # Build a C file to link into a single image for the 2nd-stage
834         # bootloader
835         tools/bin/arm_molly menu.lst.heteropanda_master panda_mbi.c
836         # Compile the complete boot image into a single executable
837         $(ARM_GCC) -std=c99 -g -fPIC -pie -Wl,-N -fno-builtin \
838                 -nostdlib -march=armv7-a -mcpu=cortex-a9 -mapcs -fno-unwind-tables \
839                 -Tmolly_panda/molly_ld_script \
840                 -I$(SRCDIR)/include \
841                 -I$(SRCDIR)/include/arch/arm \
842                 -I./armv7/include \
843                 -I$(SRCDIR)/include/oldc \
844                 -I$(SRCDIR)/include/c \
845                 -imacros $(SRCDIR)/include/deputy/nodeputy.h \
846                 $(SRCDIR)/tools/arm_molly/molly_boot.S \
847                 $(SRCDIR)/tools/arm_molly/molly_init.c \
848                 $(SRCDIR)/tools/arm_molly/lib.c \
849                 ./panda_mbi.c \
850                 $(SRCDIR)/lib/elf/elf32.c \
851                 ./molly_panda/* \
852                 -DHETEROPANDA \
853                 -o heteropanda_master_image
854         @echo "OK - heteropanda_master_image is built."
855         @echo "If your boot environment is correctly set up, you can now:"
856         @echo "$ usbboot ./heteropanda_master_image"