0
|
1 # specify path to QEMU, installed with MacPorts
|
|
2 QEMU = qemu-system-arm
|
|
3
|
20
|
4 CPU = armv8
|
|
5 QEMUCPU = cortex-a15
|
0
|
6 include makefile.inc
|
14
|
7 CC = /usr/local/cbclang/bin/clang
|
|
8 AS = arm-linux-gnu-as
|
|
9 LD = arm-linux-gnu-ld
|
|
10 OBJCOPY = arm-linux-gnu-objcopy
|
|
11 OBJDUMP = arm-linux-gnu-objdump
|
|
12
|
20
|
13 # CFLAGS = -march=${CPU} -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -Werror -I. -g -O0
|
|
14 CFLAGS = -target ${CPU}-linux-gnueabihf -march=${CPU} -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -I. -I ../cbclang/arm -g -O0
|
16
|
15 LDFLAGS = --noinhibit-exec
|
20
|
16 # ASFLAGS = -march=${CPU}
|
|
17 ASFLAGS = -target ${CPU}-linux-gnueabihf
|
14
|
18
|
16
|
19 LIBGCC = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
|
0
|
20
|
|
21 # link the libgcc.a for __aeabi_idiv. ARM has no native support for div
|
16
|
22 LIBS =/net/open/RaspberryPi/rasbian-img/usr/lib/gcc/arm-linux-gnueabihf/6/libgcc.a
|
|
23
|
0
|
24
|
|
25 OBJS = \
|
|
26 lib/string.o \
|
|
27 \
|
|
28 arm.o\
|
|
29 asm.o\
|
|
30 bio.o\
|
|
31 buddy.o\
|
|
32 console.o\
|
|
33 exec.o\
|
|
34 file.o\
|
|
35 fs.o\
|
|
36 log.o\
|
|
37 main.o\
|
|
38 memide.o\
|
|
39 pipe.o\
|
|
40 proc.o\
|
|
41 spinlock.o\
|
|
42 start.o\
|
|
43 swtch.o\
|
|
44 syscall.o\
|
|
45 sysfile.o\
|
|
46 sysproc.o\
|
|
47 trap_asm.o\
|
|
48 trap.o\
|
|
49 vm.o \
|
|
50 \
|
|
51 device/picirq.o \
|
|
52 device/timer.o \
|
|
53 device/uart.o
|
|
54
|
13
|
55 KERN_OBJS = $(OBJS) entry-clang.o
|
|
56 kernel.elf: $(addprefix build/,$(KERN_OBJS)) kernel-clang.ld build/initcode build/fs.img
|
0
|
57 cp -f build/initcode initcode
|
|
58 cp -f build/fs.img fs.img
|
13
|
59 $(call LINK_BIN, kernel-clang.ld, kernel.elf, \
|
0
|
60 $(addprefix build/,$(KERN_OBJS)), \
|
|
61 initcode fs.img)
|
|
62 $(OBJDUMP) -S kernel.elf > kernel.asm
|
|
63 $(OBJDUMP) -t kernel.elf | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > kernel.sym
|
|
64 rm -f initcode fs.img
|
|
65
|
|
66 qemu: kernel.elf
|
|
67 @clear
|
|
68 @echo "Press Ctrl-A and then X to terminate QEMU session\n"
|
20
|
69 export QEMU_AUDIO_DRV=none ; $(QEMU) -M versatilepb -m 128 -cpu ${QEMUCPU} -nographic -soundhw hda -kernel kernel.elf
|
17
|
70
|
|
71 qemu-debug : kernel.elf
|
|
72 @clear
|
|
73 @echo "Press Ctrl-A and then X to terminate QEMU session\n"
|
20
|
74 export QEMU_AUDIO_DRV=none ; $(QEMU) -M versatilepb -m 128 -cpu ${QEMUCPU} -nographic -singlestep -d exec,cpu,guest_errors -D qemu.log -kernel kernel.elf -s -S
|
0
|
75
|
|
76 INITCODE_OBJ = initcode.o
|
|
77 $(addprefix build/,$(INITCODE_OBJ)): initcode.S
|
|
78 $(call build-directory)
|
|
79 $(call AS_WITH, -nostdinc -I.)
|
|
80
|
|
81 #initcode is linked into the kernel, it will be used to craft the first process
|
|
82 build/initcode: $(addprefix build/,$(INITCODE_OBJ))
|
|
83 $(call LINK_INIT, -N -e start -Ttext 0)
|
|
84 $(call OBJCOPY_INIT)
|
|
85 $(OBJDUMP) -S $< > initcode.asm
|
|
86
|
|
87 build/fs.img:
|
|
88 make -C tools
|
|
89 make -C usr
|
|
90
|
|
91 clean:
|
|
92 rm -rf build
|
|
93 rm -f *.o *.d *.asm *.sym vectors.S bootblock entryother \
|
|
94 initcode initcode.out kernel xv6.img fs.img kernel.elf memfs
|
|
95 make -C tools clean
|
|
96 make -C usr clean
|