Aphrodite

Aphrodite is a kernel and OS, designed to be secure and modern. All official projects(projects created and maintained by the Aphrodite team) that are directly part of the OS are written in Rust, and Rust support is a priority over other languages(however, ideally we will support other languages). The Aphrodite kernel is in the aphrodite-os/kernel repo, and work-in-progress documentation is in aphrodite-os/book.

FAQ

What's the difference between a kernel and an OS?

Sometimes, these terms are interchangeable, however not really ever in free software. In this case the kernel(sometimes in technical docs referred to as the supervisor) manages processes, system calls, coordinates kernel module calls, manages memory, and more. An OS consists of a kernel, a bootloader(sometimes part of the OS or kernel, often not), userspace utilities, init scripts(in the case of aphrodite, an InitEnv configuration, a RamInit script, a DiskInit script, and a SysInit script), userspace utilties, and way more. Something to note is that an OS always includes a kernel and more. Another thing to note for an OS is, as an example, in the case of linux, the most common OS is GNU, which is why a more accurate name is GNU(the OS)/Linux(the kernel). Similarily, the name that will be used by Aphrodite developers for the kernel is Aphrodite or Aphrokern, and for a full OS (OS name)/Aphrodite. As you can see from this, an OS + kernel combination should generally be called (OS name)/(kernel name).

Tl;dr: A kernel is what runs when you boot up and controls the base level of everything, and an OS includes everything else that is necessary to make a kernel operate. The name used by Aphrodite developers for the kernel is either Aphrodite or Aphrokern, and for an OS (OS name)/Aphrodite.

So what really is Aphrodite?

It is the kernel and a software distribution to make the kernel into a full OS. At the moment, only the kernel exists and is being actively worked on.

How can I help?

Contribute to the codebase! At the moment there isn't a roadmap, but contact @AverseABFun(Arthur Beck) for an idea of what to work on! You can contact them at averse.abfun@gmail.com and they should get back to you within a couple of days. If you are an active contributer, you'll be added to the organization(which at the moment doesn't really do anything for you).

Are there teams?

Yes! Currently, as there's only me(Arthur Beck) working on the codebase, there aren't really, but there is the infrastructure in place for teams. These teams are:

  • Documentation team
  • Kernel team

What's the philosophy of Aphrodite?

  • Keep Aphrodite and all official components(projects created and maintained by the Aphrodite team) free software (tl;dr for the link: Free software is software where the users have control to do pretty much whatever they want with it; think of the "free" in "free software" as in "free speech," not as in "free snacks.")
  • Prevent something like what happened to GNU from happening to whatever the main software distribution ends up being.
  • Try to prevent memory safety bugs and other bugs that leak data from ever happening (using Rust helps with this).
  • Prevent relying on archaic behaviour, however support somewhat old computers.
  • NEVER charge money for any official component of Aphrodite.

Philosophy

  • Keep Aphrodite and all official components(projects created and maintained by the Aphrodite team) free software (tl;dr for the link: Free software is software where the users have control to do pretty much whatever they want with it; think of the "free" in "free software" as in "free speech," not as in "free snacks.")
  • Prevent something like what happened to GNU/Linux from happening to whatever the main software distribution ends up being.
  • Try to prevent memory safety bugs and other bugs that leak data from ever happening (using Rust helps with this).
  • Prevent relying on archaic behaviour, however support somewhat old computers.
  • NEVER charge money for any official component of Aphrodite.
  • Rebase, not merge. Merge commits clutter repos; rebasing doesn't.

Goals of Aphrodite

  • Load and run ELF executables
  • Run on many different architectures
  • Fail gently under as many circumstances as possible(i.e. not just crash silently when an issue crops up)
  • Support primitive software multitasking
  • Possible support hardware multitasking
  • Load and unload kernel modules on the fly, similar to linux
  • Use FAT12, FAT32, btrfs, and/or ext4
  • Have everything well documented
  • Have good tests for everything
  • Be written in rust as much as possible
  • Require as few dependencies as possible
  • Build quick. May be sacrificied if necessary.

How to compile the kernel

Prerequisites

  • cargo-binutils
  • Rust 1.86.0-nightly
  • Bochs (I use 2.8, however any relatively new version should work)
  • GRUB (The build script uses grub-install and I use 2:2.12-3, but any version of GRUB 2 should work).

Actually compiling

  1. Set up the config.aphro file in the kernel sub directory(use config.aphro.example as a basis)
  2. Clone the repository
  3. cd into the kernel sub directory of the repository
  4. Run ./build

Emulation

After compiling the kernel, you should be able to simply run ./emulate. You can also run ./build_and_emulate to compile and emulate at once.

Boot process

digraph {
    rankdir = TB;
    nodesep = 0.1;
    size = "8,99";
    layout = dot;

    "Bootloader" -> "ArchBootEntry";

    "ArchBootEntry" -> "SyscallSetup" [ dir=both ];
    "ArchBootEntry" -> "IndepBootEntry";

    "IndepBootEntry" -> "MemMapGen" [ dir=both ];
    "IndepBootEntry" -> "MemMapAllocInit" [ dir=both ];

    "IndepBootEntry" -> "PreuserModLoad" [ dir=both ];

    "IndepBootEntry" -> "InitEnv";

    "InitEnv" -> "StorageFSMount" [ dir=both ];
    "InitEnv" -> "KernelFSMount" [ dir=both ];

    "InitEnv" -> "InitEnvMod" [ dir=both ];
    "InitEnvMod" -> "PreuserModLoad";

    "InitEnv" -> "RamLoader";

    node [ name="RamInit" shape=diamond ];

    "RamLoader" -> "RamInit";

    node [ name="UserInit" shape=oval ];

    "RamInit" -> "UserInit" [ dir=both ];
    "UserInit" -> "UserModLoad";
    "UserInit" -> "ProcessFSMount";

    node [ name="DiskInit" shape=diamond ];

    "RamInit" -> "DiskInit";

    "DiskInit" -> "SysInit";
}

The above diagram represents the boot process, where oval nodes represent kernel items, diamond nodes represent OS items, bidirectional arrows represent items that return to their caller, and directional arrows represent items that don't.

Command Line

The kernel command line is in the format:

(kernel executable name) runtime-argument1="value" runtime-argument2=123 BOOT-ARGUMENT1="value" BOOT-ARGUMENT2=456 runtime-flag BOOT-FLAG

Where anything lowercase is an argument that can be passed at boot time or at runtime, and anything uppercase can only be passed at boot time.

Flags are true or false values that return false if not present and true if present. Arguments can be strings or numbers, and numbers are interpreted as rust f128s if they have a . in them, i128s if they have a negative or a positive sign and no .s in them, and u128s otherwise. You can also add any amount of underscores to separate sections of them, however no spaces can be in them. Strings should ALWAYS be in quotes(as this is what the kernel expects and the regexes used require). Note that you can add a backslack before a single quote to have it in the string, and strings can be an arbitrary length. Flags by definition cannot have any values(any equal signs) in or by them.

All valid names should be matched by the regex(Rust-style): [a-zA-Z-_0-9]+

Flags are matched by the regex [a-zA-Z-_0-9]+. This ensures it doesn't match the name of the executable or arguments.

String arguments are matched by the regex ([a-zA-Z][a-zA-Z-_0-9]+)=('.*.+?[^\\]')(?: |$).

Unsigned numeric arguments are matched by the regex ([a-zA-Z][a-zA-Z-_0-9]+)=([0-9_]+?)(?: |$).

Signed numeric arguments are matched by the regex ([a-zA-Z][a-zA-Z-_0-9]+)=([-+][0-9_]+?)(?: |$).

Float arguments are matched by the regex ([a-zA-Z][a-zA-Z-_0-9]+)=([-+]?[0-9_]+?\.[0-9_]+?)(?: |$).

API reference

The reference is available at aphrodite-os.github.io/docs.

Note that this only includes implemented APIs. For unimplemented ones, see ideas/reference.