loading a kernel?

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
foo bar

loading a kernel?

Post by foo bar »

Could anyone shed some light on the steps to load a kernel image from a bootloader? Prior to the filesystem presence in memory, there's no way to locate a file on the system. I know that GRUB/LILO/Minix Loader can do this, but they are all hairy due to features/flexibility and what not. If possible, anyone could outline simple steps/tricks to load kernel image into memory? Thanks.
K.J.

Re: loading a kernel?

Post by K.J. »

I can't give you step-by-step instructions, but here's a link to a well commented bootsector that loads a kernel off a floppy:

http://www.execpc.com/~geezer/johnfine/bootf02.zip

If you do find info on how how to do it(that's not just some code) please put up a link to it on this message board.

K.J.
Dave Hunt

Re: loading a kernel?

Post by Dave Hunt »

The way minix and linux (I think) do it is to patch the disk address of the kernel into the bootloader. Then the bootloader doesn't need to know about the filesystem. That works fine unless the disk is fragmented and the kernel gets split into multiple segments...  :-/
K.J.

Re: loading a kernel?

Post by K.J. »

The way minix and linux (I think) do it is to patch the disk address of the kernel into the bootloader. Then the bootloader doesn't need to know about the filesystem. That works fine unless the disk is fragmented and the kernel gets split into multiple segments...

I know that GRUB doesn't do this, but I'm not sure about LILO or the Minix loader.

K.J.
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re: loading a kernel?

Post by df »

grub reads file systems, and is the best way to go.

lilo on the other hand, has a patched adderss that gets written into it each time you change the kernel (really BAD way of doing it!), which is why linux users have to update lilo each time they build a new kernel! (ouch)

i know the freebsd loader (btx) does not require this.

go with grub!
-- Stu --
The_Legend

Re: loading a kernel?

Post by The_Legend »

I have to agree about GRUB, it is a cool loader!
Kernel Panic

Re: loading a kernel?

Post by Kernel Panic »

BTW, can GRUB relocate ELF files? My kernel gets loaded with a couple of shared libraries, does GRUB support this? I've almost done the loader for it, but I guess GRUB would be better..
Post Reply