Skip to content

Repository files navigation

Kernel From Scratch [B-Gyro]

Hey there! Welcome to our Kernel From Scratch (KFS) project. This started out as part of the 42 Network curriculum, where we’re building an OS kernel from scratch. But here’s the fun part: we’re not just sticking to the basics. We’re adding our own features, customizing it, and going above and beyond the requirements.

Think of it as a fun, experimental project where we’re diving deeper into the world of systems programming and learning along the way. We’re taking the opportunity to add our own spin, explore new ideas, and build something that’s truly ours.

To do:

Base

  • An ASM bootable base that handles multiboot header
  • A linker
  • A basic kernel library, with basics functions and types

  • GDT
  • IDT
  • PCI
  • PIT
  • RTC
    • Date
    • time
      • 24h mode
      • 12h mode
  • Keyboard
    • Querty
    • Azerty

Little Tiny Shell

  • Minimalistic shell
    • clear
    • reboot
    • shutdown
    • logout
    • peek
    • poke
    • lspci
    • screentime
    • datetime
    • timer
    • history
    • help
  • Scroll
  • Cursor
  • History navigation
  • Different Screens (3 TTYs for now)

Signals & Debugging

  • Signal handling
    • SIGINT (Ctrl+C)
    • SIGQUIT (Ctrl+D)
  • Kernel panic
    • Register dumping
    • Double-panic guard (prevents recursive panics from hanging the last line of defense)
  • Stack tracer (walks and prints call frames on panic)
  • Kernel symbol table
    • Generated automatically at build time (two-pass build: pass 1 links a placeholder table to get real addresses via nm, pass 2 links the real table in)
    • Used to resolve function names in panic/stack-trace output

Video Memory

  • VGA
    • Text Mode (16 color)
      • 80x25
      • 80x50
    • Video Mode
      • 320x200x256
      • 640x480x16
  • Fonts
    • 8x8
    • 8x16
  • Print
    • Serial print
    • VGA print

Memory

  • Enable paging
  • User/Kernel Space Memory
  • Physical Memory
    • alloc frame
    • free frame
  • Virtual Memory
    • alloc page
    • free page
  • Memory management
    • mmap
    • munmap
    • malloc
    • calloc
    • free
    • size

Some Graphics

  • Draw Line
  • Draw Shapes (Empty + Filled)
    • Rectangle + Square
    • Triangle
    • Circle
    • Rhombus
  • Draw Array of pixels (To draw images)

Building & Running

The whole toolchain (i386 cross-compiler, nasm, grub-mkrescue, ...) is containerized, so you don't need to install anything besides Docker/QEMU locally.

  • make — builds the kernel and ISO inside the build-env Docker container (defined in docker-compose.yml)
  • make run — builds, then boots the ISO in QEMU
  • make dbg — rebuilds from scratch and boots in Bochs with the debugger attached
  • make re / make fclean — clean build artifacts (also runs inside the container via clean-env)

About

"Meet B-Gyro: our attempt at an operating system inspired by the gyroscope's stability... except ours wobbles more than it balances. Think of it as a gyroscope that moonlights as a boomerang—it keeps coming back with more bugs to fix!" -- by 0rayn and faithByte.

Topics

Resources

Stars

5 stars

Watchers

2 watching

Forks

Releases

Contributors

Languages