add files from learning repo

This commit is contained in:
2023-06-27 10:02:23 -07:00
commit 8c0eb4f6f2
8 changed files with 126 additions and 0 deletions

33
Makefile Normal file
View File

@@ -0,0 +1,33 @@
SHELL = /bin/bash
.DEFAULT_GOAL := build
BUILDDIR = build
BINDIR = bin
OBJECT_FILES = boot.o
build: clean-objects assemble-stub compile copy-o link
assemble-stub:
mkdir -p $(BUILDDIR)/
aarch64-elf-as boot.s -o $(BUILDDIR)/boot.o
compile:
mkdir -p $(BUILDDIR)/
nim c -d:release kernel.nim
copy-o:
cp nimcache/*.o build/
clear, clean:
rm -rf $(BUILDDIR) nimcache/ bin/
clean-objects:
rm -rf $(BUILDDIR)/*.o nimcache/*.o
link:
mkdir -p $(BINDIR) && \
aarch64-elf-ld -nostdlib -Tlinker.ld -o bin/kernel.elf -O2 $(wildcard build/*.o)
boot:
setup-macos:
brew install aarch64-elf-binutils aarch64-elf-gcc nim