moros/src/main.rs

31 lines
790 B
Rust
Raw Normal View History

2019-12-28 17:08:11 +00:00
#![no_std]
#![no_main]
2019-12-31 13:06:15 +00:00
use bootloader::{entry_point, BootInfo};
use core::panic::PanicInfo;
2019-12-31 17:16:52 +00:00
use moros::{print, user, kernel};
2019-12-28 17:08:11 +00:00
2019-12-31 13:06:15 +00:00
entry_point!(main);
fn main(_boot_info: &'static BootInfo) -> ! {
2019-12-28 17:08:11 +00:00
moros::init();
2020-01-01 08:55:33 +00:00
include_file("/cfg/boot.sh", include_str!("../dsk/cfg/boot.sh"));
include_file("/cfg/banner.txt", include_str!("../dsk/cfg/banner.txt"));
2020-01-03 21:01:48 +00:00
include_file("/cfg/passwords.csv", include_str!("../dsk/cfg/passwords.csv"));
2019-12-31 22:04:10 +00:00
loop {
2020-01-01 08:55:33 +00:00
user::shell::main(&["shell", "/cfg/boot.sh"]);
}
}
fn include_file(pathname: &str, contents: &str) {
if let Some(mut file) = kernel::fs::File::create(pathname) {
file.write(contents);
2019-12-31 22:04:10 +00:00
}
2019-12-28 17:08:11 +00:00
}
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
print!("{}\n", info);
2019-12-31 17:16:52 +00:00
loop { kernel::sleep::sleep(10.0) }
}