Skip to content

Commit

Permalink
meta: Streamlined build instruction and readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-monax committed Aug 4, 2023
1 parent 6b7280f commit 1525171
Show file tree
Hide file tree
Showing 10 changed files with 145 additions and 107 deletions.
3 changes: 0 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[makefile]
indent_style = tab

[*.mk]
indent_style = tab

Expand Down
21 changes: 9 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,23 @@ jobs:
with:
fetch-depth: 0

- name: Setup Toolchains
- name: Install Dependencies
run: |
sudo apt update
sudo apt install clang lld llvm python3 git ninja-build libsdl2-dev nasm gcc-multilib
git clone https://github.com/cute-engineering/chatty --depth=1 --branch=main --single-branch
sudo pip install -e chatty/
git clone https://github.com/cute-engineering/cutekit --depth=1 --branch=dev --single-branch
sudo pip install -e cutekit/
- name: Install Packages
run: cutekit install
- name: Set up the build environment
run: ./skift.sh setup && ./skift.sh doctor

- name: Download third-party dependencies
run: ./skift.sh install

- name: Build Kernel (x86_64)
run: cutekit build --target=kernel-x86_64
run: ./skift.sh build --target=kernel-x86_64

- name: Build EFI (x86_64)
run: cutekit build --target=efi-x86_64
run: ./skift.sh build --target=efi-x86_64

- name: Build Userspace (x86_64)
run: cutekit build --target=skift-x86_64
run: ./skift.sh build --target=skift-x86_64

- name: Build Host
run: cutekit build
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ __pycache__/
.vscode/
.DS_Store
.python-version
src/protos/*.h
33 changes: 33 additions & 0 deletions meta/plugins/doctor-cmd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from cutekit.cmds import Cmd, append
from cutekit.args import Args
from cutekit import shell, vt100
import subprocess


def commandIsAvailable(cmd: str) -> bool:
print(f"Checking if {cmd} is available...", end="")
try:
cmd = shell.latest(cmd)
out = subprocess.check_output([cmd, "--version"])
print(f"{vt100.GREEN} ok{vt100.RESET}")
print(
f"{vt100.BRIGHT_BLACK}Command: {cmd}\nVersion: {out.decode('utf-8').strip()}{vt100.RESET}")
print()
return True
except Exception as e:
print(f" {e}")
print(f"{vt100.RED}Error: {cmd} is not available{vt100.RESET}")
return False


def doctorCmd(args: Args):
commandIsAvailable("qemu-system-x86_64")
commandIsAvailable("clang")
commandIsAvailable("clang++")
commandIsAvailable("ld.lld")
commandIsAvailable("nasm")
commandIsAvailable("ninja")
commandIsAvailable("chatty")


append(Cmd(None, "doctor", "Check if all required commands are available", doctorCmd))
3 changes: 3 additions & 0 deletions meta/plugins/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
python-magic ~= 0.4.27
requests ~= 2.28.0
graphviz ~= 0.20.1
111 changes: 29 additions & 82 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<br/>
<br/>
<br/>
<br/>

<p align="center">
<img src="doc/logo-light.svg#gh-light-mode-only" height="64" />
Expand All @@ -22,119 +23,65 @@

## About

**skiftOS** is a hobby operating system built from scratch using contemporary C and C++ for ARM, x86, and RISC-V architectures. It is designed to be simple, modern, and modular. skiftOS features a modern C++ core library, modern reactive UI, and a capability-based microkernel for security and modularity.

<p align="center">
<img src="doc/screenshots/2023-06-06.png" />
<br>
skiftOS applications running on Linux
</p>

## Values

As a hobby operating system, skiftOS is built with the following values in mind:

- **Simple**: skiftOS aims to be simple and easy to use, without being overly complex or difficult to understand. It prioritizes user-friendliness over feature bloat.

- **Modern**: skiftOS is built using modern C++ and C standards, and is designed to be extensible and hackable. It leverages modern programming techniques and technologies to provide a robust and efficient operating system.

- **Modular**: skiftOS is designed to be modular and extensible. It is built around a microkernel architecture, which allows for the addition of new features without having to modify the core components of the operating system.

## Features

skiftOS has several notable features:

- **Modern C++ Core Library**: skiftOS is built using karm, a modern C++ core library that provides essential functionality like memory management, file I/O, and networking. karm takes inspiration from [The Rust Standard Library](https://doc.rust-lang.org/std/) to create a powerful and safe library.

- **Modern Reactive UI**: skiftOS uses karm-ui, a modern reactive UI library that is based on unidirectional data flow. It takes inspiration from popular UI frameworks like React and Flutter, and enables developers to create powerful and responsive user interfaces.

- **Capability-based Microkernel**: skiftOS is built around a microkernel architecture that uses capability-based security. This means that each process has only the permissions it needs to perform its tasks, which makes the operating system more secure and easier to maintain.

- **Multi-architecture Support**: skiftOS can run on multiple architectures, including ARM, x86, and RISC-V. This makes it highly versatile and allows it to run on a variety of devices.

- **Easy to Hack On**: skiftOS is designed to be easy to hack on, with a focus on simplicity and modularity. This means that developers can easily contribute to the project and add new features without having to understand the entire codebase.

- **Free and Open-Source**: skiftOS is licensed under the MIT license and is free to use, modify, and redistribute. This makes it accessible to everyone and encourages collaboration and innovation.
**skiftOS** is a hobby operating system built from scratch for ARM, x86, and RISC-V architectures. It is designed to be simple, modern, and modular, featuring a modern C++ core library, reactive UI, and a capability-based microkernel. skiftOS values simplicity, modernity, and modularity, and has several notable features such as multi-architecture support and easy hackability. It is free and open-source under the MIT license.

![skiftOS Screenshot](doc/screenshots/2023-06-06.png)

## Building

skiftOS is written in bleeding-edge C23 and C++23 and building it requires a modern C/C++ compiler like clang-14 or GCC-12 installed on the host machine.
To build skiftOS, you need to have a modern C/C++ compiler such as clang-16 installed on your computer. Additionally, you need to have the following tools installed: `python3`, `llvm`, `clang`, `ninja`, `nasm`, and `qemu`. Please refer to the documentation of these tools or use your package manager to install them.

### Step 1: Set up the build environment

First, set up the build environment by running the following command:
```sh
# Make sure clang is the right version
$ clang --version
clang version 13.0.1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

# Make sure nasm is installed
$ nasm --version
NASM version 2.15.05 compiled on Sep 24 2020

# Make sure python3 is installed
$ python3 --version
Python 3.10.5
$ ./skift.sh setup
```

Building skiftOS also requires installing [CuteKit](https://github.com/cute-engineering/cutekit)

> CuteKit is a package manager and build system for C/C++/ASM/RUST projects. It is designed to meet the needs of hobby operating systems and other low-level projects.
Then, check that everything is working correctly by running:
```sh
$ git clone https://github.com/cute-engineering/cutekit

$ cd cutekit

$ git switch dev

$ pip install --user -e .
$ ./skift.sh doctor
```

Once you have installed CuteKit, you can install the dependencies and finally run the operating system:
### Step 2: Download third-party dependencies

After setting up the build environment, download the third-party dependencies by running the following command:
```sh
$ cutekit install

$ cutekit start
$ ./skift.sh install
```

Individual components can be run on the host system using:
### Step 3: Build and run skiftOS

Finally, build and run skiftOS by running the following command:
```sh
$ cutekit run <component>
$ ./skift.sh start
```

> Use `cutekit help` to get more information about the available commands.
If all these steps are completed successfully, you should have a fully built and operational skiftOS ready for use. Enjoy! 😊

## Contributing

Contributions are welcome and encouraged!
Contributions are welcome and encouraged for this project! We practice [optimistic merging](http://hintjens.com/blog:106), which means that pull requests are merged into the main branch as soon as possible. The goal is to keep pull requests small, focused, and incremental.

This project practice [optimistic merging](http://hintjens.com/blog:106) meaning that pull requests are merged into the main branch as soon as possible. The objective is to keep PR as small, focused, and incremental as possible.

Commit messages should be short and concise and prefixed with the name of the package. For example:
When writing commit messages, please keep them short and concise. They should be prefixed with the name of the package that the commit affects. For example:

```
karm-base: Fix buffer overflow in Karm::String::reserve.
```

Binary files should be as small as possible.

- SVG should be preferred over other raster images formats
- `optipng -strip all` to reduce the size of PNG images.
- `gifsicle -O3` to reduce the size of GIF images.
- `jpegoptim -m90` to reduce the size of JPEG images.
Binary files should be kept as small as possible. Here are some tips for reducing the size of different image formats:
- Use SVG instead of other raster image formats whenever possible.
- Use `optipng -strip all` to reduce the size of PNG images.
- Use `gifsicle -O3` to reduce the size of GIF images.
- Use `jpegoptim -m90` to reduce the size of JPEG images.

## Acknowledgements

I (sleepy-monax) would like to thank the following people for their help and support:
- [Cyp](https://cyp.sh), [Keyboard Slayer](https://github.com/keyboard-slayer), and [D0p1](https://github.com/d0p1s4m4) for being great friends giving me a lot of support and motivation.
- [Feliwir](https://github.com/feliwir) for all the work he did on the past skiftOS and BRUTAL project. I learned a lot from his work and I am very grateful for his help.
- And all the people who have contributed to the project and send me money on [Github Sponsors](https://github.com/sponsors/sleepy-monax)
I, Sleepy-monax, would like to express my gratitude to the following individuals for their help and support:

- Cyp, Keyboard Slayer, and D0p1 for being great friends and providing me with support and motivation.
- Feliwir for his contributions to the skiftOS and BRUTAL projects. I learned a lot from Feliwir's work and am grateful for his help.
- All the people who have contributed to the project and supported me through Github Sponsors.

## License

Expand Down
61 changes: 61 additions & 0 deletions skift.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash

set -e

# check for CUTEKIT_NOVENV
if [ "$CUTEKIT_NOVENV" == "1" ]; then
echo "CUTEKIT_NOVENV is set, skipping virtual environment setup."
exec cutekit $@
fi

if [ ! -f .cutekit/tools/ready ]; then
echo "Tools not installed."
echo "This script will install the tooling required to build SkiftOS into $PWD/.cutekit"

if [ ! -t 0 ]; then
read -p "Do you want to continue? [Y/n] " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Aborting."
exit 1
fi
fi

mkdir -p .cutekit

echo "Setting up Python virtual environment..."
python3 -m venv .cutekit/venv
source .cutekit/venv/bin/activate

echo "Downloading CuteKit & Chatty..."
if [ ! -d .cutekit/tools/cutekit ]; then
git clone --depth 1 https://github.com/cute-engineering/cutekit .cutekit/tools/cutekit
else
echo "CuteKit already downloaded."
fi

if [ ! -d .cutekit/tools/chatty ]; then
git clone --depth 1 https://github.com/cute-engineering/chatty .cutekit/tools/chatty
else
echo "Chatty already downloaded."
fi

echo "Installing Dependencies..."
pip3 install -r meta/plugins/requirements.txt

echo "Installing Tools..."
pip3 install -e .cutekit/tools/cutekit
pip3 install -e .cutekit/tools/chatty

touch .cutekit/tools/ready
echo "Done!"
fi

if [ "$1" == "setup" ]; then
exit 0
fi

source .cutekit/venv/bin/activate
export PATH="$PATH:.cutekit/venv/bin"

cutekit $@
File renamed without changes.
File renamed without changes.
19 changes: 10 additions & 9 deletions compile_flags.txt → src/compile_flags.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@
-Wextra
-Werror

-Isrc/apps
-Isrc/clis
-Isrc/srvs
-Isrc/embed
-Isrc/kernel
-Isrc/libs
-Isrc/specs
-Isrc/impls
-I.cutekit/extern/cute-engineering
-I./
-I./apps
-I./clis
-I./srvs
-I./embed
-I./kernel
-I./libs
-I./specs
-I./impls
-I../.cutekit/extern/cute-engineering

-D__ck_sys_linux__
-D__ck_arch_x86_64__
Expand Down

0 comments on commit 1525171

Please sign in to comment.