DEV Community

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

Posted on

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.

Top comments (0)