Skip to content

Bootloader and kernel project worked on between work and studying

License

Notifications You must be signed in to change notification settings

Yggdrasill/kernel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Building
--------

Run make.

Creating an image
-----------------

The image can be created by:

dd if=/dev/zero of=image.img bs=512 count=1000

After the image has been created, you should put the bootloader in it.

dd if=boot/boot.bin of=image.img bs=512 count=4 conv=notrunc

The "count" argument can be explained by that the bootloader makes assumptions
about where on disk the next stage will be. Stage 1 is limited to 512 bytes, and
stage 1.5 is limited to 1536 bytes, which is enough to put the system in
protected mode and jump to the actual stage two, which is only limited by the
empty space between it and the first partition (on legacy systems ~30kiB, on
modern systems using LBA addressing it's ~1MiB). The bootloader assumes that
stage 2 can be found at 2048 bytes.

Stage 2 should be put in the image offset 2048 bytes from the start of the
image. Thus, the command is:

dd if=boot/stage2.bin of=image.img bs=512 seek=3 conv=notrunc

It can then be used in a virtual machine, although you may have to convert the
image using qemu-img or some other program. Personally, I use qemu, and I don't
care about the warning that the raw image creates so:

qemu-system-i386 image.img

Or:

qemu-system-i386 -enable-kvm image.img

Note that the exact executable may not be called qemu-system-i386. It is on
Debian, which is the distribution that I use.

Notes
-----

The ASM for the bootloader is written on the assumption that the assembler is
nasm, so that is a requirement to build it. You should install nasm if you don't
have it.

A README documenting various x86 things can be found in boot/, and this README
also includes a rather long section on the A20 gate and what the current goals
for stage 2 is.

This README will be extended as the project grows in size, presently it only has
the beginnings of a bootloader.

About

Bootloader and kernel project worked on between work and studying

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published