From 12cbc1c0cac64f99b3784554eb540b20f33e9f23 Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Wed, 22 Apr 2026 18:11:52 +0800 Subject: feat: add linker script and common macros for RISC-V architecture --- na/Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'na/Makefile') diff --git a/na/Makefile b/na/Makefile index 6b5e84c..cc51a65 100644 --- a/na/Makefile +++ b/na/Makefile @@ -42,7 +42,8 @@ ARCH := riscv BUILD := build TARGET := $(BUILD)/kernel.elf IMAGE := $(BUILD)/kernel.bin -LINKER_SCRIPT := linker.ld +LDS_SRC := arch/$(ARCH)/kernel/lumeos.lds.S +LINKER_SCRIPT := $(BUILD)/lumeos.lds # Common flags (base, before module includes) WARNINGS := -Wall -Wextra -Wno-unused-parameter @@ -103,6 +104,12 @@ DEPS := $(OBJS:.o=.d) all: $(IMAGE) +# Preprocess linker script template (.lds.S → .lds) +$(LINKER_SCRIPT): $(LDS_SRC) include/lume/lumeos.lds.h + @echo " LDS $@" + @mkdir -p $(dir $@) + @$(CC) -E -P -x c $(INCLUDES) $< -o $@ + # Link kernel ELF $(TARGET): $(OBJS) $(LINKER_SCRIPT) @echo " LD $@" -- cgit v1.2.3