Skip to content

fad3lover/SleepyOS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SleepyOS

https://rxosdev.github.io/SleepyOS/

A hobby OS in C + NASM. Boots via GRUB2 (Multiboot2) as a .iso. Works in VirtualBox, VMware, QEMU, and on real hardware.

Features

  • GRUB2 bootloader (Multiboot2 compliant)
  • 32-bit protected mode kernel
  • VGA text driver — 16 colors, scrolling
  • PS/2 keyboard driver (shift, caps lock)
  • Interactive shell with:
    • help — list commands
    • clear — clear screen
    • about — about the OS
    • colors — color palette demo
    • cpuinfo — CPU vendor + feature flags via CPUID
    • meminfo — memory map from Multiboot2
    • reboot — reboot
    • halt — halt CPU

Project Structure

SleepyOS/
├── kernel/
│   ├── multiboot.asm   # Multiboot2 header + entry point
│   ├── kernel.c        # VGA, keyboard, shell
│   └── linker.ld       # Linker script (loads at 1MB)
├── iso/
│   └── boot/
│       └── grub/
│           └── grub.cfg  # GRUB menu config
├── build/              # Build output (generated)
│   └── sleepyos.iso    # Bootable ISO
├── build.sh            # Build script (run in WSL)
└── run.sh              # Launch in QEMU (run in WSL)

Build & Run

1. Install dependencies (one time)

sudo apt update
sudo apt install nasm gcc-multilib binutils \
                 grub-pc-bin grub-common xorriso mtools \
                 qemu-system-x86

2. Build the ISO

cd /mnt/c/Users/diddy/Desktop/SleepyOS
chmod +x build.sh run.sh
./build.sh

Output: build/sleepyos.iso

3. Run in QEMU

./run.sh
# or manually:
qemu-system-x86_64 -cdrom build/sleepyos.iso -m 128M

4. Run in VirtualBox

  1. New VM → Type: Other, Version: Other/Unknown (32-bit)
  2. Skip hard disk
  3. Settings → Storage → Add optical drive → choose build/sleepyos.iso
  4. Start

5. Run in VMware

  1. New VM → Other → Other
  2. Use ISO image: build/sleepyos.iso
  3. Start

6. Write to USB (real hardware)

# Replace /dev/sdX with your USB drive - double check with lsblk!
sudo dd if=build/sleepyos.iso of=/dev/sdX bs=4M status=progress
sudo sync

Boot your machine from USB (spam F12/F2/Del at POST to get boot menu).

How It Works

  1. GRUB reads the ISO, finds sleepyos.elf, validates the Multiboot2 header
  2. GRUB loads the ELF into memory at 1MB and switches to 32-bit protected mode
  3. _start in multiboot.asm sets up a stack and calls kernel_main(magic, mb2_info)
  4. Kernel clears VGA, draws the banner, and enters the shell input loop
image

About

lightest version of sleepyos

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors