Adds justfile to build everything

This commit is contained in:
2026-02-13 23:20:36 +01:00
parent 27a3847c13
commit 00d9ce656c
17 changed files with 36 additions and 21 deletions

View File

@@ -6,4 +6,4 @@ build-std = ["core", "compiler_builtins", "alloc"]
build-std-features = ["compiler-builtins-mem"]
[target.riscv64]
runner = "qemu-system-riscv64 -machine virt -device bochs-display -bios none -m 512M -device loader,file=/home/julien/ensimag/TPs/kernel/disk.img,addr=0x90000000 -s -S -kernel"
runner = "qemu-system-riscv64 -machine virt -device bochs-display -bios none -m 512M -device loader,file=/home/julien/ensimag/TPs/kernel/disk.img,addr=0x90000000 -kernel"

4
.gitignore vendored
View File

@@ -1,7 +1,7 @@
.helix
**/target
Cargo.lock
**/Cargo.lock
disk.img
out.mem
**/*.mem

View File

@@ -1,6 +1,8 @@
cargo-features = ["profile-rustflags"]
[workspace]
resolver = "3"
members = ["kernel", "test_pic"]
members = ["kernel", "user/*"]
default-members = ["kernel"]
[profile.dev]

View File

@@ -1,3 +0,0 @@
#![no_std]
const MAGIC_NUMBER: usize = 0xBFF5;

3
crates/bffs/src/lib.rs Normal file
View File

@@ -0,0 +1,3 @@
#![no_std]
// const MAGIC_NUMBER: usize = 0xBFF5;

20
justfile Normal file
View File

@@ -0,0 +1,20 @@
release := ""
cargo_flags := if release != "" { "--release" } else { "" }
default: run
build_user_prog prog:
cd {{ "user" / prog }} && \
RUSTFLAGS="-C relocation-model=pic" cargo b {{ cargo_flags }}
riscv64-elf-objcopy -O binary {{ "target/riscv64/debug" / prog }} {{ "user" / prog / prog + ".mem" }}
build: (map_dir "user" "build_user_prog")
cargo b {{ cargo_flags }}
run: build
cargo r {{ cargo_flags }} --bin kernel-rust
map_dir dir recipe:
@for file in `ls {{ dir }}`; do \
just cargo_flags={{ cargo_flags }} {{ recipe }} $file ; \
done

View File

@@ -5,7 +5,7 @@ edition = "2024"
[dependencies]
embedded-alloc = "0.7"
kernel-macros = { path = "../kernel-macros" }
kernel-macros = { path = "../crates/kernel-macros" }
log = "0.4"
critical-section = { version = "1", features = ["restore-state-bool"] }
bffs = { path = "../bffs" }
bffs = { path = "../crates/bffs" }

View File

@@ -53,7 +53,6 @@ pub extern "C" fn supervisor_mode_entry() {
init_log().unwrap();
Vga::init();
scheduler_init();
// enable_supervisor_interrupt();
}
info!("Hello World !");
@@ -62,7 +61,7 @@ pub extern "C" fn supervisor_mode_entry() {
create_process(test, "proc1");
create_process(proc2, "proc2");
// MemoryDisk::new();
MemoryDisk::test();
enable_supervisor_interrupt();
idle();

View File

@@ -2,12 +2,11 @@ use core::str;
use log::info;
const DISK_ADDR: usize = 0x9000_0000;
const DISK_SIZE: usize = 16 * 1024 * 1024; // 16MB
pub struct MemoryDisk {}
impl MemoryDisk {
pub fn new() {
pub fn test() {
let test = unsafe { str::from_raw_parts(DISK_ADDR as *const u8, 13) };
info!("{}", test);
}

View File

@@ -1,13 +1,11 @@
use core::{arch::asm, time::Duration};
use log::info;
use core::time::Duration;
use crate::syscall::{sleep, write_int_temp, write_string_temp};
#[repr(align(32))]
struct Alignement([u8; 132]);
struct Alignement([u8; 136]);
static PROG: Alignement = Alignement(*include_bytes!("../../out.mem"));
static PROG: Alignement = Alignement(*include_bytes!("../../user/test_pic/test_pic.mem"));
pub fn test() {
write_int_temp(PROG.0.as_ptr() as u64);

View File

@@ -1,8 +1,6 @@
#![no_std]
#![no_main]
use core::arch::global_asm;
#[panic_handler]
fn panic(_panic_info: &core::panic::PanicInfo) -> ! {
loop {}
@@ -20,5 +18,4 @@ pub extern "C" fn entry() {
clobber_abi("system")
);
}
loop {}
}