dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit e26522ab0db3c5f71fe4ac1337d41f67e72e5cc9
parent 5752ef1179d4f8ecebbb6cbb4c377c9dfbebc556
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Mon, 29 May 2023 19:57:43 -0400

Update README to reduce duplicate with website contents

MREADME.md | 202++-----------------------------------------------------------------------------
1 file changed, 3 insertions(+), 199 deletions(-)

diff --git a/README.md b/README.md @@ -13,190 +13,8 @@ Dusk OS innovates by having an ["almost C" compiler][duskcc] allowing it to piggy-back on UNIX C code, through a modest [porting effort][port], to reach its goals and stay true to its design constraints with a minimal effort. -[Video showcasing Dusk OS][demovideo] - -## Why build this OS? - -Most modern operating systems can do whatever we want them to do. Why do we -need another one? Simplicity. - -It's difficult to predict post-collapse conditions, but we can suppose that many -users will need to use their machines in novel and creative ways. Hackability -of the operating system then becomes paramount. Open source modern operating -systems all can be modified to fit its user's needs, but their complexity limits -the likelihood that the user is able to do so. A simpler OS increases this -likelihood. - -But we can't have our cake and eat it too, right? Either you have a simple toy -OS or a complex one. Well, maybe not? - -Its authors believe that in the history of computing, Forth has been -under-explored. Its approach to simplicity is, we think, revolutionary. It -has significant shortcomings when system specifications become more complex -(Forth hates complexity and doesn't manage it well), but we believe it -possible to elegantly marry it with languages that like complexity better. - -This mix, we believe, could provide a [creative][creative] user with computing -powers rarely seen with other approaches. We've got to try it. - -To be clear: this is a research project, we don't know what it will yield -beforehand. We have the intuition that it might lead to a big "ah ah!" moment -and reveal a breathtaking combination of power and simplicity. - -## Features making Dusk OS special - -### A whole OS built from source on boot - -One thing that makes Dusk OS special is that it boots from a very tiny core -(1000 lines of i386 assembly). From this tiny core, on boot, it builds its way -up to a system that has a functional C compiler, which then allows it to -bootstrap itself some more. - -With regards to "source bootstrapping", it's even more extreme than Collapse OS -because modern machines allows this process to run quickly and the whole -process is still faster than a regular Linux boot. On Collapse OS target -machines, this process would be prohibitive, so a bigger part of the OS is -cross-compiled into the kernel. - -This peculiarity of Dusk OS has interesting properties. The nicest one, in my -humble opinion, is that this allows us to sidestep the *entire* problems of -binary compatibility and relocation and only deal with source compatibility. -So, no ELF, no binutils, only code that is designed to run from where it was -generated in the first place. This is so much simpler! - -Object files? Global symbols? Nah. C functions that don't have a static storage -type are simple Forth words. - -### Harmonized Assembly Layer - -Dusk features what we call the [Harmonized Assembly Layer][hal] (HAL for short). -This is a cross-CPU assembler, on which the C compiler relies, which prioritizes -implementation and usage simplicity, but is also designed to generate efficient -native code. - -### Shortest path to self-hosting for an "almost C" compiler - -Dusk OS self-hosts in about 800 lines of assembly and a few hundred lines of -Forth (the exact number depends on the target machine). From there, it -bootstraps to DuskCC, which is roughly 2000 lines of Forth code (including -arch-specific assemblers). To my knowledge, Dusk OS is unique in that regard. - -You can pick any C compiler that requires POSIX and it will automatically -require order of magnitudes more lines of code to bootstrap because you need -that POSIX system in addition to the C compiler. So even if you pick a small C -compiler such as tcc, you still need a POSIX system to build it, which is -usually in the millions of LOCs. - -To be fair, Dusk OS is not the first project thinking of optimizing that path. -[Efforts at making our modern software world bootstrappable][livebootstrap] -lead to an "almost C", [M2-Planet][m2planet] with a feature set comparable to -DuskCC with very few lines of code. M2-Planet itself is about 5K lines of code -and the various stages that lead to it are generally a few hundred lines each. -The project initially ran on top of regular kernels (as in "fat kernels with -lots of code"), but some bare metal stages ([1][builder-hex0], -[2][stage0-uefi]) were created and now this little chain end up being -comparable to Dusk in terms of lines of code. Still more than Dusk, but in the -same ballpark. - -Although this path is short and technically leads you to an "almost C" -compiler, you can hardly use it because it has no "real kernel" (those bare -metal stages mentioned above are enough to compile M2-Planet, but really not -much else, they're extremely limited) and no shell. You'll need those if you -want to use your shiny compiler. - -One of your best picks, should you try this path, would be [Fiwix][fiwix], a -minimal POSIX i386 kernel weighting less than 50K lines of C+asm. But then, -M2-Planet is not enough. You need to compile tcc (which M2-Planet can compile -after having applied a few patches) which weights 80K. Userspace is worse. -Bash+coreutils are 400K, even busybox is 190K. We still end up with a pretty -minimal and simple system, but it's still a lot more code than Dusk. - -So, unless someone tells me about some option I don't know about, DuskCC is -quite innovative on the aspect of self-hosting path length. - -## Who is Dusk for? - -The target Dusk user is someone who's [creative][creative], close to hardware, -can read a datasheet. Dusk shines (well, *will* shine) when one wants to poke -around the hardware without limit. - -It compares favorably to other more complete OSes because there's no concurrent -process to mess with your poking and the driver structure is (well, *will* -hopefully be) more approachable, hackable due to its stricter scope and savvier -target audience. - -Let's use an example. Let's say you're on a notebook that runs on a chipset of -Intel's ICHn family. You read the datasheet and see "oh, nice, there's an SPI -interface in there. Maybe that it's not hooked to anything on the notebook, -let's play with it." - -Now, that chipset is very, very central to the computer. There are good chances, -on a BSD or Linux system, that if you begin poking around its registers, you'll -step on someone else toes and crash the system because, for example, of some -other process that needed to read from disk at the same time. - -In Dusk, you could completely break the SATA controller, you'll still be golden -as long as you don't access mass storage. Because Dusk doesn't have -concurrency, you have tight control over what happen or doesn't happen on the -machine, so all you need to do is to avoid words that access mass storage. That -gives you ample wiggling space for your hacking session. - -To be clear: this is also possible with a custom made BSD or Linux, but you're -going to have to strip a lot of pieces from your distro before you get there -and some of those pieces might be useful debugging tools which will be -difficult to retrofit because they need a wider system. You'll also need a -higher cognitive space to fit BSD/Linux wider abstractions in your mind. - -## Status - -* Has a VM written in C, buildable from a POSIX environment, which allows Dusk - to build itself for any of its supported targets. -* Has an ["almost C" compiler][duskcc] which still needs some work, but is - already capable of compiling a nice subset of C. -* It can run bare metal on some PCs (and QEMU, of course). It has drivers (in - various state of sophistication) for: - * VGA in text mode - * PS/2 keyboard - * PCI controllers - * ATA controllers - * AHCI controllers - * Floppy controllers - * PC COM ports - * VESA in graphical mode - * PS/2 mouse support -* Can read, write and boot from FAT12/FAT16 (no FAT32 for now) volumes. -* Can create new FAT12 volumes. -* Very small footprint. In Grid mode (TUI mode) with the Grid text editor - and DuskCC (including its stdlib) loaded, Dusk uses 180KB of RAM on a PC. -* It completely self-hosts on all its target (only PC for now) machines. -* Simple and terse. The core system (all kernels, drivers, filesystems, CC, - core libraries) is less than 8K lines of code. -* Since `text/ed` has reached a usable status, the main author of Dusk has been - developing it from within itself on an old Pentium 75 Mhz with 16mb of RAM and - he's having a blast. - -List of ported codebases: - -* The CVM of [Collapse OS][collapseos] -* The [uxn][uxn] VM -* The `puff()` algorithm from [zlib][zlib] -* The [left][left] text editor. (Still a bit glitchy...) - -List of homegrown applications: - -* C Compiler (see `doc/cc`) -* Text editor (see `doc/text/ed`) - -What's next? See the [roadmap][roadmap]! - -Development happens on [sourcehut][shproj]. - -Unlike Collapse OS which is a personal effort and doesn't lend itself well to -collaboration, Dusk OS' wider scope makes it fitting for a collective effort. -Let's discuss this on its [public mailing list][mailinglist]. - -It's also worth noting that I've started a blog, [Tumble Forth][tumbleforth] -that offers hand-holding into the wonderful world of Dusk OS and Forth. +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][website]. ## Build and run Dusk @@ -262,6 +80,7 @@ Press Escape to return to prompt. You can try the same thing with: * `tests/manual/uxn/mouse.fs` * `text/left.fs` +[website]: http://duskos.org [collapseos]: http://collapseos.org [coswhy]: http://collapseos.org/why.html [creative]: http://collapseos.org/why.html#creative @@ -271,19 +90,4 @@ Press Escape to return to prompt. You can try the same thing with: [port]: fs/doc/design/port.txt [shell]: fs/doc/design/shell.txt [docs]: fs/doc/index.txt -[roadmap]: ROADMAP.md -[shproj]: https://sr.ht/~vdupras/duskos -[mailinglist]: https://sr.ht/~vdupras/duskos/lists -[duskcc]: fs/doc/cc/index.txt -[hal]: fs/doc/hal.txt -[livebootstrap]: https://github.com/fosslinux/live-bootstrap -[m2planet]: https://git.sr.ht/~oriansj/M2-Planet -[builder-hex0]: https://github.com/ironmeld/builder-hex0 -[stage0-uefi]: https://git.stikonas.eu/andrius/stage0-uefi -[fiwix]: https://www.fiwix.org -[uxn]: https://wiki.xxiivv.com/site/uxn.html [varvara]: https://wiki.xxiivv.com/site/varvara.html -[zlib]: https://github.com/madler/zlib -[left]: https://git.sr.ht/~rabbits/left -[demovideo]: https://vimeo.com/800710912 -[tumbleforth]: https://tumbleforth.hardcoded.net/