the operating system for lifeblood
Find a file
2025-09-11 16:47:22 -07:00
.cargo framebuffer working, only cost me 8 hours! 2025-09-10 23:49:17 -07:00
ddi support reloc type 28 and allow turntbl to exit 2025-09-08 22:30:10 -07:00
example initial kernel code 2025-09-08 20:56:44 -07:00
liblbos framebuffer working, only cost me 8 hours! 2025-09-10 23:49:17 -07:00
makeddi initial kernel code 2025-09-08 20:56:44 -07:00
src good enough 2025-09-11 16:37:15 -07:00
turntable turntable works nicer now 2025-09-11 16:47:22 -07:00
.gitignore initial kernel code 2025-09-08 20:56:44 -07:00
build.rs initial kernel code 2025-09-08 20:56:44 -07:00
Cargo.lock initial kernel code 2025-09-08 20:56:44 -07:00
Cargo.toml framebuffer working, only cost me 8 hours! 2025-09-10 23:49:17 -07:00
copy_to_fs.sh initial kernel code 2025-09-08 20:56:44 -07:00
LICENSE initial kernel code 2025-09-08 20:56:44 -07:00
load_ppc.sh initial kernel code 2025-09-08 20:56:44 -07:00
qemurun.sh fix a ton of memory related bugs 2025-09-11 16:00:04 -07:00
qemurun_ppc.sh initial kernel code 2025-09-08 20:56:44 -07:00
README.md add list of shell commands 2025-09-08 21:04:33 -07:00

lifeblood os

extreme warning: this project is in an INCREDIBLY early stage, see warnings section

lifeblood os is the operating system for the lifeblood project
it currently supports riscv32imac, and has some basic support for ppc32 (albeit it probably won't compile, and has no drivers)

warnings

  • as of right now, this project has just gotten to the point where it can run the shell and run programs from it. please keep this in mind.
  • the design of the kernel is very esoteric, this is mainly due to it being targeted for systems with very limited memory, as the lifeblood computer was originally designed around 32K of ram (although we're currently redesigning to include more, and the qemu emulator version requires 5MiB to run)
  • tons of stuff is missing, notably if you develop a program, you may run into a relocation issue due to the limitations of the lbos relocator.
  • speaking of which, if you do not have experience with low level programming, you may currently find it difficult to write programs, however still feel free to explore the code and see what you can do!

building

install the rust toolchain for riscv32imac-unknown-none-elf, then run the following commands for each thing you want to build:

kernel

LBOS_ARCH=virt cargo build --release --target riscv32imac-unknown-none-elf --features arch_virt

TURNTBL.DDI

cd turntable
LBOS_ARCH=riscv32 cargo build --release --target riscv32imac-unknown-none-elf --features arch_riscv32
cd ..
# the following is required to convert the ELF output to the DDI format that lbos uses
cd makeddi
cargo run -- ../turntable/target/riscv32imac-unknown-none-elf/release/turntable ../turntable/target/riscv32imac-unknown-none-elf/release/TURNTBL.DDI
cd ..

EXAMPLE.DDI

cd example
LBOS_ARCH=riscv32 cargo build --release --target riscv32imac-unknown-none-elf --features arch_riscv32
cd ..
# the following is required to convert the ELF output to the DDI format that lbos uses
cd makeddi
cargo run -- ../example/target/riscv32imac-unknown-none-elf/release/example ../example/target/riscv32imac-unknown-none-elf/release/EXAMPLE.DDI
cd ..

getting it running

you'll need to install qemu with support for riscv32, and make a fat32 filesystem image with the shell "TURNTBL.DDI" and optionally the "EXAMPLE.DDI" program.
NOTE FOR FAT32 FILESYSTEM: it is currently required that the sector size is 512 bytes, this is hardcoded; cluster size is not hardcoded.
the best way to do this is to run something like

dd if=/dev/zero of=test.img bs=1M count=256 status=progress
mkdosfs -F 32 test.img
sudo losetup -fP test.img

and then run the ./copy_to_fs.sh script to copy the built files to the filesystem like so

./copy_to_fs.sh /dev/loop0 # or whatever the loopback device you created is called, see losetup -a

note that the script will likely need to be run as root because of linux's requirements for fat32 filesystems; and more importantly that the script expects the binary files to be in the directories above in the build section.
after you do this, the filesystem should be ready for the kernel and you should be able to run a variant of the following to run the kernel

qemu-system-riscv32 -machine virt -bios none -drive if=none,format=raw,file=/dev/loop0,id=disk1 -device virtio-blk-device,drive=disk1 -serial mon:stdio -m 5M -kernel target/riscv32imac-unknown-none-elf/release/lbos

(note that this will take over your terminal and steal CTRL+C, so you'll need to kill it by closing the terminal or manually killing the process)

in the shell you can currently do two things:

  • ls will list files in the root directory
  • <file> will run the program <file> in the root directory, always capitalize your file name!

developing programs

currently, the best way to program is to use rust and link to the liblbos library included in this repo, you should be able to using something like

[dependencies]
liblbos = { git = "https://forge.voremicrocomputers.com/Vore_Microcomputers/lifeblood_os.git" }

but i have not tested this yet so please tell me if it doesn't work

if you want to develop a program in another language, you'll need to investigate everything in this repo to figure out how lbos expects programs to look. (this will be documented eventually)

good places to start with either developing in rust, or porting another language are:

  • turntable, the lbos shell which showcases some basic fs operations and task loading
  • example, a simple hello world program that should give you the bare minimum to build and link correctly
  • liblbos, a helper library that defines structs (all should be C repr) as well as helper functions for syscalls and kernel IPC

feel free to shoot me an email if you have any questions! (nikocs at voremicrocomputers dot com)