~vdupras/duskos

32-bit Forth OS with C compiler
2 months ago

eba520e This repository has moved

2 months ago

#This repository has moved

This repository is no longer updated. It now lives (without ssl) at:

git://git.duskos.org/duskos.git

See Dusk OS website for details.

#Dusk OS

Dusk OS is a 32-bit Forth running on i386 and ARM CPUs and big brother to Collapse OS. Its primary purpose is to be maximally useful during the first stage of civilizational collapse, that is, when we can't produce modern computers anymore but that there's still many modern computers still around.

It does so by aggressively prioritizing simplicity at the cost of unorthodox constraints, while also aiming to make power users happy.

Dusk OS innovates by having an "almost C" compiler allowing it to piggy-back on UNIX C code, through a modest porting effort, to reach its goals and stay true to its design constraints with a minimal effort.

This is Dusk OS' source code and the rest of the README assumes that you want to run it. To read more about why this OS exists, see its website. To see where it's going, you can look at the roadmap.

#Build and run Dusk

Dusk is designed to run on bare metal and to build itself from itself. However, it's also possible to build Dusk from any POSIX platform using Dusk's C VM from posix/vm.c. This VM implements a Forth that can interpret the whole of Dusk's Forth code, but this VM is CPU-agnostic and has its own simplistic bytecode.

That is enough to generate bare metal images for any of its target platforms, so that's why it exists. To build this VM, you need:

  • GNU Make
  • A C compiler

Running make will yield a ./dusk binary which if opened, provides an interactive prompt.

Documentation lives in fs/doc. You can begin with doc/index. Type bye to quit.

Dusk OS expects a non-canonical raw input. With a regular TTY, your input will be buffered and echoed twice and reads to it will be blocking. We don't want that. To avoid that, you can invoke it like this:

(stty -icanon -echo min 0; ./dusk; stty icanon echo)

make run does this for you.

#Running on bare metal

Running Dusk under the POSIX VM is fine, but severly limited: the filesystem is read-only and there is no Grid (text UI system) or Screen (graphical system).

To see a fully-featured Dusk, it's better to run it on an actual machine.

Deploying Dusk on a real machine is a bit more involving than running the POSIX VM and you should read doc/deploy.txt. There's a repository of deployment configurations to help you get started on deploying Dusk OS to your machine.

This repository contains a few targets with convenient QEMU launchers, so this can be a good way to quickly see a fully featured Dusk OS in action. For example, the pc-piix target of duskos-deployments is a good first choice.

Dusk is self-hosting and has the ability to create its own FAT. However, through the POSIX VM, this process is quite slow and after a few times, you might tire of waiting after this process. If you install mtools, things will speed up. If mcopy is present on the host, the Makefile will pick it up and use it instead of using Dusk's FAT tools. This is much faster.

#Running on WASM, DuskBSD or Usermode

Each of those "special" targets have a README of their own in their respective sub-directories, wasm/, netbsd/, usermode/.

#Collapse OS lives in here

The Collapse OS project lives inside Dusk OS which has a compatibility layer allowing it to run Forth code in "Collapse OS mode", which makes it the simplest way around to bootstrap a seed Collapse OS binary.

To be sure: Collapse OS is fully self-hosting and doesn't need Dusk OS to build itself, but if you don't already have a Collapse OS environment handy, then you need a way to craft your first Collapse OS image. Dusk OS is this way.

Collapse OS itself doesn't contain any machine-specific code so it can't, by itself, build an image for a real machine. That machine-specific code live in different repositories all around. This is the list of known Collapse OS ports to real machines is available on Collapse OS' website.

#Signed commits

As of 2023-12-13, I began signing my commits with the intent to begin self-serving this repository through an insecure transport. You can see details about how I sign my commits here.