From 7bab432e56b4c8f97c8f3206b0c9ec44da7889a9 Mon Sep 17 00:00:00 2001 From: Youjie Zheng Date: Tue, 7 May 2024 17:00:31 +0800 Subject: [PATCH] feat: run on ext4 filesystem --- Cargo.lock | 10 +---- Cargo.toml | 2 +- scripts/make/build.mk | 5 --- scripts/make/build_lwext4.mk | 80 ------------------------------------ 4 files changed, 3 insertions(+), 94 deletions(-) delete mode 100644 scripts/make/build_lwext4.mk diff --git a/Cargo.lock b/Cargo.lock index 00eae8e..a924f77 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -166,18 +166,14 @@ name = "arceos_posix_api" version = "0.1.0" source = "git+https://github.com/Starry-OS/arceos_posix_api.git#0949faae5bc4e892035f8c327678c49bfa59f0b5" dependencies = [ - "axalloc", "axconfig", "axerrno", "axfeat", - "axfs", "axhal", "axio", "axlog", - "axnet", "axruntime", "axsync", - "axtask", "bindgen", "flatten_objects", "lazy_static", @@ -279,7 +275,7 @@ dependencies = [ [[package]] name = "axdriver" version = "0.1.0" -source = "git+https://github.com/Starry-OS/axdriver.git#b672df079cf2d3f0585ed6e93e79f527f741f677" +source = "git+https://github.com/Starry-OS/axdriver.git#a21caaacd33aa26c9069b0f963f90e0750935dac" dependencies = [ "axalloc", "axconfig", @@ -317,14 +313,12 @@ dependencies = [ "axruntime", "axsync", "axtask", - "spinlock", - "taskctx", ] [[package]] name = "axfs" version = "0.1.0" -source = "git+https://github.com/Starry-OS/axfs.git#941f2efbe7f46a781bc68a2b9061bad44f40348c" +source = "git+https://github.com/Starry-OS/axfs.git#7570484c9459503e5934dee501b0b465af224d01" dependencies = [ "axconfig", "axdriver", diff --git a/Cargo.toml b/Cargo.toml index 162803a..0edab53 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,5 +9,5 @@ lto = true lto = true [workspace] -members = ["crates/axlibc", "apps/display", "apps/exception", "apps/helloworld", "apps/memtest", "apps/fs/shell", "apps/net/echoserver", "apps/net/httpclient", "apps/net/httpserver", "apps/net/udpserver", "apps/net/bwbench", "apps/task/parallel", "apps/task/sleep", "apps/task/yield", "apps/task/priority", "apps/task/tls", "apps/monolithic_userboot"] +members = ["crates/*", "apps/display", "apps/exception", "apps/helloworld", "apps/memtest", "apps/fs/shell", "apps/net/echoserver", "apps/net/httpclient", "apps/net/httpserver", "apps/net/udpserver", "apps/net/bwbench", "apps/task/parallel", "apps/task/sleep", "apps/task/yield", "apps/task/priority", "apps/task/tls", "apps/monolithic_userboot"] resolver = "2" diff --git a/scripts/make/build.mk b/scripts/make/build.mk index 8a57d52..6618304 100644 --- a/scripts/make/build.mk +++ b/scripts/make/build.mk @@ -3,11 +3,6 @@ include scripts/make/cargo.mk include scripts/make/features.mk -ifneq ($(filter ext4fs, $(FEATURES)),) -include scripts/make/build_lwext4.mk -build_deplibs += lwext4_libc -endif - ifeq ($(APP_TYPE), c) include scripts/make/build_c.mk else diff --git a/scripts/make/build_lwext4.mk b/scripts/make/build_lwext4.mk deleted file mode 100644 index 1162305..0000000 --- a/scripts/make/build_lwext4.mk +++ /dev/null @@ -1,80 +0,0 @@ -### build libc.a for lwext4 - -# override FEATURES := fp_simd alloc paging fs fd -local_lib_feat := fp_simd alloc paging fs fd - -export LIBC_BUILD_TARGET_DIR=$(abspath $(local_obj_dir)) - -### include scripts/make/build_c.mk -local_ulib_dir := crates/axlibc -local_src_dir := $(local_ulib_dir)/c -local_inc_dir := $(local_ulib_dir)/include -local_obj_dir := $(local_ulib_dir)/lwext4_libc_$(ARCH) -lwext4_c_lib := $(local_obj_dir)/libc-$(ARCH).a - -local_last_cflags := $(local_obj_dir)/.cflags - -local_ulib_src := $(wildcard $(local_src_dir)/*.c) -local_ulib_hdr := $(wildcard $(local_inc_dir)/*.h) -local_ulib_obj := $(patsubst $(local_src_dir)/%.c,$(local_obj_dir)/%.o,$(local_ulib_src)) - -LOCAL_CFLAGS += $(addprefix -DAX_CONFIG_,$(shell echo $(local_lib_feat) | tr 'a-z' 'A-Z' | tr '-' '_')) -LOCAL_CFLAGS += -DAX_LOG_DEBUG - -LOCAL_CFLAGS += -nostdinc -fno-builtin -ffreestanding -Wall -LOCAL_CFLAGS += -I$(CURDIR)/$(local_inc_dir) -# LOCAL_LDFLAGS += -nostdlib -static -no-pie --gc-sections -T$(LD_SCRIPT) - -ifeq ($(MODE), release) - LOCAL_CFLAGS += -O3 -endif - -ifeq ($(ARCH), x86_64) - LOCAL_LDFLAGS += --no-relax -else ifeq ($(ARCH), riscv64) - LOCAL_CFLAGS += -march=rv64gc -mabi=lp64d -mcmodel=medany -endif - -# 在FEATURES中查找fp_simd, 判断为空。 SIMD单个指令同时处理多个寄存器数据,进行浮点运算 -# ifeq ($(findstring fp_simd,$(FEATURES)),) -$(info FEATURES=$(FEATURES)) - -_check_lw_need_rebuild: $(local_obj_dir) - @if [ "$(LOCAL_CFLAGS)" != "`cat $(local_last_cflags) 2>&1`" ]; then \ - echo "CFLAGS changed, rebuild"; \ - echo "$(LOCAL_CFLAGS)" > $(local_last_cflags); \ - fi - -$(local_obj_dir): - $(call run_cmd,mkdir,-p $@) - -$(local_obj_dir)/%.o: $(local_src_dir)/%.c $(local_last_cflags) - $(call run_cmd,$(CC),$(LOCAL_CFLAGS) -c -o $@ $<) - -$(lwext4_c_lib): $(local_obj_dir) _check_lw_need_rebuild $(local_ulib_obj) - $(call run_cmd,$(AR),rcs $@ $(local_ulib_obj)) - -lwext4_libc: gen_libc_header $(lwext4_c_lib) make_disk_image_ext4 - @echo local_lib_feat: $(local_lib_feat) - @echo 'Built $(lwext4_c_lib) for lwext4' - -ax_libc_header := $(local_inc_dir)/ax_pthread_mutex.h -gen_libc_header: -ifeq ($(wildcard $(ax_libc_header)),) - @echo Generating libc header - @echo "typedef struct { long __l[1]; } pthread_mutex_t;\n#define PTHREAD_MUTEX_INITIALIZER { .__l = {0}}" > $(ax_libc_header) -#@cargo build --target $(TARGET) --manifest-path $(local_ulib_dir)/Cargo.toml $(build_args-$(MODE)) --features fs -endif - -disk_image_ext4 := $(CURDIR)/disk-ext4.img -make_disk_image_ext4: -ifeq ($(wildcard $(disk_image_ext4)),) - @printf "Creating EXT4 disk image \"$(disk_image_ext4)\" ...\n" - @dd if=/dev/zero of=$(disk_image_ext4) bs=1M count=128 - @mkfs.ext4 -t ext4 $(disk_image_ext4) - @ln -s $(disk_image_ext4) $(CURDIR)/disk.img -else - @printf "EXT4 disk image \"$(disk_image_ext4)\" exist\n" -endif - -.PHONY: _check_lw_need_rebuild lwext4_libc