diff options
| author | Richard Qin <richard.qin.x@gmail.com> | 2026-04-22 18:11:52 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.x@gmail.com> | 2026-04-22 18:11:52 +0800 |
| commit | 12cbc1c0cac64f99b3784554eb540b20f33e9f23 (patch) | |
| tree | 0875b9c69a3d3f32c43cabc3d91051c3e461c8f0 /na/Makefile | |
| parent | 3b7d014ad6d5f25de705447e832d7b13b884604e (diff) | |
| download | lume-12cbc1c0cac64f99b3784554eb540b20f33e9f23.tar.gz lume-12cbc1c0cac64f99b3784554eb540b20f33e9f23.tar.xz | |
feat: add linker script and common macros for RISC-V architecture
Diffstat (limited to 'na/Makefile')
| -rw-r--r-- | na/Makefile | 9 |
1 files changed, 8 insertions, 1 deletions
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 $@" |
