From 5270c5a20fd010a68e3b2ad565f99811fb8b3340 Mon Sep 17 00:00:00 2001 From: Just1nWu <1295360720@qq.com> Date: Sun, 14 Jun 2026 18:33:41 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=B8=BAmakefile=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=80=89=E9=A1=B9=EF=BC=8C=E4=BD=BF=E7=94=A8ARCH=3D[rv|la]?= =?UTF-8?q?=E6=9D=A5=E7=BC=96=E8=AF=91=E9=83=A8=E5=88=86=E5=86=85=E6=A0=B8?= =?UTF-8?q?=E3=80=82=E6=9B=B4=E6=96=B0submodule=E6=8C=87=E9=92=88=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 26 +++++++++++++++++++++++++- fs/src/ext4_rs | 2 +- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c151b15..19070b6 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ DOCKER_NAME ?= rcore-docker ARCH ?= rv +BUILD_ARCH ?= all TARGET ?= riscv64gc-unknown-none-elf USER_MODE ?= release USER_BIN_DIR := user/target/$(TARGET)/$(USER_MODE) @@ -63,6 +64,29 @@ MEM_LA ?= 1G QEMU_LA_NETDEV ?= user,id=net0 OPTIONAL_RUNTIME_FILES := $(wildcard lib/musl/ar lib/glibc/ar) +# make all 默认同时构建两种架构;命令行可用 BUILD_ARCH/ARCH 只选一种。 +ifeq ($(origin BUILD_ARCH),command line) +ALL_ARCH_REQUEST := $(BUILD_ARCH) +else ifeq ($(origin ARCH),command line) +ALL_ARCH_REQUEST := $(ARCH) +else +ALL_ARCH_REQUEST := all +endif +ALL_ARCH := $(shell printf '%s' "$(ALL_ARCH_REQUEST)" | tr '[:upper:]' '[:lower:]') + +ALL_TARGETS_RV := user-apps kernel-rv $(DISK_RV_IMG) +ALL_TARGETS_LA := user-apps-la kernel-la $(DISK_LA_IMG) + +ifneq ($(filter $(ALL_ARCH),all both),) +ALL_BUILD_TARGETS := $(ALL_TARGETS_RV) $(ALL_TARGETS_LA) +else ifneq ($(filter $(ALL_ARCH),rv riscv riscv64 rv64),) +ALL_BUILD_TARGETS := $(ALL_TARGETS_RV) +else ifneq ($(filter $(ALL_ARCH),la loongarch loongarch64 la64),) +ALL_BUILD_TARGETS := $(ALL_TARGETS_LA) +else +$(error unsupported BUILD_ARCH/ARCH=$(ALL_ARCH_REQUEST), expected all, rv or la) +endif + ifeq ($(ARCH),rv) QEMU ?= $(QEMU_RV) RUN_KERNEL := kernel-rv @@ -80,7 +104,7 @@ endif all: $(MAKE) submodules $(MAKE) cargo-config - $(MAKE) user-apps user-apps-la kernel-rv kernel-la $(DISK_RV_IMG) $(DISK_LA_IMG) + $(MAKE) $(ALL_BUILD_TARGETS) # 拉取所有子模块,确保后续构建依赖完整。 submodules: diff --git a/fs/src/ext4_rs b/fs/src/ext4_rs index d396d88..016bbbb 160000 --- a/fs/src/ext4_rs +++ b/fs/src/ext4_rs @@ -1 +1 @@ -Subproject commit d396d88e9ea206ed137aaa0c41fe5ab9bbf6012b +Subproject commit 016bbbba3bb2670472eeda35b3b497c6ff2222ef