3
|
1 # specify path to QEMU, installed with MacPorts
|
|
2 QEMU = qemu-system-arm
|
|
3
|
|
4 include makefile-osx.inc
|
|
5
|
|
6 # link the libgcc.a for __aeabi_idiv. ARM has no native support for div
|
|
7 LIBS = $(LIBGCC)
|
|
8
|
|
9 OBJS = \
|
|
10 lib/string.o \
|
|
11 \
|
|
12 arm.o\
|
|
13 asm.o\
|
|
14 bio.o\
|
|
15 buddy.o\
|
|
16 console.o\
|
|
17 exec.o\
|
|
18 file.o\
|
|
19 fs.o\
|
|
20 log.o\
|
|
21 main.o\
|
|
22 memide.o\
|
|
23 pipe.o\
|
|
24 proc.o\
|
|
25 spinlock.o\
|
|
26 start.o\
|
|
27 swtch.o\
|
|
28 syscall.o\
|
|
29 sysfile.o\
|
|
30 sysproc.o\
|
|
31 trap_asm.o\
|
|
32 trap.o\
|
|
33 vm.o \
|
|
34 \
|
|
35 device/picirq.o \
|
|
36 device/timer.o \
|
|
37 device/uart.o
|
|
38
|
|
39 KERN_OBJS = $(OBJS) entry-osx.o
|
|
40 kernel.elf: $(addprefix build/,$(KERN_OBJS)) kernel.ld build/initcode build/fs.img
|
|
41 cp -f build/initcode initcode
|
|
42 cp -f build/fs.img fs.img
|
|
43 $(call LINK_BIN, kernel.ld, kernel.elf, \
|
|
44 $(addprefix build/,$(KERN_OBJS)), \
|
|
45 initcode fs.img)
|
|
46 $(OBJDUMP) -S kernel.elf > kernel.asm
|
|
47 $(OBJDUMP) -t kernel.elf | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > kernel.sym
|
|
48 rm -f initcode fs.img
|
|
49
|
|
50 qemu: kernel.elf
|
|
51 @clear
|
|
52 @echo "Press Ctrl-A and then X to terminate QEMU session\n"
|
|
53 $(QEMU) -M versatilepb -m 128 -cpu arm1176 -nographic -kernel kernel.elf
|
|
54
|
|
55 INITCODE_OBJ = initcode.o
|
|
56 $(addprefix build/,$(INITCODE_OBJ)): initcode.S
|
|
57 $(call build-directory)
|
|
58 $(call AS_WITH, -nostdinc -I.)
|
|
59
|
|
60 #initcode is linked into the kernel, it will be used to craft the first process
|
|
61 build/initcode: $(addprefix build/,$(INITCODE_OBJ))
|
|
62 $(call LINK_INIT, -e start )
|
|
63 $(call OBJCOPY_INIT)
|
|
64 $(OBJDUMP) -S $< > initcode.asm
|
|
65
|
|
66 build/fs.img:
|
|
67 make -C tools
|
|
68 make -C usr
|
|
69
|
|
70 clean:
|
|
71 rm -rf build
|
|
72 rm -f *.o *.d *.asm *.sym vectors.S bootblock entryother \
|
|
73 initcode initcode.out kernel xv6.img fs.img kernel.elf memfs
|
|
74 make -C tools clean
|
|
75 make -C usr clean
|