Merge pull request 'Refactored project structure to make it more clean.' (#11) from struct-refactor into master

Reviewed-on: #11
pull/12/head
Erin 2023-11-11 15:12:02 +00:00
commit 3d0dcc78d6
21 changed files with 78 additions and 98 deletions

View File

@ -1,47 +1,15 @@
```
TODO
- Build out the object system
- Build or Find an acceptable IDL
Short List of potentials
- [comline](https://git.ablecorp.us/DOOME1M8Cover/comline)
- Work on a styleguide for commits
Maybe something allong the lines of
[relevant shorthand note] Explination
- Language support on HBVM
- HBVM assembler (with IDL support)
- HBVM Lisp/s-expr Compiler (Also (with (IDL (support))))
- Documentation
- Drivers
- serial driver
- PS/2 mouse driver
- PS/2 Keyboard driver
- VGA driver
- SVGA driver
- File system
- Depends on Disk driver
- TarFS
Pass in a tar file as an initrd and parse it with TarFS
- VFS
Being (written)[https://git.ablecorp.us/bee/ableos-vfs] by Bee
- Disk driver
- IDE Driver
- ATA Driver
- Floppy Driver
- A ton more
- Port (Slint)[https://slint.dev]
- Depends on
- Graphics Driver
```
# AbleOS
An UNIX-unlike micro-kernel written in rust with an embedded bytecode virtual machine.
# Community
[Discord](https://discord.gg/JrKVukDtgs)
# Compiling
Firstly, I would like to apologize. I am not capable of supporting building on any random machine with any random operating system.
AbleOS should be able to be built on any platform which is supported by
[Rustc Tier 1 platform support](https://doc.rust-lang.org/nightly/rustc/platform-support.html#tier-1-with-host-tools).
AbleOS very likely builds with `nix-shell` on your operating system.
For running AbleOS, `repbuild` uses QEMU.
## Steps
1. `git submodule update --init`
1. `cargo repbuild`
2. `cargo repbuild`

11
arm.sh
View File

@ -1,11 +0,0 @@
qemu-system-aarch64 -m 1024 -cpu cortex-a57 \
-M virt -pflash "AAVMF_CODE.fd" \
-device virtio-gpu-pci \
-device virtio-mouse-device \
-device virtio-keyboard-device \
-kernel limine/BOOTX64.EFI
# -device virtio-serial-pci \
# -drive if=none,file=target/disk.img,id=hd0 \
# -device virtio-blk-device,drive=hd0
# -kernel target/aarch64-virt-ableos/debug/kernel

View File

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

32
contrib/TODO.md Normal file
View File

@ -0,0 +1,32 @@
# TODO
- Build out the object system
- Build or Find an acceptable IDL
Short List of potentials
- [comline](https://git.ablecorp.us/DOOME1M8Cover/comline)
- Work on a styleguide for commits
Maybe something allong the lines of
[relevant shorthand note] Explination
- Language support on HBVM
- HBVM assembler (with IDL support)
- HBVM Lisp/s-expr Compiler (Also (with (IDL (support))))
- Documentation
- Drivers
- serial driver
- PS/2 mouse driver
- PS/2 Keyboard driver
- VGA driver
- SVGA driver
- File system
- Depends on Disk driver
- TarFS
Pass in a tar file as an initrd and parse it with TarFS
- VFS
Being (written)[https://git.ablecorp.us/bee/ableos-vfs] by Bee
- Disk driver
- IDE Driver
- ATA Driver
- Floppy Driver
- A ton more
- Port (Slint)[https://slint.dev]
- Depends on
- Graphics Driver

View File

@ -1,8 +1,6 @@
use error_stack::Report;
use {
derive_more::Display,
error_stack::{bail, report, Context, Result, ResultExt},
error_stack::{bail, report, Context, Report, Result, ResultExt},
fatfs::{FileSystem, FormatVolumeOptions, FsOptions, ReadWriteSeek},
std::{fmt::Display, fs::File, io, path::Path, process::Command},
};
@ -75,17 +73,26 @@ fn main() -> Result<(), Error> {
}
fn assemble() -> Result<(), Error> {
match std::fs::create_dir("target/holeybytes") {
match std::fs::create_dir("target/test-programs") {
Ok(_) => (),
Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => (),
Err(e) => return Err(Report::new(e).change_context(Error::Io)),
}
for entry in std::fs::read_dir("repbuild/holeybytes")
for entry in std::fs::read_dir("sysdata/test-programs")
.map_err(Report::from)
.change_context(Error::Io)?
{
let entry = entry.map_err(Report::from).change_context(Error::Io)?;
if !entry
.file_type()
.map_err(Report::from)
.change_context(Error::Io)?
.is_file()
{
continue;
}
let name = entry.file_name();
let name = name.to_string_lossy();
let name = name.trim_end_matches(".rhai");
@ -93,7 +100,7 @@ fn assemble() -> Result<(), Error> {
let mut out = File::options()
.write(true)
.create(true)
.open(Path::new("target/holeybytes").join(format!("{name}.hbf")))
.open(Path::new("target/test-programs").join(format!("{name}.hbf")))
.map_err(Report::from)
.change_context(Error::Io)?;
@ -125,7 +132,7 @@ fn get_fs() -> Result<FileSystem<impl ReadWriteSeek>, io::Error> {
io::copy(
&mut File::open("limine/BOOTX64.EFI")
.map_err(Report::from)
.attach_printable("copying Limine bootloader (have you pulled the submodule?)")?,
.attach_printable("Copying Limine (x86_64): have you pulled the submodule?")?,
&mut bootdir.create_file("bootx64.efi")?,
)?;
@ -133,43 +140,28 @@ fn get_fs() -> Result<FileSystem<impl ReadWriteSeek>, io::Error> {
&mut File::open("limine/BOOTAA64.EFI")
.map_err(Report::from)
.attach_printable(
"copying Limine bootloader arm version (have you pulled the submodule?)",
"Copying Limine (ARM): have you pulled the submodule?",
)?,
&mut bootdir.create_file("bootaa64.efi")?,
)?;
io::copy(
&mut File::open("repbuild/limine.cfg")?,
&mut fs.root_dir().create_file("limine.cfg")?,
)?;
io::copy(
&mut File::open("repbuild/background.bmp")?,
&mut fs.root_dir().create_file("background.bmp")?,
)?;
io::copy(
&mut File::open("target/holeybytes/failure.hbf")?,
&mut fs.root_dir().create_file("failure.hbf")?,
)?;
io::copy(
&mut File::open("target/holeybytes/ecall.hbf")?,
&mut fs.root_dir().create_file("ecall.hbf")?,
)?;
io::copy(
&mut File::open("target/holeybytes/main.hbf")?,
&mut fs.root_dir().create_file("main.hbf")?,
)?;
io::copy(
&mut File::open("target/holeybytes/vfs_test.hbf")?,
&mut fs.root_dir().create_file("vfs_test.hbf")?,
)?;
io::copy(
&mut File::open("target/holeybytes/limine_framebuffer_driver.hbf")?,
&mut fs.root_dir().create_file("limine_framebuffer_driver.hbf")?,
)?;
for fpath in [
"sysdata/limine.cfg",
"sysdata/background.bmp",
"target/test-programs/failure.hbf",
"target/test-programs/ecall.hbf",
"target/test-programs/main.hbf",
"target/test-programs/vfs_test.hbf",
"target/test-programs/limine_framebuffer_driver.hbf",
] {
let path = Path::new(fpath);
io::copy(
&mut File::open(path)?,
&mut fs
.root_dir()
.create_file(&path.file_name().unwrap().to_string_lossy())?,
)?;
}
drop(bootdir);
Ok(fs)

View File

@ -1,3 +1,3 @@
[toolchain]
channel = "nightly"
channel = "nightly"
components = ["rust-src", "llvm-tools"]

View File

@ -1,3 +1,3 @@
hex_literal_case = "Upper"
imports_granularity = "One"
hex_literal_case = "Upper"
imports_granularity = "One"
struct_field_align_threshold = 5

View File

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

View File

@ -2,7 +2,7 @@
// The STD and even syscalls are still in flux.
// Do your best to avoid adding bad design.
// Use std abstractions if they exist like logging functionality
import "repbuild/hblib/std" as std;
import "sysdata/test-programs/hblib/std" as std;
// Define main
fn main(){

View File

@ -1,4 +1,4 @@
import "repbuild/hblib/std" as std;
import "sysdata/test-programs/hblib/std" as std;
fn main(){
std::Error(":+)");

View File

@ -1,6 +1,5 @@
/// Act as a shim of a virtual file system that recieves one message from buffer 2
import "repbuild/hblib/std" as std;
import "sysdata/test-programs/hblib/std" as std;
fn main() {

View File

@ -1,4 +1,4 @@
import "repbuild/hblib/std" as std;
import "sysdata/test-programs/hblib/std" as std;
fn main(){
std::Info("Trying to open a file.");