Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How would I write a bootloader to load a c kernel?

I am learning NASM as I write bootloaders. So far I have a hello world bootloader. I want to know how to link a c program to it and have the bootloader load it into memory and start executing it's entry point function. I need NASM code as I am a NASM n00b. Thank you very much for you help.

EDIT: Basically I need to know how to link the c program and I need NASM code to tsrat it's entry point function. Any gotchas I should know about?

like image 615
user701329 Avatar asked Feb 10 '12 07:02

user701329


People also ask

How does the bootloader load the kernel?

Boot loaders load kernel images into memory and hand control of the CPU over to the newly loaded kernel. To make your new kernel work, you must tell the boot loader about the kernel. If you have never worked with a boot loader before, you need to know how a PC boots from the hard disk.

How is the bootloader loaded?

A boot loader is a small program which is started from the Master Boot Record (MBR) of a hard disk, floppy disk, CD/DVD or other storage device. It is loaded by the computer's BIOS after the BIOS has initialized a small portion of the system's hardware.


1 Answers

Although this tutorial is for C++, its the exact same procedure (the tutorial lists the parts that are C++ specific, which are just the static ctors & dtors).

when ever your are having problems in this area, osdev.org generally has the answer or a tutorial

like image 144
Necrolis Avatar answered Oct 06 '22 17:10

Necrolis