Implemented project structure
This commit is contained in:
26
Makefile
Normal file
26
Makefile
Normal file
@@ -0,0 +1,26 @@
|
||||
CC = ./xpack-riscv-none-elf-gcc-13.4.0-1/bin/riscv-none-elf-gcc
|
||||
CFLAGS = -nostdlib -O2 -g3 -Wall -Wextra -fno-stack-protector -ffreestanding
|
||||
LD_SCRIPT = kernel.ld
|
||||
LDFLAGS = -T$(LD_SCRIPT) -Wl,-Map=kernel.map
|
||||
|
||||
SRC = kernel.c
|
||||
OUT = kernel.elf
|
||||
|
||||
.PHONY: all clean run
|
||||
|
||||
all: $(OUT)
|
||||
|
||||
$(OUT): $(SRC) $(LD_SCRIPT)
|
||||
$(CC) $(LDFLAGS) $(CFLAGS) $(SRC) -o $@
|
||||
|
||||
clean:
|
||||
rm -f $(OUT) kernel.map
|
||||
|
||||
run: $(OUT)
|
||||
distrobox enter archlinux -- qemu-system-riscv32 \
|
||||
-machine virt \
|
||||
-bios default \
|
||||
-nographic \
|
||||
-serial mon:stdio \
|
||||
-no-reboot \
|
||||
-kernel $(OUT)
|
||||
Reference in New Issue
Block a user