diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/old_makefiles/makefile-armgccbc	Mon Dec 02 19:12:01 2019 +0900
@@ -0,0 +1,102 @@
+# specify path to QEMU, installed with MacPorts 
+QEMU = qemu-system-arm
+
+include makefile.inc
+
+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-
+#AS = arm-linux-gnu-gcc
+AS = /mnt/dalmore-home/one/src/armgcc/cross/bin/arm-none-eabi-gcc
+#LD = arm-linux-gnu-ld
+LD = /mnt/dalmore-home/one/src/armgcc/cross/bin/arm-none-eabi-ld
+#OBJCOPY = arm-linux-gnu-objcopy
+OBJCOPY = /mnt/dalmore-home/one/src/armgcc/cross/bin/arm-none-eabi-objcopy
+#OBJDUMP = arm-linux-gnu-objdump
+OBJDUMP = /mnt/dalmore-home/one/src/armgcc/cross/bin/arm-none-eabi-objdump
+CFLAGS = -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -I. -g -O0
+
+ASFLAGS = 
+
+LIBGCC = $(shell $(CC) -print-libgcc-file-name)
+
+LINK_BIN = $(call quiet-command,$(LD) $(LDFLAGS) \
+        -T $(1) -o $(2) $(3) $(LIBS) -b binary $(4), "  LINK     $(TARGET_DIR)$@")
+
+LINK_INIT = $(call quiet-command,$(LD) $(LDFLAGS) \
+        $(1) -o $@.out $<, "  LINK     $(TARGET_DIR)$@")
+OBJCOPY_INIT = $(call quiet-command,$(OBJCOPY) \
+        -S -O binary --prefix-symbols="_binary_$@" $@.out $@, "  OBJCOPY  $(TARGET_DIR)$@")
+AS_WITH = $(call quiet-command,$(AS) $(ASFLAGS) \
+                $(1) -c -o $@ $<,"  AS       $(TARGET_DIR)$@")
+
+# link the libgcc.a for __aeabi_idiv. ARM has no native support for div
+LIBS = $(LIBGCC)
+
+CMAKEDIR =  CMakeFiles/kernel.dir
+
+OBJS = \
+	$(CMAKEDIR)/lib/string.c.o \
+	$(CMAKEDIR)/c/kernel-context.c.o\
+	$(CMAKEDIR)/arm.c.o\
+	$(CMAKEDIR)/asm.S.o\
+	$(CMAKEDIR)/bio.c.o\
+	$(CMAKEDIR)/buddy.c.o\
+	$(CMAKEDIR)/c/console.c.o\
+	$(CMAKEDIR)/exec.c.o\
+	$(CMAKEDIR)/c/file.c.o\
+	$(CMAKEDIR)/fs.c.o\
+	$(CMAKEDIR)/log.c.o\
+	$(CMAKEDIR)/main.c.o\
+	$(CMAKEDIR)/memide.c.o\
+	$(CMAKEDIR)/c/pipe.c.o\
+	$(CMAKEDIR)/c/proc.c.o\
+	$(CMAKEDIR)/c/spinlock.c.o\
+	$(CMAKEDIR)/start.c.o\
+	$(CMAKEDIR)/swtch.S.o\
+	$(CMAKEDIR)/c/syscall.c.o\
+	$(CMAKEDIR)/c/sysfile.c.o\
+	$(CMAKEDIR)/sysproc.c.o\
+	$(CMAKEDIR)/trap_asm.c.o\
+	$(CMAKEDIR)/trap.c.o\
+	$(CMAKEDIR)/vm.c.o \
+	\
+	$(CMAKEDIR)/device/picirq.c.o \
+	$(CMAKEDIR)/device/timer.c.o \
+	$(CMAKEDIR)/device/uart.c.o
+
+KERN_OBJS = $(OBJS) entry.S.o
+kernel.elf: $(KERN_OBJS) kernel.ld build/initcode build/fs.img
+	cp -f build/initcode initcode
+	cp -f build/fs.img fs.img
+	$(call LINK_BIN, kernel.ld, kernel.elf, \
+		$(KERN_OBJS), \
+		initcode fs.img)
+	$(OBJDUMP) -S kernel.elf > kernel.asm
+	$(OBJDUMP) -t kernel.elf | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > kernel.sym
+	rm -f initcode fs.img
+
+qemu: kernel.elf
+	@clear
+	@echo "Press Ctrl-A and then X to terminate QEMU session\n"
+	$(QEMU) -M versatilepb -m 128 -cpu arm1176  -nographic -kernel kernel.elf
+
+INITCODE_OBJ = initcode.o
+$(addprefix build/,$(INITCODE_OBJ)): initcode.S
+	$(call build-directory)
+	$(call AS_WITH, -nostdinc -I.)
+
+#initcode is linked into the kernel, it will be used to craft the first process
+build/initcode: $(addprefix build/,$(INITCODE_OBJ))
+	$(call LINK_INIT, -N -e start -Ttext 0)
+	$(call OBJCOPY_INIT)
+	$(OBJDUMP) -S $< > initcode.asm
+
+build/fs.img:
+	make -C tools
+	make -C usr -f makfile-armgccbc
+
+clean: 
+	rm -rf build
+	rm -f *.o *.d *.asm *.sym vectors.S bootblock entryother \
+	initcode initcode.out kernel xv6.img fs.img kernel.elf memfs
+	make -C tools clean
+	make -C usr clean