comparison src/makefile-armgccbc @ 17:c0f6f3eb25ae

argccbc
author kono
date Sun, 25 Feb 2018 18:48:39 +0900
parents
children 36bd61f5c847
comparison
equal deleted inserted replaced
16:7eb81a3c4b29 17:c0f6f3eb25ae
1 # specify path to QEMU, installed with MacPorts
2 QEMU = qemu-system-arm
3
4 include makefile.inc
5
6 CC = /usr/local/arm-cbc/bin/arm-none-eabi-gcc -B/usr/local/arm-cbc/bin/arm-none-eabi-
7 AS = arm-linux-gnu-gcc
8 LD = arm-linux-gnu-ld
9 OBJCOPY = arm-linux-gnu-objcopy
10 OBJDUMP = arm-linux-gnu-objdump
11 CFLAGS = -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -I. -g -O0
12
13 ASFLAGS =
14
15 LIBGCC = $(shell $(CC) -print-libgcc-file-name)
16
17 LINK_BIN = $(call quiet-command,$(LD) $(LDFLAGS) \
18 -T $(1) -o $(2) $(3) $(LIBS) -b binary $(4), " LINK $(TARGET_DIR)$@")
19
20 LINK_INIT = $(call quiet-command,$(LD) $(LDFLAGS) \
21 $(1) -o $@.out $<, " LINK $(TARGET_DIR)$@")
22 OBJCOPY_INIT = $(call quiet-command,$(OBJCOPY) \
23 -S -O binary --prefix-symbols="_binary_$@" $@.out $@, " OBJCOPY $(TARGET_DIR)$@")
24 AS_WITH = $(call quiet-command,$(AS) $(ASFLAGS) \
25 $(1) -c -o $@ $<," AS $(TARGET_DIR)$@")
26
27 # link the libgcc.a for __aeabi_idiv. ARM has no native support for div
28 LIBS = $(LIBGCC)
29
30 OBJS = \
31 lib/string.o \
32 \
33 arm.o\
34 asm.o\
35 bio.o\
36 buddy.o\
37 console.o\
38 exec.o\
39 file.o\
40 fs.o\
41 log.o\
42 main.o\
43 memide.o\
44 pipe.o\
45 proc.o\
46 spinlock.o\
47 start.o\
48 swtch.o\
49 syscall.o\
50 sysfile.o\
51 sysproc.o\
52 trap_asm.o\
53 trap.o\
54 vm.o \
55 \
56 device/picirq.o \
57 device/timer.o \
58 device/uart.o
59
60 KERN_OBJS = $(OBJS) entry.o
61 kernel.elf: $(addprefix build/,$(KERN_OBJS)) kernel.ld build/initcode build/fs.img
62 cp -f build/initcode initcode
63 cp -f build/fs.img fs.img
64 $(call LINK_BIN, kernel.ld, kernel.elf, \
65 $(addprefix build/,$(KERN_OBJS)), \
66 initcode fs.img)
67 $(OBJDUMP) -S kernel.elf > kernel.asm
68 $(OBJDUMP) -t kernel.elf | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > kernel.sym
69 rm -f initcode fs.img
70
71 qemu: kernel.elf
72 @clear
73 @echo "Press Ctrl-A and then X to terminate QEMU session\n"
74 $(QEMU) -M versatilepb -m 128 -cpu arm1176 -nographic -kernel kernel.elf
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 -f makfile-armgccbc
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