Simple OS kernel

Enviroment Preparation

OS: Ubuntu 22.04 Vmware Sation

The tools we need

sudo apt install gcc
sudo apt install nasm
sudo apt install make

Down load the source file

git clone https://github.com/k3lpi3b4nsh33/Leviathan_OS.git

Create Your OS

Make file

make -f Makefile

create OSgrub.cfg file

menuentry 'LeviathanOS' {
    insmod part_gpt
	insmod ext2
	set root='hd0,gpt3'
    multiboot2 /boot/HelloOS.bin
    boot
}

you can copy the default system paramenter in /boot/grub/grub.cfg

Modify grub.cfg file

sudo vim /etc/default/grub

modify the variables

GRUB_TIMEOUT=30
GRUB_CMDLINE_LINUX_DEFAULT="TEXT"

Add the OSgrub.cfg content to the end of grub.cfg

copy the HelloOS.bin to /boot/

sudo cp HelloOS.bin /boot/

Reboot the machine and you can see the your OS options in the GNU GRUB

The simple OS kernel have been finished.

Ref


  1. https://blog.csdn.net/chenchengwudi/article/details/116707122