Skip to content

dorosch/OS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OS

This operating system kernel for x86_32 processor. As bootloader used GRUB. To emulation use QEMU.

Quick start

Make and run:

$ make
$ qemu-system-i386 -kernel bin/kernel

Assembling a boot disk

Create raw-image:

$ qemu-img create -f raw hard_disk.img 1G

Prepare the block device driver:

# modprobe -r loop
# modprobe loop max_part=15
# losetup -f hard_disk.img

Check the name assigned to the image:

# losetup
NAME       SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE
/dev/loop0 0      0         0         0  /home/andrey/OS/hard_disk.img

Create a partition table:

# parted /dev/loop0
...
(parted) mklabel msdos
...
(parted) quit
...
# fdisk /dev/loop0
...
n (new partition)
...
p (primary partition 1)
...
4096
...
(default)
...
w

Install GRUB:

# mkfs.ext2 /dev/loop0p1
# mount /dev/loop0p1 /mnt
# mkdir /mnt/boot
# grub-install --root-directory=/mnt  /dev/loop0

Building the kernel:

$ make
$ sudo make install

And run:

$ sudo make run