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