mirror of
https://github.com/ApfelTeeSaft/Shard.git
synced 2026-08-26 19:33:34 +00:00
main
ShardOS
ShardOS is a simple operating system built from scratch for educational purposes. This project demonstrates the basics of OS development, including bootloading, kernel development, and simple hardware interaction.
Screenshot
Prerequisites
To build ShardOS, you need the following tools installed on your Linux system:
nasm(Netwide Assembler)gcc(GNU Compiler Collection)ld(GNU Linker)qemu(for emulation and testing)
You can install these tools using your package manager. For example, on Debian-based systems like Ubuntu, run:
sudo apt update
sudo apt install nasm gcc make qemu-system-x86
Building ShardOS
1. Assemble the Bootloader
Assemble the bootloader using nasm:
nasm -f elf32 boot/boot.asm -o boot.o
2. Compile the Kernel
Compile the kernel using gcc:
gcc -m32 -ffreestanding -c kernel.c -o kernel.o
3. Link the Object Files
Link the bootloader and kernel using ld:
ld -m elf_i386 -T link.ld -o ShardOS.bin boot.o kernel.o
4. Create a Bootable Image
Create a bootable image by concatenating the boot sector and the kernel:
dd if=/dev/zero of=boot.img bs=512 count=2880
dd if=ShardOS.bin of=boot.img conv=notrunc
5. Run with QEMU
Run your OS using QEMU:
qemu-system-i386 -fda boot.img
File Structure
boot/boot.asm: Assembly code for the bootloader.kernel.c: C code for the kernel.link.ld: Linker script for combining the bootloader and kernel into a single binary.deprecated/stage1/2.asm: Old attempt at making a Standalone OS purely in Assembly
Contributing
Contributions are welcome! Feel free to submit issues or pull requests.
License
This project is licensed under the GNU General Public License v3.0.
Languages
Assembly
72.1%
C
25.2%
Linker Script
2.7%