toaruos/README.md

136 lines
7.7 KiB
Markdown
Raw Normal View History

2018-02-25 11:18:09 +03:00
# ToaruOS-NIH
2018-07-21 19:43:58 +03:00
![screenshot](https://i.imgur.com/G8G1dwf.png)
2018-02-25 11:18:09 +03:00
2018-08-10 02:26:24 +03:00
ToaruOS-NIH is a distribution of ToaruOS which contains no third-party components. Its bootloader, kernel, modules, C library, and userspace applications and libraries are all written by the ToaruOS development team and direct contributors.
2018-04-21 16:34:15 +03:00
2018-04-23 02:30:05 +03:00
This distribution aims to eventually replace the core of the mainline ToaruOS, with the various third-party components building against our own C library. This is a long-term project, and developing the C library to the point where it is useful for this purpose is not expected to be completed for quite some time.
2018-02-25 11:16:16 +03:00
2018-07-21 19:43:58 +03:00
## Pre-Built Images
Releases are occasionally posted on [GitHub](https://github.com/klange/toaru-nih/releases), and nightlies are available [from toaruos.org](https://toaruos.org/nih.iso).
### Running ToaruOS-NIH
2018-07-22 06:18:11 +03:00
It is recommended that you run ToaruOS-NIH in an emulator - specifically Qemu or VirtualBox, though some testing has been done in VMware Workstation (reasonable, but missing driver support) and Bochs (not recommended).
2018-07-21 19:43:58 +03:00
#### QEMU
1GB of RAM and an Intel AC'97 sound chip are recommended:
```
qemu-system-i386 -cdrom image.iso -serial mon:stdio -m 1G -soundhw ac97,pcspk -enable-kvm -rtc base=localtime
```
2018-07-22 06:20:25 +03:00
You may also use OVMF with the appropriate QEMU system target. Our EFI loader supports both IA32 and X64 EFIs:
2018-07-21 19:43:58 +03:00
```
qemu-system-x86_64 -cdrom image.iso -serial mon:stdio -m 1G -soundhw ac97,pcspk -enable-kvm -rtc base=localtime \
-bios /usr/share/qemu/OVMF.fd
```
2018-07-22 06:20:25 +03:00
```
qemu-system-i386 -cdrom image.iso -serial mon:stdio -m 1G -soundhw ac97,pcspk -enable-kvm -rtc base=localtime \
-bios /path/to/OVMFia32.fd
```
2018-07-21 19:43:58 +03:00
#### VirtualBox
ToaruOS should function either as an "Other/Unknown" guest or an "Other/Uknown 64-bit" guest with EFI.
All network chipset options should work except for `virtio-net` (work on virtio drivers has not yet begun).
2018-07-22 06:18:11 +03:00
It is highly recommended, due to the existence of Guest Additions drivers, that you provide your VM with at least 32MB of video memory to support larger display resolutions - especially if you are using a 4K display.
2018-07-21 19:43:58 +03:00
Ensure that the audio controller is set to ICH AC97 and that audio output is enabled (as it is disabled by default in some versions of VirtualBox).
Keep the system chipset set to PIIX3 for best compatibility. 1GB of RAM is recommended.
#### VMWare
Support for VMWare is experimental.
As of writing, the following configuration has been tested as functioning:
- Create a virtual machine for a 64-bit guest. (ToaruOS-NIH is 32-bit, but this configuration selects some hardware defaults that are desirable)
- Ensure the VM has 1GB of RAM.
- Remove the hard disk from the VM.
- Remove the sound card from the VM. VMWare implements an Ensoniq chipset we do not have drivers for.
- Manually set the `firmware` value to `efi` in the VMX file. The BIOS loader has known issues under VMWare.
- For network settings, the NAT option is recommended.
#### Bochs
Using Bochs to run ToaruOS is not advised; however the following configuration options are recommended if you wish to try it:
- Attach the CD and set it as a boot device.
- Ensure that the `pcivga` device is enabled or ToaruOS will not be able to find the video card through PCI.
- Provide at least 512MB of RAM to the guest.
- If available, enable the `e1000` network device (this has never been tested).
- Clock settings of `sync=realtime, time0=local, rtc_sync=1` are recommended.
2018-04-23 02:30:05 +03:00
## Implementation Details
All source code for the entire operating system is included in this repository.
### Kernel
The NIH kernel is essentially the same as the mainline kernel, though the PCI vendor and device ID list has been replaced with our own slimmed down version. This was the only third-party element of the ToaruOS kernel. Additionally, the headers for the kernel have been relocated from their original directories to facilitate a cleaner build. The NIH kernel should be considered the latest version of the ToaruOS kernel.
### Bootloader
2018-04-28 15:29:00 +03:00
Mainline ToaruOS shipped with GRUB, which provided a multiboot-compatible ELF loader. To that end, our native bootloader also implements multiboot. However, as writing a feature-complete bootloader is not a goal of this project, the native bootloader is very limited, supporting only ATAPI CDs on systems with El Torito "no-emulation" support. It is not guaranteed to work on real hardware, but has been tested in QEMU, Bochs, VirtualBox, and VMware Player.
2018-04-23 02:30:05 +03:00
### Userspace
2018-03-15 07:13:22 +03:00
The userspace includes a work-in-progress C standard library, the ToaruOS native libraries, the compositor (using only in-house graphics routines), and various other first-party utilities and applications.
2018-02-25 11:16:16 +03:00
## Building
2018-07-11 05:02:13 +03:00
First, ensure you have the necessary build tools, which are mostly the same as mainline ToaruOS: `yasm`, `xorriso`, `genext2fs` (with Debian patches), `python`, `mtools` (for building FAT EFI payloads) and `gnu-efi` to build the EFI bootloader (I'll explore implementing necessary headers and functionality myself in the future, but for now just pull in gnu-efi and make my life easier).
2018-03-16 16:42:36 +03:00
2018-03-21 10:56:00 +03:00
Run `make` and you will be prompted to build a toolchain. Reply `y` and allow the toolchain to build.
2018-02-25 11:16:16 +03:00
2018-07-23 14:11:22 +03:00
## Backwards Compatibility Notes
No ABI or API compatibility is guaranteed through the development of ToaruOS-NIH. Until a larger corpus of third-party software is ported to our new C library, APIs may change to improve or simplify library use, or to fix bugs. Even kernel ABI compatibility is not guaranteed as system calls are improved or made more compliant with expectations of POSIX or the C standard.
2018-02-25 11:16:16 +03:00
## Rationale
ToaruOS's kernel is entirely in-house. Its userspace, however, is built on several third-party libraries and tools, such as the Newlib C library, Freetype, Cairo, libpng, and most notably Python. While the decision to build ToaruOS on these technologies is not at all considered a mistake, the possibility remains to build a userspace entirely from scratch.
## Goals
2018-07-23 14:11:22 +03:00
Many of our initial goals have been met, including sufficient C library support to port Python 3.6.
2018-02-25 11:16:16 +03:00
2018-07-23 14:11:22 +03:00
Our current unmet goals include:
2018-02-25 11:16:16 +03:00
2018-07-23 14:11:22 +03:00
- Enough C library support to port binutils/gcc (needs enough C to get libstdc++ working)
- Plugin systems for the compositor and general graphics APIs to support third-party libraries in the future (including support for Cairo as a backend for the compositor, PNG support in the graphics sprite API, Truetype rendering support through FreeType in the text rendering engine).
- Porting the complete native desktop experience from ToaruOS mainline (which mostly means porting Python prototype applications and libraries to C).
2018-03-19 06:20:40 +03:00
## Project Layout
- **apps** - Userspace applications, all first-party.
- **base** - Ramdisk root filesystem staging directory. Includes C headers in `base/usr/include`, as well as graphical resources for the compositor and window decorator.
2018-07-23 14:11:22 +03:00
- **boot** - Bootloader, including BIOS and EFI IA32 and X64 support.
- **cdrom** - Staging area for ISO9660 CD image, containing mostly blank shadow files for the FAT image.
- **fatbase** - Staging area for FAT image used by EFI.
2018-03-19 06:20:40 +03:00
- **kernel** - The ToaruOS kernel.
- **lib** - Userspace libraries.
- **libc** - C standard library implementation.
- **linker** - Userspace dynamic linker/loader, implements shared library support.
- **modules** - Kernel modules/drivers.
- **util** - Utility scripts, staging directory for the toolchain (binutils/gcc).
2018-07-23 14:11:22 +03:00
- **.make** - Generated Makefiles.
2018-08-10 02:26:24 +03:00
## Mirrors
ToaruOS-NIH is regularly mirrored to multiple Git hosting sites. The recommended source is [Gitlab](https://gitlab.com/toaruos/toaru-nih).
- Gitlab: [toaruos/toaru-nih](https://gitlab.com/toaruos/toaru-nih)
- GitHub: [klange/toaru-nih](https://github.com/klange/toaru-nih)
- Bitbucket: [klange/toaru-nih](https://bitbucket.org/klange/toaru-nih)
- ToaruOS.org: [klange/toaru-nih](https://git.toaruos.org/klange/toaru-nih)