{"id":15056300,"url":"https://github.com/portasynthinca3/boss","last_synced_at":"2025-04-10T04:07:26.397Z","repository":{"id":250094749,"uuid":"833439593","full_name":"portasynthinca3/boss","owner":"portasynthinca3","description":"Operating system written in Erlang and Rust","archived":false,"fork":false,"pushed_at":"2024-08-14T06:02:46.000Z","size":233,"stargazers_count":42,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-10T04:07:20.167Z","etag":null,"topics":["beam","capability-security","erlang","os","rust","uefi","x86-64"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/portasynthinca3.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-25T04:09:44.000Z","updated_at":"2025-03-16T04:48:38.000Z","dependencies_parsed_at":"2024-08-10T19:56:29.639Z","dependency_job_id":"79b6b654-8bf4-4327-84eb-881d1fed203d","html_url":"https://github.com/portasynthinca3/boss","commit_stats":null,"previous_names":["portasynthinca3/boss"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/portasynthinca3%2Fboss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/portasynthinca3%2Fboss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/portasynthinca3%2Fboss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/portasynthinca3%2Fboss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/portasynthinca3","download_url":"https://codeload.github.com/portasynthinca3/boss/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154986,"owners_count":21056543,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["beam","capability-security","erlang","os","rust","uefi","x86-64"],"created_at":"2024-09-24T21:49:47.861Z","updated_at":"2025-04-10T04:07:26.371Z","avatar_url":"https://github.com/portasynthinca3.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BOSS\nBOSS (BEAM-based Operating System with Security) is a proof-of-concept operating\nsystem written in Erlang together with Rust. Its distinctive features include:\n  - replacing the traditional kernel-userspace divide with Erlang's supervision\n    tree model;\n  - capability-based security from the ground up.\n\n![BOSS printing Hello, World from Erlang](demo/helloworld.png)\n\n## Goals\n  - learn Rust;\n  - implement an Erlang VM;\n  - implement the dumbest fucking idea that came to my head at 3 in the morning.\n\nThis project strives to achieve the following, in order of decreasing\nimportance:\n  - get the implementation working;\n  - make the implementation correct;\n  - make the implementation fast.\n\n### Urrr-lang?\nYes. Erlang is a very cool functional (at a low level) / object-oriented (at a\nhigh level) concurrent language. Erlang makes it easy to write code that scales\nalmost effortlessly across multiple cores, processors or even machines. Existing\nimplementations of Erlang (most notably, the official BEAM virtual machine) are\nvery performant in both single-core and multi-core operations. This\nimplementation is not. Like, not at all. But it works and it's a starting point!\n\n## Structure\n\n### Emulator\nThe basis of this project is the **emulator**, a multiprocessing-aware Erlang VM\nthat runs on bare hardware. It only implements the bare minimum it has to\nimplement in order to reach this objective; for example, it does parse some ACPI\ntables (since that is required for multiprocessing to work) (or, at least, it\nwill once this feature is actually implemented), but it does not run AML\nbytecode - that task is left up to the BEAM bytecode it runs. The emulator only\nsupports the x86_64 ISA, UEFI and ACPI 2.0+, i.e. it will run on machines from\napproximately 2010 onwards. It could be argued that the emulator is a\nmicrokernel since it implements the things a uK would (scheduling and IPC), but\nit's my project and I prefer not to name it that.\n\nEven though the emulator is _a_ BEAM, it's not _the_ BEAM. It is compatible with\nErlang's standard binary module format and its bytecode instructions, but that's\nabout where the similarities end. This incompatibility is a conscious design\ndecision that was made to introduce isolation and capability-based security into\nthe BEAM. Here's an incomplete list of the differences:\n  - In OTP, an application is a code-level abstraction; it does not exist in the\n    virtual machine. In OTP, only one version of an application may be loaded at\n    the same time, and only one instance of that application may be running at\n    the same time. In BOSS, applications (but not app instances) exist at the\n    emulator level.\n  - In OTP, modules are global. In BOSS, modules are namespaced to a particular\n    application, and isolation between them is enforced by the emulator.\n    External calls to modules in other applications are termed \"far calls\", are\n    not always allowed and demand a special module name:\n    ```erl\n    % this calls the function `baz' from the module `bar' in the application `foo'\n    % this will only be allowed if `foo' \"exports\" the module `bar'\n    'foo:bar':baz(). % far call\n    % this calls the function `baz' from the module `bar' in the current app\n    bar:baz(). % external call\n    % this calls the function `baz' from the current module in the current app\n    baz(). % local call\n    ```\n  - In OTP, messages are sent to ports and processes as-is. In BOSS, the\n    sender's id (whatever it is, a pid or a port) is transparently appended to\n    the message:\n    ```erl\n    Self = self(),\n    Self ! hello,\n    receive\n      {Self, hello} -\u003e yay,\n      hello -\u003e nay\n    end.\n    ```\n  - In OTP, every module and every function is trusted to do anything. In BOSS,\n    every at least slightly privileged operation requires an access token, thus\n    breaking compatibility with many BIFs. Access tokens cannot be forged, but\n    can be shared and subdivided into a finer-grained permission set.\n\nThe current implementation is not the fastest, but it's a starting point to get\nthings working.\n\n### Base image\nOn startup, the emulator loads the **BOSS base image** (`BOSBAIMA.TAR`) that\ncontains initial emulator configuration and just enough BEAM modules to\nbootstrap a functional OS. It's akin to OTP's `kernel` app.\n\n### Everything else\nAs was previously said, there is no clear kernel-userspace divide; instead, BOSS\ngoes for the supervision tree model that forms the basis of Erlang/OTP.\n\n## Checklist\nEmulator:\n  - [x] Hello, World!\n  - [x] The hardware world\n    - [x] Logging\n    - [x] Physical memory management\n    - [x] Virtual memory management\n    - [x] Relocation\n    - [x] Interrupt handling\n    - [x] Heap - MVP\n    - [ ] Memory caching support\n    - [ ] Basic ACPI parser\n    - [ ] APIC driver\n    - [ ] SMP\n  - [x] The BEAM world\n    - [x] BEAM bytecode parsing\n    - [x] BEAM code execution (45/125 opcodes)\n    - [x] Basic ports - MVP\n    - [ ] Advanced ports\n    - [ ] Performance enhancements\n    - [ ] Secure NIFs in ring 3\n    - [ ] Compatibility sandbox for OTP applications\n\nBase image:\n  - [x] Hello, World!\n  - [ ] Standard library\n  - [ ] Basic drivers:\n    - [ ] UEFI GOP\n    - [ ] PS/2\n    - [ ] AHCI\n    - [ ] FAT32\n  - [ ] Logging\n  - [ ] Code management\n  - [ ] Application support\n\n\"Userland\":\n  - [ ] Hello, World!\n  - [ ] A GUI, probably?\n  - [ ] Other things\n\n## I wanna run it!!!!\nCurrently, the OS does not display anything on the screen. Instead, refer to\noutput from the serial port. [Nix](#build-using-nix) and\n[Just](#build-using-just) scripts instruct QEMU to redirect serial port output\nto the terminal.\n\n### Download\nYou can download an ISO built from the latest commit over on the\n[Releases](https://github.com/portasynthinca3/boss/releases) page. However, I\nsuggest that you instead build the OS from scratch.\n\n### Build using Nix\nClone the project with:\n```shell\n$ git clone https://github.com/portasynthinca3/boss.git\n$ cd boss\n```\n\nBuild an ISO with:\n```shell\n$ nix --extra-experimental-features flakes build .#iso\n```\n\nLaunch in QEMU with:\n```shell\n$ nix --extra-experimental-features flakes --extra-experimental-features nix-command run\n```\n\n### Build using Just\nClone the project with:\n```shell\n$ git clone https://github.com/portasynthinca3/boss.git\n$ cd boss\n```\n\nTo build an ISO, you will need:\n  - Just v1.x (tested with `1.33.0`)\n  - GNU MTools v4.x (tested with `4.0.44`)\n  - GNU binutils v2.x (tested with `2.42.0`)\n  - Rust v1.82-nightly (tested with `1.82.0-nightly (7120fdac7 2024-07-25)`)\n  - Erlang/OTP 27 (tested with `Erlang/OTP 27 [erts-15.0.1]`, 26 and below will\n    _not_ work)\n\nBuild an ISO with:\n```shell\n$ just iso\n```\n\nTo run the ISO in QEMU, you will need:\n  - All the other things needed for building an ISO\n  - QEMU\n  - OVMF (or other UEFI firmware for QEMU)\n\nLaunch QEMU with:\n```shell\n$ just qemu\n```\n\n## Credits\nThank you to:\n  - [@thecaralice](https://github.com/thecaralice) for helping me understand\n    Rust and adding a Nix flake\n  - [@polina4096](https://github.com/polina4096) for helping me understand Rust\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fportasynthinca3%2Fboss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fportasynthinca3%2Fboss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fportasynthinca3%2Fboss/lists"}