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