cowos moves to 64bit! and framebuffers too ig

This commit is contained in:
cowmonk 2025-05-23 17:24:25 -07:00
parent b78e4fc24d
commit babc65305d
32 changed files with 4074 additions and 146 deletions

View file

@ -4,30 +4,24 @@
Custom OS from scratch in C
# Notes
This only supports 32bit for now, please DO NOT compile with 64bit or it'll fail to boot
**Heavily UNDER DEVELOPMENT**
## compilation of any component
You are required to get your own cross C compiler. This is because normal C compilers for your Linux distro (assuming that you are on Linux) will optimize against your own libs and other things. This OS doesn't exist yet, so this is a big no no in OS development. Another thing is that you want to compile for 32 bit, so you'll need to cross compile anyways...
Currently just boots and well, does nothing lol.
### general c files
## BUILDING
You'll need a few things:
- LLVM/Clang (default C compiler)
- LLD (linker)
- xorriso (iso creation)
- git
- make
- qemu (for virtual machine)
After acquiring those just run make and it'll do everything for you:
```bash
i386-elf-gcc -c kernel.c -o kernel.o -std=c99 -ffreestanding -O2 -Wall -Wextra # i386 is the 32 bit version of x86
# also please compile with the -Iinclude flag to include the libraries like string.h in the arch
make
```
### "compiling" the "boot stub"
```bash
i386-elf-as boot.s -o boot.o
```
### linking the "compiled" boot stub w/compiled kernel img
```
i386-elf-gcc -T linker.ld -o cowos.bin -ffreestanding -O2 -nostdlib boot.o kernel.o
```
## Getting it bootable
You'll need grub and mtools. First move the compiled cowos.bin to isodir/boot. Then run the following command:
```bash
grub-mkrescue isodir/ -o cowos.iso
```
Now you can enjoy running this in qemu lol.
# Credits
- [nolibc](https://github.com/wtarreau/nolibc): libc-less wrapper to make tiny static executables for simple programs.
- [Limine](https://github.com/limine-bootloader/limine): modern, advanced, portable, multiprotocol bootloader and boot manager.