Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev \
gawk build-essential bison flex texinfo gperf libtool patchutils bc \
zlib1g-dev libexpat1-dev pkg-config libglib2.0-dev libpixman-1-dev libsdl2-dev libslirp-dev \
python3 python3-pip ninja-build
python3 python3-pip ninja-build e2fsprogs

- name: 📥 Cache QEMU Build and Installation
uses: actions/cache@v4
Expand Down
100 changes: 0 additions & 100 deletions data/iperf_testcode_comix.sh

This file was deleted.

30 changes: 0 additions & 30 deletions data/netperf_testcode.sh

This file was deleted.

Binary file removed data/risc-v_musl/bin/iperf3
Binary file not shown.
Binary file removed data/risc-v_musl/bin/netperf
Binary file not shown.
Binary file removed data/risc-v_musl/bin/netserver
Binary file not shown.
42 changes: 0 additions & 42 deletions data/risc-v_musl/iperf_testcode.sh

This file was deleted.

Empty file removed data/tmp/.gitkeep
Empty file.
15 changes: 9 additions & 6 deletions os/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ fn main() {

if force_rebuild || should_rebuild(&fs_img_path, &dependencies) {
println!(
"cargo:warning=[build.rs] Creating full ext4 runtime image (4GB) at fs.img..."
"cargo:warning=[build.rs] Creating full ext4 runtime image at {}...",
fs_img_name
);
create_full_ext4_image(&fs_img_path, &data_dir, &project_root);
let _ = fs::write(&arch_stamp, format!("{}\n", arch_key));
Expand Down Expand Up @@ -251,11 +252,11 @@ fn create_empty_ext4_image(path: &PathBuf, size_mb: usize) {

/// 创建完整的 ext4 镜像 (包含 data/)
fn create_full_ext4_image(path: &PathBuf, data_dir: &Path, _project_root: &Path) {
const IMG_SIZE_MB: usize = 4096; // 4GB
const IMG_SIZE_MB: usize = 512; // 512MB

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

为了提高代码的可维护性和一致性,建议将 IMG_SIZE_MB 常量移至模块级别(例如,在 main 函数之前)。

当前,该常量仅在 create_full_ext4_image 函数内部可见。但在 main 函数的第 101 行,有一个硬编码的日志消息 Creating full ext4 runtime image (4GB) at fs.img...,它与镜像大小的实际变化(512MB)不一致。

将此常量提升到模块作用域,可以让调用方(main 函数)也使用它,从而确保日志信息与实际配置同步,避免将来出现类似的不一致问题。

const BLOCK_SIZE: usize = 1024 * 1024;

println!(
"cargo:warning=[build.rs] Creating {}MB (4GB) full ext4 image at {}",
"cargo:warning=[build.rs] Creating {}MB full ext4 image at {}",
IMG_SIZE_MB,
path.display()
);
Expand Down Expand Up @@ -299,11 +300,13 @@ fn create_full_ext4_image(path: &PathBuf, data_dir: &Path, _project_root: &Path)
.arg("4096")
.arg("-m")
.arg("0")
.arg("-g")
.arg("512") // 每组 512 块 (2MB),确保生成多个块组以避免 ext4_rs bug
.arg("-N")
.arg("65536") // 显式指定 inode 数量,避免小镜像 inode 不足
.arg("-d")
.arg(&temp_root) // 使用临时目录作为根
.arg(path)
.stdout(std::process::Stdio::null())
.stderr(std::process::Stdio::null())
.status()
.expect("Failed to execute mkfs.ext4");

Expand All @@ -314,7 +317,7 @@ fn create_full_ext4_image(path: &PathBuf, data_dir: &Path, _project_root: &Path)
// 5. 清理临时目录
fs::remove_dir_all(&temp_root).ok();

println!("cargo:warning=[build.rs] Full ext4 image created successfully (1GB).");
println!("cargo:warning=[build.rs] Full ext4 image created successfully ({}MB).", IMG_SIZE_MB);
}

/// 递归复制目录
Expand Down
Loading