comparison src/old_makefiles/makefile-armgccbc @ 120:ed85941a7514

mv old-makefiel
author anatofuz
date Mon, 02 Dec 2019 19:12:01 +0900
parents src/makefile-armgccbc@aa0095c4c2b0
children
comparison
equal deleted inserted replaced
119:94ee7046d190 120:ed85941a7514
1 # specify path to QEMU, installed with MacPorts
2 QEMU = qemu-system-arm
3
4 include makefile.inc
5
6 CC = /mnt/dalmore-home/one/src/armgcc/cross/bin/arm-none-eabi-gcc -B/mnt/dalmore-home/one/src/armgcc/cross/bin/arm-none-eabi-
7 #AS = arm-linux-gnu-gcc
8 AS = /mnt/dalmore-home/one/src/armgcc/cross/bin/arm-none-eabi-gcc
9 #LD = arm-linux-gnu-ld
10 LD = /mnt/dalmore-home/one/src/armgcc/cross/bin/arm-none-eabi-ld
11 #OBJCOPY = arm-linux-gnu-objcopy
12 OBJCOPY = /mnt/dalmore-home/one/src/armgcc/cross/bin/arm-none-eabi-objcopy
13 #OBJDUMP = arm-linux-gnu-objdump
14 OBJDUMP = /mnt/dalmore-home/one/src/armgcc/cross/bin/arm-none-eabi-objdump
15 CFLAGS = -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -I. -g -O0
16
17 ASFLAGS =
18
19 LIBGCC = $(shell $(CC) -print-libgcc-file-name)
20
21 LINK_BIN = $(call quiet-command,$(LD) $(LDFLAGS) \
22 -T $(1) -o $(2) $(3) $(LIBS) -b binary $(4), " LINK $(TARGET_DIR)$@")
23
24 LINK_INIT = $(call quiet-command,$(LD) $(LDFLAGS) \
25 $(1) -o $@.out $<, " LINK $(TARGET_DIR)$@")
26 OBJCOPY_INIT = $(call quiet-command,$(OBJCOPY) \
27 -S -O binary --prefix-symbols="_binary_$@" $@.out $@, " OBJCOPY $(TARGET_DIR)$@")
28 AS_WITH = $(call quiet-command,$(AS) $(ASFLAGS) \
29 $(1) -c -o $@ $<," AS $(TARGET_DIR)$@")
30
31 # link the libgcc.a for __aeabi_idiv. ARM has no native support for div
32 LIBS = $(LIBGCC)
33
34 CMAKEDIR = CMakeFiles/kernel.dir
35
36 OBJS = \
37 $(CMAKEDIR)/lib/string.c.o \
38 $(CMAKEDIR)/c/kernel-context.c.o\
39 $(CMAKEDIR)/arm.c.o\
40 $(CMAKEDIR)/asm.S.o\
41 $(CMAKEDIR)/bio.c.o\
42 $(CMAKEDIR)/buddy.c.o\
43 $(CMAKEDIR)/c/console.c.o\
44 $(CMAKEDIR)/exec.c.o\
45 $(CMAKEDIR)/c/file.c.o\
46 $(CMAKEDIR)/fs.c.o\
47 $(CMAKEDIR)/log.c.o\
48 $(CMAKEDIR)/main.c.o\
49 $(CMAKEDIR)/memide.c.o\
50 $(CMAKEDIR)/c/pipe.c.o\
51 $(CMAKEDIR)/c/proc.c.o\
52 $(CMAKEDIR)/c/spinlock.c.o\
53 $(CMAKEDIR)/start.c.o\
54 $(CMAKEDIR)/swtch.S.o\
55 $(CMAKEDIR)/c/syscall.c.o\
56 $(CMAKEDIR)/c/sysfile.c.o\
57 $(CMAKEDIR)/sysproc.c.o\
58 $(CMAKEDIR)/trap_asm.c.o\
59 $(CMAKEDIR)/trap.c.o\
60 $(CMAKEDIR)/vm.c.o \
61 \
62 $(CMAKEDIR)/device/picirq.c.o \
63 $(CMAKEDIR)/device/timer.c.o \
64 $(CMAKEDIR)/device/uart.c.o
65
66 KERN_OBJS = $(OBJS) entry.S.o
67 kernel.elf: $(KERN_OBJS) kernel.ld build/initcode build/fs.img
68 cp -f build/initcode initcode
69 cp -f build/fs.img fs.img
70 $(call LINK_BIN, kernel.ld, kernel.elf, \
71 $(KERN_OBJS), \
72 initcode fs.img)
73 $(OBJDUMP) -S kernel.elf > kernel.asm
74 $(OBJDUMP) -t kernel.elf | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > kernel.sym
75 rm -f initcode fs.img
76
77 qemu: kernel.elf
78 @clear
79 @echo "Press Ctrl-A and then X to terminate QEMU session\n"
80 $(QEMU) -M versatilepb -m 128 -cpu arm1176 -nographic -kernel kernel.elf
81
82 INITCODE_OBJ = initcode.o
83 $(addprefix build/,$(INITCODE_OBJ)): initcode.S
84 $(call build-directory)
85 $(call AS_WITH, -nostdinc -I.)
86
87 #initcode is linked into the kernel, it will be used to craft the first process
88 build/initcode: $(addprefix build/,$(INITCODE_OBJ))
89 $(call LINK_INIT, -N -e start -Ttext 0)
90 $(call OBJCOPY_INIT)
91 $(OBJDUMP) -S $< > initcode.asm
92
93 build/fs.img:
94 make -C tools
95 make -C usr -f makfile-armgccbc
96
97 clean:
98 rm -rf build
99 rm -f *.o *.d *.asm *.sym vectors.S bootblock entryother \
100 initcode initcode.out kernel xv6.img fs.img kernel.elf memfs
101 make -C tools clean
102 make -C usr clean