# 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 ```shell LBOS_ARCH=virt cargo build --release --target riscv32imac-unknown-none-elf --features arch_virt ``` ### TURNTBL.DDI ```shell 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 ```shell 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 ```shell 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 ```shell ./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 the qemu start script like so: (note that it may also require root) ```shell ./qemurun.sh /dev/loop0 # or whatever the loopback device you created is called, see losetup -a ``` (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 the following: - `ls` will list files in the root directory - `cd