Compare commits

...

4 commits

8 changed files with 127 additions and 43 deletions

View file

@ -1,2 +1,3 @@
[alias]
repbuild = "run --manifest-path ./repbuild/Cargo.toml -r --"
dev = "run --manifest-path ./dev/Cargo.toml -r --"

4
Cargo.lock generated
View file

@ -245,6 +245,10 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "dev"
version = "0.1.0"
[[package]]
name = "embedded-graphics"
version = "0.7.1"

View file

@ -1,3 +1,3 @@
[workspace]
resolver = "2"
members = ["kernel", "repbuild"]
members = [ "dev","kernel", "repbuild"]

View file

@ -1,6 +1,8 @@
# AbleOS
An UNIX-unlike micro-kernel written in rust with an embedded bytecode virtual machine.
Please note that a custom target directory is not supported and support will not be added.
# Community
[Discord](https://discord.gg/JrKVukDtgs)
@ -14,5 +16,9 @@ AbleOS should be able to be built on any platform which is supported by
For running AbleOS, `repbuild` uses QEMU.
## Steps
1. `git submodule update --init`
2. `cargo repbuild`
1. Ensure you have qemu installed
2. `git submodule update --init`
3. `cargo repbuild run`
# Developing
There is a new work in progress developer tool for hblang.

6
dev/Cargo.toml Normal file
View file

@ -0,0 +1,6 @@
[package]
name = "dev"
version = "0.1.0"
edition = "2021"
[dependencies]

6
dev/README.md Normal file
View file

@ -0,0 +1,6 @@
# dev
`dev` is an ableOS specific tool meant to help the development of ableOS.
At the current stage changes are not welcome. If you have feature suggestions ping me on discord `@abletheabove`.
Run `cargo dev help` to see usage.

101
dev/src/main.rs Normal file
View file

@ -0,0 +1,101 @@
use std::{fmt::format, io::Write};
pub enum Options {
Build,
Clean,
New,
Run,
}
fn main() {
let mut args: Vec<String> = std::env::args().collect();
args.remove(0);
args.reverse();
let binding = args.pop().unwrap_or("help".to_string());
let subcommand = binding.as_str();
match subcommand {
"build" => {
let name = &args[1];
build(name.to_string())
}
"new" => {
let binding = args.pop().unwrap();
let dev_type = binding.as_str();
let name = args.pop().unwrap();
match dev_type {
"lib" | "library" => new(true, name),
"prog" | "program" => new(false, name),
_ => {}
};
}
"run" => run(),
"help" => {
// println!("This is the help message.");
// println!("A prototype build tool meant to help with ableOS software development.");
help()
}
_ => {
println!("Error");
}
}
}
pub fn new(library: bool, name: String) {
let (folder_hierarchy, entry_name) = match library {
true => ("libraries", "lib.hb"),
false => ("programs", "main.hb"),
};
let project_folder_path_string = format!("sysdata/{folder_hierarchy}/{name}");
if std::path::Path::new(&project_folder_path_string).exists() {
panic!("Project already exists.")
}
std::fs::create_dir(project_folder_path_string.clone()).unwrap();
let readme_path_string = format!("{}/README.md", project_folder_path_string);
let mut readme_file = std::fs::File::create(readme_path_string.clone()).unwrap();
let readme_contents = format!("# {}", name);
readme_file.write_all(readme_contents.as_bytes()).unwrap();
let src_folder_path_string = format!("{}/src", project_folder_path_string);
std::fs::create_dir(src_folder_path_string.clone()).unwrap();
let full_path_string = format!("{src_folder_path_string}/{entry_name}");
let mut file = std::fs::File::create(full_path_string.clone()).unwrap();
let file_contents = if library {
""
} else {
"main := fn(): int {
return 0
}"
}
.to_string();
file.write_all(file_contents.as_bytes()).unwrap();
println!("New project created.");
if !library {
println!("You should add your project into the ableOS system configuration in sysdata/system_config.toml")
}
}
fn run() {
println!("Running is not supported on a non-ableOS platform");
}
fn build(name: String) {
println!("building {}", name);
}
fn help() {
println!(
"==========
= Help =
==========
Subcommands
- new Usage: `cargo dev new library name` or `cargo dev new program name`"
)
}

View file

@ -1,40 +0,0 @@
${ABLEOS_KERNEL}=boot:///kernel
# TODO: Make a boot background image for ableOS
DEFAULT_ENTRY=1
TIMEOUT=0
VERBOSE=yes
INTERFACE_RESOLUTION=1024x768
# Terminal related settings
TERM_WALLPAPER=boot:///background.bmp
TERM_BACKDROP=008080
:AbleOS
COMMENT=Default AbleOS boot entry.
PROTOCOL=limine
KERNEL_PATH=boot:///kernel_${ARCH}
# execute is an array of boot modules to execute
KERNEL_CMDLINE=""
# Setting a default resolution for the framebuffer
RESOLUTION=1024x768x24
MODULE_PATH=boot:///failure.hbf
MODULE_CMDLINE=""
MODULE_PATH=boot:///ecall.hbf
MODULE_CMDLINE=""
MODULE_PATH=boot:///main.hbf
MODULE_CMDLINE=""
MODULE_PATH=boot:///keyboard_driver.hbf
MODULE_CMDLINE="arch=${ARCH}"
MODULE_PATH=boot:///vfs_test.hbf
MODULE_CMDLINE=""
MODULE_PATH=boot:///limine_framebuffer_driver.hbf
MODULE_CMDLINE="height=10 width=10 arch=${ARCH}"
MODULE_PATH=boot:///serial_driver.hbf
MODULE_CMDLINE="arch=${ARCH}"