initial commit

This commit is contained in:
Lauchmelder 2022-01-20 12:34:33 +01:00
commit 1e778fc163
12 changed files with 431 additions and 0 deletions

30
Makefile Normal file
View file

@ -0,0 +1,30 @@
GCCPATH = /opt/gcc-arm/bin
CC = $(GCCPATH)/aarch64-none-elf-gcc
LD = $(GCCPATH)/aarch64-none-elf-ld
OBJCOPY = $(GCCPATH)/aarch64-none-elf-objcopy
GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles
OUTDIR = ./out/bin
HFILES = $(wildcard *.h include/*.h)
CFILES = $(wildcard *.c src/*.c)
_OFILES = $(CFILES:.c=.o)
OFILES = $(_OFILES:src/%=out/%)
all: clean kernel8.img
out/%.o: src/%.c $(HFILES)
@echo "Building $@"
@mkdir -p $(@D)
@$(CC) -Iinclude -c $< -o $@ $(GCCLFAGS)
kernel8.img: $(OFILES)
@echo "Linking kernel"
@mkdir -p bin
@$(LD) -nostdlib $(OFILES) -T link.ld -o out/kernel8.elf
@$(OBJCOPY) -O binary out/kernel8.elf bin/kernel8.img
@echo "Done!"
clean:
@/bin/rm -rf out/ > /dev/null 2> /dev/null || true