1
0
Fork 0
forked from koniifer/ableos

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

Reviewed-on: https://git.ablecorp.us/AbleOS/ableos/pulls/11
This commit is contained in:
Erin 2023-11-11 15:12:02 +00:00
commit f2e561e242
21 changed files with 78 additions and 98 deletions

View file

@ -1,47 +1,15 @@
``` # AbleOS
TODO An UNIX-unlike micro-kernel written in rust with an embedded bytecode virtual machine.
- 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
```
# Community # Community
[Discord](https://discord.gg/JrKVukDtgs) [Discord](https://discord.gg/JrKVukDtgs)
# Compiling # 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. `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 { use {
derive_more::Display, derive_more::Display,
error_stack::{bail, report, Context, Result, ResultExt}, error_stack::{bail, report, Context, Report, Result, ResultExt},
fatfs::{FileSystem, FormatVolumeOptions, FsOptions, ReadWriteSeek}, fatfs::{FileSystem, FormatVolumeOptions, FsOptions, ReadWriteSeek},
std::{fmt::Display, fs::File, io, path::Path, process::Command}, std::{fmt::Display, fs::File, io, path::Path, process::Command},
}; };
@ -75,17 +73,26 @@ fn main() -> Result<(), Error> {
} }
fn assemble() -> Result<(), Error> { fn assemble() -> Result<(), Error> {
match std::fs::create_dir("target/holeybytes") { match std::fs::create_dir("target/test-programs") {
Ok(_) => (), Ok(_) => (),
Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => (), Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => (),
Err(e) => return Err(Report::new(e).change_context(Error::Io)), 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) .map_err(Report::from)
.change_context(Error::Io)? .change_context(Error::Io)?
{ {
let entry = entry.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 = entry.file_name();
let name = name.to_string_lossy(); let name = name.to_string_lossy();
let name = name.trim_end_matches(".rhai"); let name = name.trim_end_matches(".rhai");
@ -93,7 +100,7 @@ fn assemble() -> Result<(), Error> {
let mut out = File::options() let mut out = File::options()
.write(true) .write(true)
.create(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) .map_err(Report::from)
.change_context(Error::Io)?; .change_context(Error::Io)?;
@ -125,7 +132,7 @@ fn get_fs() -> Result<FileSystem<impl ReadWriteSeek>, io::Error> {
io::copy( io::copy(
&mut File::open("limine/BOOTX64.EFI") &mut File::open("limine/BOOTX64.EFI")
.map_err(Report::from) .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")?, &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") &mut File::open("limine/BOOTAA64.EFI")
.map_err(Report::from) .map_err(Report::from)
.attach_printable( .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")?, &mut bootdir.create_file("bootaa64.efi")?,
)?; )?;
io::copy( for fpath in [
&mut File::open("repbuild/limine.cfg")?, "sysdata/limine.cfg",
&mut fs.root_dir().create_file("limine.cfg")?, "sysdata/background.bmp",
)?; "target/test-programs/failure.hbf",
"target/test-programs/ecall.hbf",
io::copy( "target/test-programs/main.hbf",
&mut File::open("repbuild/background.bmp")?, "target/test-programs/vfs_test.hbf",
&mut fs.root_dir().create_file("background.bmp")?, "target/test-programs/limine_framebuffer_driver.hbf",
)?; ] {
io::copy( let path = Path::new(fpath);
&mut File::open("target/holeybytes/failure.hbf")?, io::copy(
&mut fs.root_dir().create_file("failure.hbf")?, &mut File::open(path)?,
)?; &mut fs
.root_dir()
io::copy( .create_file(&path.file_name().unwrap().to_string_lossy())?,
&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")?,
)?;
drop(bootdir); drop(bootdir);
Ok(fs) Ok(fs)

View file

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

View file

@ -1,3 +1,3 @@
hex_literal_case = "Upper" hex_literal_case = "Upper"
imports_granularity = "One" imports_granularity = "One"
struct_field_align_threshold = 5 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. // The STD and even syscalls are still in flux.
// Do your best to avoid adding bad design. // Do your best to avoid adding bad design.
// Use std abstractions if they exist like logging functionality // 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 // Define main
fn 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(){ fn main(){
std::Error(":+)"); std::Error(":+)");

View file

@ -1,6 +1,5 @@
/// Act as a shim of a virtual file system that recieves one message from buffer 2 /// 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() { fn main() {

View file

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