DEV Community

Cover image for How to Create a Simple Operating System (Kernel Only) with C++
Marcos Oliveira
Marcos Oliveira

Posted on

1

How to Create a Simple Operating System (Kernel Only) with C++

🔊 In this video I showed step by step the process to create a kernel which is the basis for an Operating System. The boot was performed on the physical machine and we were able to print directly to the VGA with a 32-bit system made with C++ and GNU Assembler.


To build on your machine

Use the package manager to install GCC, make, as and ld

sudo apt install build-essential
Enter fullscreen mode Exit fullscreen mode

Clone the repository and compile:

Then just compile:

git clone https://github.com/terroo/terminalroot-os
cd terminal-root-os/
make
Enter fullscreen mode Exit fullscreen mode

To test on QEMU, for example

sudo apt install qemu-kvm
Enter fullscreen mode Exit fullscreen mode

And then test:

qemu-system-i386 -kernel terminal-root-os.bin
Enter fullscreen mode Exit fullscreen mode

Even with qemu-system-x86-64 -kernel terminal-root-os.bin.

If you have a virtual or physical machine with GRUB Legacy, you can move to /boot and edit grub.cfg:

Example:

sudo mv terminal-root-os.bin /boot/
sudo vim /boot/grub/grub.cfg
Enter fullscreen mode Exit fullscreen mode

Add a new entry to GRUB:

### BEGIN TERMINALROOTOS

menuentry 'Terminal Root OS' {
  multiboot /boot/terminal-root-os.bin
  boot
}
### END TERMINALROOTOS
Enter fullscreen mode Exit fullscreen mode

Watch the Video

The video is in Portuguese, but you can use Youtube's automatic translator

How to Create a Simple Operating System (Kernel Only) with C++

Click on the image to watch the video


Terminal Root OS repository on GitHub: https://github.com/terroo/terminalroot-os.

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

If this article connected with you, consider tapping ❤️ or leaving a brief comment to share your thoughts!

Okay