Rewrite README.md now that restart is gone

This commit is contained in:
apio 2023-01-08 15:55:01 +01:00
parent afe9a01bbf
commit 15c5b80dc9
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -1,33 +1,19 @@
# Luna
A simple kernel and userspace for desktop computers, written mostly in C++ and C. [![Build Status](https://drone.cloudapio.eu/api/badges/apio/Luna/status.svg?ref=refs/heads/restart)](https://drone.cloudapio.eu/apio/Luna) (rewrite, listed features are currently mostly from the old version)
A simple kernel and userspace for desktop computers, written mostly in C++ and C. [![Build Status](https://drone.cloudapio.eu/api/badges/apio/Luna/status.svg)](https://drone.cloudapio.eu/apio/Luna)
## Features
- x86_64-compatible [kernel](kernel/). (Rewritten)
- Keeps track of [memory](kernel/src/memory/). (Rewritten)
- Can read, write and execute files from a [virtual file system](kernel/src/fs/) supporting an initial ramdisk, device pseudo-filesystems... but no hard disks yet. (Not there yet)
- Preemptive multitasking, with a round-robin [scheduler](kernel/src/thread/) that can switch between tasks. (Rewritten)
- Can [load ELF programs](kernel/src/ELF.cpp) from the file system as userspace tasks. (Rewritten)
- [System call](kernel/src/sys/) interface and [C Library](libc/), aiming to be mostly POSIX-compatible. (Rewriting)
- UNIX-like [multitasking primitives](kernel/src/sys/exec.cpp), which allow user tasks to spawn other tasks. (Not there yet)
- Some simple [userspace programs](apps/src/), written in C. (Not there yet)
- Simple [command-line shell](apps/src/sh.c), allowing for interactive use of the system. (Not there yet)
- Basic multi-user system with [a password file](initrd/etc/passwd) and utilities for [logging in](apps/src/session.c) and [switching users](apps/src/su.c). (Not there yet)
## New features (in the rewrite)
- Easier [portability](kernel/src/arch), no need to be restricted to x86_64.
- x86_64-compatible lightweight [kernel](kernel/).
- Preemptive multitasking, with a round-robin [scheduler](kernel/src/thread/) that can switch between tasks.
- Can [load ELF programs](kernel/src/ELF.cpp) from the file system as userspace tasks.
- [System call](kernel/src/sys/) interface and [C Library](libc/), aiming to be mostly POSIX-compatible.
- Designed to be [portable](kernel/src/arch), no need to be restricted to x86_64.
- Fully [UTF-8 aware](luna/include/luna/Utf8.h), **everywhere**.
- More [thread](luna/include/luna/Atomic.h) [safety](kernel/src/thread/Spinlock.h).
- [Thread](luna/include/luna/Atomic.h) [safety](kernel/src/thread/Spinlock.h).
- Environment-agnostic [utility library](luna/), which can be used in both kernel and userspace.
- Improved [error propagation](luna/include/luna/Result.h), inspired by Rust and SerenityOS.
- Better code quality and readability.
- Build system now uses [CMake](CMakeLists.txt), which makes everything a lot easier.
- Return-oriented [error propagation](luna/include/luna/Result.h), inspired by Rust and SerenityOS.
- Build system uses [CMake](CMakeLists.txt).
## Notes
- The default user is named 'selene' and you can log into it with the password 'moon'.
## Setup (not broken anymore)
Although some prebuilt toolchains do exist, they have a hardcoded directory structure which is unlikely to match your setup and will thus cause problems. The best option is always to compile your own cross-toolchain, and now that the `restart` branch is mature enough to do that, go for it!
## Setup
To build and run Luna, you will need to build a [GCC Cross-Compiler](https://wiki.osdev.org/Why_do_I_need_a_Cross_Compiler) and cross-binutils for `x86_64-luna`. (Yes, Luna is advanced enough that it can use its own [OS-Specific Toolchain](https://wiki.osdev.org/OS_Specific_Toolchain), instead of a bare metal target like `x86_64-elf`. It is the first of my OS projects to be able to do so. The patches for Binutils and GCC are [binutils.patch](tools/binutils.patch) and [gcc.patch](tools/gcc.patch)).
@ -84,28 +70,9 @@ Every hour, my server pulls the latest commits on `main` and builds an hourly IS
These images do reflect the latest changes on the `main` branch, but are obviously less stable. Additionally, an hourly image will be skipped if building the latest commit of the project fails.
Until the `restart` branch gets merged, you'll have to build an ISO yourself.
## Is there third-party software I can use on Luna?
No, not on this branch.
**ORIGINAL ANSWER**
Yes, actually! Check out the [ports](ports/) directory.
Right now, there are very few ports, because our C Library is a bit primitive and doesn't support complex projects.
You should also keep in mind that it is not possible to compile software written in any language other than C/C++ (and C++ was added recently, its standard library doesn't work very well) for Luna right now.
But feel free to try to port some program yourself and add it to the ports directory!
Port usage:
`ports/add-port.sh <port-name>` will build and add a port to the list of installed ports, and the built port will automatically get installed into the system root every time you run Luna.
`ports/remove-port.sh <port-name>` will remove the port from the list of installed ports, remove built files from the system root, as well as the build directory.
`ports/make-package.sh <port-name>` will compile the port and make a package archive from it, which may be used in the future with a package manager :)
Not right now, but hopefully soon!
## License
Luna is open-source and free software under the [BSD-2 License](LICENSE).