Show HN: OSle – A 510 bytes OS in x86 assembly

2 months ago 3

logo

A tiny and mighty boot sector OS.

osle-demo.mov

OSle is a real-mode OS that fits in a boot sector.

It's written in x86 assembly and, despite its tiny size (only 510 bytes), it packs essential features like:

  • Shell: Run commands and builtins.
  • File System: Read, write, and find files on the system.
  • Process Management: Cooperatively spawn child processes.
  • Userland Software: Comes with pre-built software and an SDK to write your own.

Check out the online demo to see it in action!

📚 Creating your first OSle program

OSle includes a tiny Software Development Kit (SDK) that includes definitions and a toolchain to create your own OSle programs.

Follow the step-by-step tutorial to write your first program!

To develop OSle and OSle programs you will need the following tools:

Installation instructions

Install dependencies using Homebrew:

brew install nasm brew install bochs

Install dependencies using your local package manager, e.g., on Debian:

Build and Run OSle locally

These recipes will compile OSle and use the SDK to compile and bundle all the pre-built programs. Using start will also run bochs right away.

# build and run osle on bochs make start # or # build osle make osle # use QEMU to run it qemu-system-i386 -fda osle.img

Build and Run your OSle program

# ensure you have a working OSle image at osle.img make osle # compile your source to generate my_file.bin sdk/build my_file.s # bundle my_file.bin into the osle.img image sdk/pack my_file.bin # run it! qemu-system-i386 -fda osle.img

Use OSle on a Real Device

Write the built image to a device using dd:

Warning

The following action can damage your hardware. We take no responsibility for any damage OSle might cause.

# generate an OSle image at osle.img make osle # write it on a device sudo dd if=osle.img of=/dev/YOUR_DEVICE bs=512 count=1

Feel free to explore the issues and pull requests to contribute or request features.

MIT

Read Entire Article