|
All checks were successful
Cargo Build & Test / Rust Build & Test (push) Successful in 44s
|
||
|---|---|---|
| .bundle | ||
| .cargo | ||
| .github/workflows | ||
| cat | ||
| color | ||
| coreutils@615b562b64 | ||
| display | ||
| echo | ||
| fb | ||
| id | ||
| init | ||
| input | ||
| ls | ||
| ps | ||
| root | ||
| schelp | ||
| segfault | ||
| .config | ||
| .config.source | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| default_cpio_list | ||
| drmnotes | ||
| linux | ||
| linux_bakery | ||
| Makefile | ||
| no_root.patch | ||
| README.md | ||
AzathOS
AzathOS (previously called Real Linux From Scratch) is userland for Linux written from scratch. I started this project to get a better understanding of the kernel. My goal is to create a usable UNIX environment with my own init, shell and utilities.
All code is written in Rust and limited to just a few common libraries like libc, chrono, clap and serde.
Boot using systemd containers
make && make rootfs
sudo systemd-nspawn -D rootfs -b
It should be noted that systemd-nspawn can alter the permissions on the directory.
Alternatively, you can import the image.
make && make tar
importctl import-tar azathos.tar.xz --class=machine
sudo systemd-nspawn -M azathos -b
However, because there is no system bus in AzathOS, machinectl is limited.
Intramfs (old method)
Currently AzathOS works by creating a tiny filesystem in a cpio archive.
This is then used as the initramfs for the kernel supplied with -initrd flag in qemu.
The kernel will then decompress my filesystem on top of the initramfs already baked into the kernel.
The kernel creates that initramfs during compilation according to default_cpio_list, it creates the /dev/console device and also the /root mountpoint.
Because AzathOS does not actually intend to mount a root disk and doesn't use a /root directory you can patch the kernel to not create that directory.
See no_root.patch.
See also Qemu Direct Linux Boot.
Build into the kernel
It is possible to build the initrd into the kernel itself.
This is done by specifying the filesystem files, rootfs in CONFIG_INITRAMFS_SOURCE.
You also want to include default_cpio_list which will ensure a console device is created.
CONFIG_INITRAMFS_SOURCE="azathos/rootfs azathos/default_cpio_list"
If you also want to have some decent size, I recommend turning off all the debug options I configured and set CONFIG_CC_OPTIMIZE_FOR_SIZE.