The Polycule OS
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
anna f5db4e4a25
mm/slab: add object caches
This was the last major obstacle in being able to
manage virtual memory maps.  Object caches are
custom allocators that allow for more fine-grained
allocation policies, including being able to use
memory from the DMAP region.
1 year ago
.idea clion: add code style config 2 years ago
.vscode libc: refactor a couple of string routines 2 years ago
arch/x86 x86/mm: fix __boot_clear_page 1 year ago
cmake happy new year 2022 uwu 2 years ago
doc mm: refactor page allocator 2 years ago
include mm/slab: add object caches 1 year ago
kernel mm/slab: add object caches 1 year ago
lib mm: refactor page allocator 2 years ago
.editorconfig initial commit uwu 2 years ago
.gitignore boot: add basic multiboot support 2 years ago
CMakeLists.txt happy new year 2022 uwu 2 years ago
COPYRIGHT update license terms 2 years ago update license terms 2 years ago

GayBSD Kernel

This is the source tree of the GayBSD kernel. There isn't much to see here yet.

NOTE: Unfortunately, due to some issues with the CNPL, the GayBSD project is currently under a proprietary license until further notice. See the COPYRIGHT file for details. Naturally, we strongly advise against partaking in homosexual conduct and/or criminal activity.


The kernel compiles to an x86-64 ELF file that implements the GNU Multiboot 2 specification. i386 support is pretty much dead, simply due to the fact that the additional housekeeping for maintaining correct memory mappings in this constrained address space has turned out to be way too much as to be feasible for the current size of this project. Furthermore, pretty much every desktop CPU manufactured since around 2005 supports 64-bit anyway.

Required Tools

  • A POSIX operating system (use WSL if you find yourself in the unfortunate situation of running Windows)
  • CMake >= 3.14
  • clang, with support for the x86_64-pc-none-elf target
    • You probably won't need to recompile clang as it has cross compiling capabilities built in, at least it works fine on my Arch Linux machine
    • GCC should work in theory, but this isn't tested at all and you'll most likely need to compile it manually to make it spit out i686 ELFs
  • A linker that is able to work with GNU LinkerScripts (clang, GNU ld should work too but as already stated you should avoid GNU stuff if possible)
  • Git

Actually Compiling the Thing

cmake -B build -S .
cmake --build build

The compiled kernel image will be in ./build/gaybsd_image.elf. You may want to tweak come configuration values in build/CMakeCache.txt, either using a plain text editor or cmake-gui(1). See cmake/config.cmake for all configuration options.


In its current state, GayBSD is barely more than a simple program writing stuff to the BIOS character framebuffer, so you probably don't want to be running it on bare metal. Seriously, please don't do this, i have virtually no experience with x86 and no idea if what i'm doing could damage your hardware. Instead, you are way better off using QEMU or something similar. You will need a Multiboot 2 compliant bootloader, preferably GRUB (you can use any Linux ISO to set everything up). Install GRUB for the i386-pc target, and add the following entry to grub.cfg:

menuentry 'GayBSD' {
        insmod part_gpt
        search --no-floppy --fs-uuid --set=root <root partition uuid>

        multiboot2 /boot/gaybsd_image.elf

Copy ./build/gaybsd_image.elf to /boot/gaybsd_image.elf on the virtual disk that you are booting off of. After that, you should be ready to go. Good luck!


Copyright (c) 2021 The GayBSD Project. All rights reserved.

There is NO WARRANTY, to the extent permitted by applicable law. Portions of this software are derived from The FreeBSD Project. See the COPYRIGHT file for details, including the full terms and conditions.