From 4dd3699e0ea62c4228ff3c46941c9d8aa64c2218 Mon Sep 17 00:00:00 2001
From: able <abl3theabove@gmail.com>
Date: Thu, 13 Jul 2023 22:41:09 -0500
Subject: [PATCH] frowny

---
 MANIFESTO.md                            | 68 -------------------------
 README.md                               |  8 +++
 kernel/src/arch/aarch64/mod.rs          |  5 +-
 kernel/targets/aarch64-virt-ableos.json | 25 +++++++++
 meta.md                                 | 51 -------------------
 repbuild/src/main.rs                    | 18 +++++++
 6 files changed, 55 insertions(+), 120 deletions(-)
 delete mode 100644 MANIFESTO.md
 create mode 100644 kernel/targets/aarch64-virt-ableos.json
 delete mode 100644 meta.md

diff --git a/MANIFESTO.md b/MANIFESTO.md
deleted file mode 100644
index c34e3b4..0000000
--- a/MANIFESTO.md
+++ /dev/null
@@ -1,68 +0,0 @@
-# The Design of AbleOS
-## The unix philosophy and why it shouldn't exist
-small is only beautiful if its complete.
-    grep for example supports the `-r` flag which should instead be `grep`+`find`
-Everything is not a stream of bytes.
-
-programs can do multiple things well
-    `cat`, `head` and `tail` could all be one program with a flag
-    `which head` `which tail` `which cat` should all return the same binary with different flags
-    ```
-    which head == /bin/cat range=0-10
-
-    which tail == /bin/cat reverse_index=true range=0-10
-
-    which cat == /bin/cat
-    ```
-
-build a prototype quickly only applies if you are being pressured. do thing quickly then refine 
-'choose portability over effeciency' this is a flawed idealogy choose modularity over pure portability
-'store data in flat text files' this leads to a psuedostandardization on KVPair configuration languages that all sit in a flat text file. Instead pick a configuration format that gets loaded into a tree structure
-
-## File Systems
-### The amount of files inside of a folder
-32765. Why you might ask?
-### Dot files
-`dotfiles` were a mistake given to us by bad programmers mocking better programmers. [link](https://web.archive.org/web/20230413171520/http://xahlee.info/UnixResource_dir/writ/unix_origin_of_dot_filename.html)
-
-### File name case sensitivity
-Case sensitivity seems like a great idea! But in practice leads to the following filetree
-```
-/kernel
-/Kernel
-/kErnEl
-/KeRnEl
-```
-which is a nightmare and you should be erradicated if you think this is a positive
-provide a display name for files that allows case and save the file as caseless
-
-### File name character limits
-unix is a plauge upon this earth. name a file `:(){ :|:& };:` and try listing it. You have lost access to your terminal.
-if you defined a sane method of listing files and allowing programs to provide the OS a standard method of providing argument suggestions and being aware you would never run into this issue
-
-## CLI vs GUI
-Graphics are not your enemy unix lovers. You mustn't be stuck in 1981. Times have changed! You can have a graphical shell enviroment. SGI Irix was aware of this in 1988, not perfect of course but 7 years after dos is an impressive leap.
-FFMPEG??? Why no gui? Give me a good git ui
-
-
-### Emails plain text
-Unix believes in plain text emails. Quotes are `>`
-
-### Unix Wizards and Instability
-[Do not meddle in the affairs of Unix, for it is subtle and quick to anger.]
-
-### Unix why are your mouse a file?
-This list is incomplete
-`/dev/input/event1` The PS2 Mouse
-`/dev/input/event3` The USB Mouse
-`/dev/input/psaux` The PS2 Mouse
-`/dev/input/psmouse` The PS2 Mouse
-`/dev/input/mice` The Not(?) PS2 Mouse I think?
-`/dev/input/mouse0` The not Not(?) ps2 mouse? First usb mouse I think?
-`/dev/input/usbhid` USB mice (should be autodetected)
-`/dev/input/sermouse` Most serial mice
-`/dev/input/logibm` Bus mouse connected to Logitech adapter card
-`/dev/input/inport` Bus mouse connected to ATI or Microsoft InPort card
-`/dev/input/by-id/usb-<usbid here>` A usb mouse via its id
-
-I propose a unified system for input via a Device Tree of sorts
\ No newline at end of file
diff --git a/README.md b/README.md
index 3cabc8e..e8c6016 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,4 @@
+```
 TODO
     - Integrate HBVM
         HBVM also needs full spec compliance
@@ -23,10 +24,17 @@ TODO
         - VFS
         - Disk driver
         - A ton more
+```
 
 # 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 very likely builds with `nix-shell` on your operating system.
+
 1. `git submodule update --init`
 1. `cargo repbuild`
diff --git a/kernel/src/arch/aarch64/mod.rs b/kernel/src/arch/aarch64/mod.rs
index cfeed09..68328c1 100644
--- a/kernel/src/arch/aarch64/mod.rs
+++ b/kernel/src/arch/aarch64/mod.rs
@@ -1 +1,4 @@
-//! 
\ No newline at end of file
+//!
+
+#[no_mangle]
+unsafe extern "C" fn _kernel_start() -> ! {}
diff --git a/kernel/targets/aarch64-virt-ableos.json b/kernel/targets/aarch64-virt-ableos.json
new file mode 100644
index 0000000..dfb116a
--- /dev/null
+++ b/kernel/targets/aarch64-virt-ableos.json
@@ -0,0 +1,25 @@
+{
+    "arch": "aarch64",
+    "data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128",
+    "disable-redzone": true,
+    "env": "",
+    "executables": true,
+    "features": "+strict-align,+neon,+fp-armv8",
+    "linker": "rust-lld",
+    "linker-flavor": "ld.lld",
+    "linker-is-gnu": true,
+    "pre-link-args": {
+        "ld.lld": [
+            "-Taarch64-qemu.ld"
+        ]
+    },
+    "llvm-target": "aarch64-unknown-none",
+    "max-atomic-width": 128,
+    "os": "none",
+    "panic-strategy": "abort",
+    "relocation-model": "static",
+    "target-c-int-width": "32",
+    "target-endian": "little",
+    "target-pointer-width": "64",
+    "vendor": ""
+}
\ No newline at end of file
diff --git a/meta.md b/meta.md
deleted file mode 100644
index c9e2b7d..0000000
--- a/meta.md
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-
-ARI AbleOS Remote Install
-
-Server
-/boot/server_kernel_x86_64.bin
-/boot/kernel_x86_64.bin
-/boot/kernel_aarch64.bin
-
-/home/projects/askl.askl - aksldfhlkasjdhflkajshdflkj
-
-
-ARI_SERVER.wasm
-NAS 10.1.10.10
-
-ARI 10.1.10.10
-/boot/limine.cfg
-/boot/kernel_x86_64.bin
-/boot/kernel.toml
-/home/projects/askl.askl
-aksldfhlkasjdhflkajshdflkj
-
-
-ARI 10.1.10.10
-/boot/limine.cfg
-/boot/kernel_aarch64.bin
-/boot/kernel.toml
-
-
-
-/system/
-/shared/
-/home/programs/
-                project_name/
-                    project_name.wasm
-                    project_name.toml
-
-
-
-
-/system/pkgman.toml
-
-//////
-[repositories]
-PUR = "https://git.ablecorp.us/ableos/pur"
-
diff --git a/repbuild/src/main.rs b/repbuild/src/main.rs
index b5da26b..0af1659 100644
--- a/repbuild/src/main.rs
+++ b/repbuild/src/main.rs
@@ -35,6 +35,9 @@ fn main() -> Result<(), Error> {
                 if arg == "rv64" || arg == "riscv64" || arg == "riscv64-virt" {
                     target = Target::Riscv64Virt;
                 }
+                if arg == "aarch" || arg == "arm64" {
+                    target = Target::Aarch64;
+                }
             }
 
             build(release, target).change_context(Error::Build)
@@ -49,6 +52,9 @@ fn main() -> Result<(), Error> {
                 if arg == "rv64" || arg == "riscv64" || arg == "riscv64-virt" {
                     target = Target::Riscv64Virt;
                 }
+                if arg == "arm64" || arg == "aarch64" {
+                    target = Target::Aarch64;
+                }
             }
 
             build(release, target)?;
@@ -138,6 +144,9 @@ fn build(release: bool, target: Target) -> Result<(), Error> {
     if target == Target::Riscv64Virt {
         com.args(["--target", "targets/riscv64-virt-ableos.json"]);
     }
+    if target == Target::Aarch64 {
+        com.args(["--target", "targets/aarch64-virt-ableos.json"]);
+    }
 
     match com.status() {
         Ok(s) if s.code() != Some(0) => bail!(Error::Build),
@@ -168,6 +177,7 @@ fn run(release: bool, target: Target) -> Result<(), Error> {
     let mut com = match target {
         Target::X86_64 => Command::new("qemu-system-x86_64"),
         Target::Riscv64Virt => Command::new("qemu-system-riscv64"),
+        Target::Aarch64 => Command::new("qemu-system-aarch64"),
     };
 
     if target == Target::X86_64 {
@@ -212,6 +222,13 @@ fn run(release: bool, target: Target) -> Result<(), Error> {
         ]);
     }
 
+    if target == Target::Aarch64 {
+        com.args([
+            "-M", "virt", "-m", //
+            "128M", "-serial", "stdio",
+        ]);
+    }
+
     match com
         .status()
         .into_report()
@@ -306,6 +323,7 @@ impl Context for OvmfFetchError {}
 enum Target {
     X86_64,
     Riscv64Virt,
+    Aarch64,
 }
 
 #[derive(Debug, Display)]