Page 1 of 1
loading a kernel?
Posted: Thu Mar 07, 2002 12:17 pm
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.
Re: loading a kernel?
Posted: Thu Mar 07, 2002 4:55 pm
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.
Re: loading a kernel?
Posted: Tue Mar 12, 2002 10:36 am
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... :-/
Re: loading a kernel?
Posted: Tue Mar 12, 2002 1:13 pm
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.
Re: loading a kernel?
Posted: Tue Mar 12, 2002 9:16 pm
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!
Re: loading a kernel?
Posted: Tue Mar 12, 2002 10:08 pm
by The_Legend
I have to agree about GRUB, it is a cool loader!
Re: loading a kernel?
Posted: Tue Mar 12, 2002 10:57 pm
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..