How to load kernel file through bootloader in a memory?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
likeagunfire
Posts: 11
Joined: Wed Apr 08, 2009 2:21 pm

How to load kernel file through bootloader in a memory?

Post by likeagunfire »

What's the right way to load kernel file through boot loader in a memory (the kernel is written with C, for example, "Hello world."). Um, I don't need someone to tell me, exactly how to write in boot loader the "Hello world", but how to load another file (that is a kernel file)?
User avatar
NickJohnson
Member
Member
Posts: 1249
Joined: Tue Mar 24, 2009 8:11 pm
Location: Sunnyvale, California

Re: How to load kernel file through bootloader in a memory?

Post by NickJohnson »

It depends on what bootloader you are using. If you have GRUB set up properly on a floppy or floppy image, with the kernel in the root directory, you can put the lines:

title Hello World
kernel (fd0)/kernel

in grub/menu.lst

Setting up a floppy from scratch with a bootloader is a bit more tricky, and depends a lot on your OS. If you run Linux, look at JamesM's kernel tutorial (http://www.jamesmolloy.co.uk/tutorial_html/index.html), and if you run Windows, look at bkerndev's tutorial (http://www.osdever.net/bkerndev/index.php). Both have good basic bootloader/image/emulator setups, and are actually almost identical in that respect.
User avatar
kop99
Member
Member
Posts: 120
Joined: Fri May 15, 2009 2:58 am

Re: How to load kernel file through bootloader in a memory?

Post by kop99 »

Another way is that you have your own bootloader...
It's like redundancy work, but it's good experience for you.
If you decide to make your own bootloader, Wiki's babystep1~babystep8 is good reference.
http://wiki.osdev.org/Babystep1
Post Reply