Skip to content

Commit 24b03b4

Browse files
committed
fix: fix mount module
1 parent 8213aa1 commit 24b03b4

File tree

9 files changed

+31
-84
lines changed

9 files changed

+31
-84
lines changed

Cargo.lock

+2-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

byteos.toml

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ run = "make ARCH=x86_64 justrun"
1414
board = "qemu"
1515
driver = "kvirtio,kgoldfish-rtc,ns16550a"
1616

17+
[bin.x86_64-qemu.env]
18+
HEAP_SIZE = "0x0200_0000"
19+
1720
# build for aarch64-qemu
1821
[bin.aarch64-qemu]
1922
target = "aarch64-unknown-none-softfloat"

crates/allocator/Cargo.toml

-12
This file was deleted.

crates/allocator/build.rs

-14
This file was deleted.

crates/allocator/src/lib.rs

-36
This file was deleted.

crates/kramdisk/build.rs

+22
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,35 @@
11
#![feature(lazy_cell)]
22

3+
use std::{env, fs, path::PathBuf};
4+
35
#[allow(unused_macros)]
46
macro_rules! display {
57
($fmt:expr) => (println!("cargo:warning={}", format!($fmt)));
68
($fmt:expr, $($arg:tt)*) => (println!(concat!("cargo:warning=", $fmt), $($arg)*));
79
}
810

911
fn main() {
12+
let out_dir = PathBuf::from(env::var("OUT_DIR").expect("can't find manifest dir"));
13+
let img_path = env::var("MOUNT_IMG_PATH").unwrap_or("mount.img".into());
14+
15+
fs::write(
16+
out_dir.join("inc.S"),
17+
format!(
18+
".section .data
19+
.global ramdisk_start
20+
.global ramdisk_end
21+
.align 16
22+
ramdisk_start:
23+
.incbin \"{img_path}\"
24+
ramdisk_end:"
25+
),
26+
)
27+
.expect("can't write ram file to out_dir");
28+
29+
// fs::write(path, contents)
30+
1031
// write module configuration to OUT_PATH, then it will be included in the main.rs
32+
println!("cargo:rerun-if-env-changed=MOUNT_IMG_PATH");
1133
println!("cargo:rerun-if-changed=mount.img");
1234
println!("cargo:rerun-if-changed=build.rs");
1335
}

crates/kramdisk/src/lib.rs

+1-11
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,7 @@ impl BlkDriver for RamDiskBlock {
6464
}
6565
}
6666

67-
global_asm!(
68-
"
69-
.section .data
70-
.global ramdisk_start
71-
.global ramdisk_end
72-
.align 16
73-
ramdisk_start:
74-
.incbin \"./mount.img\"
75-
ramdisk_end:
76-
"
77-
);
67+
global_asm!(include_str!(concat!(env!("OUT_DIR"), "/inc.S")));
7868

7969
driver_define!({
8070
extern "C" {

kernel/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ serde = "1.0.136"
1313
serde_derive = "1.0.136"
1414

1515
[dependencies]
16-
allocator = { git = "https://github.com/Byte-OS/allocator.git" }
16+
allocator = { git = "https://github.com/Byte-OS/allocator.git", rev = "c6ce949146d5feab1d406502b19b035f5d392c35"}
1717
crate_interface = { git = "https://github.com/Byte-OS/crate_interface.git" }
1818
frame_allocator = { git = "https://github.com/Byte-OS/bit_frame_allocator.git" }
1919
logging = { git = "https://github.com/Byte-OS/logging.git" }

kernel/src/main.rs

+2
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ impl ArchInterface for ArchInterfaceImpl {
162162
fn end();
163163
}
164164

165+
println!("HEAP_SIZE: {:#x}", allocator::HEAP_SIZE);
166+
165167
println!("run kernel @ hart {}", hart_id);
166168

167169
info!("program size: {}KB", (end as usize - start as usize) / 1024);

0 commit comments

Comments
 (0)