Page 1 of 1
Good Bootloader
Posted: Mon Apr 21, 2003 5:33 pm
by shad
Is it possible to write a bootloader that inits pmode, uses a FS, and loads the kernel without a stage2 ? If so.. anyone have some source?
Re:Good Bootloader
Posted: Mon Apr 21, 2003 8:07 pm
by _mark
I do not think so, but you did say a "GOOD" bootloader.
_mark()
Re:Good Bootloader
Posted: Tue Apr 22, 2003 12:34 am
by distantvoices
you can write a bootloader with limited fat12 support, which is able to find an image with a compiled-in name in the root directory and loads this to memory prior to doing all the pmode stuff.
but it is better to split it up: in a second stage loader, you 're able to do much more initialization stuff.
Re:Good Bootloader
Posted: Tue Apr 22, 2003 3:00 am
by Pype.Clicker
FAT support and pmode initialization seems much for just 512 bytes, imho ... moreover, you'll end with very little space for error messages, etc. If i were you, i would go for a second stage, located in some reserved space (see struct ext2_super_block.s_r_blocks_count or the reserved sectors count in FAT bootsector (in Bios Parameter Bloc, iirc) )
Re:Good Bootloader
Posted: Tue Apr 22, 2003 1:10 pm
by Tim
It's possible to support any file system and protected mode initialisation if you hard-code a block list in your boot loader. I believe this is the way LILO works.
Re:Good Bootloader
Posted: Tue Apr 22, 2003 1:16 pm
by df
yeah coz each time you rebuild the kernel, you need to reapply lilo so it knows where the kernel is to load it from!
but then, if you move / alter grubs stage2, you get the same effect iirc.
Re:Good Bootloader
Posted: Tue Apr 22, 2003 1:19 pm
by Nairou
Tim Robinson wrote:
It's possible to support any file system and protected mode initialisation if you hard-code a block list in your boot loader. I believe this is the way LILO works.
The sucky thing about block lists is that it falls apart of the kernel is changed or moved. For example, GRUB uses block lists to load its stage2 file, but everytime I defrag the drive, the stage2 file gets moved and GRUB refuses to boot. Have to manually fix it every time. Not exactly a friendly method.
Only alternative I can think of is installing a custom bootsector for whatever filesystem your OS is installed on, which does nothing but traverse the FS and find the stage2 using the BIOS. Not much room for anything else, but at least its stable.
Re:Good Bootloader
Posted: Tue Apr 22, 2003 1:28 pm
by jamescox3k
Nairou, if you set the system attribute on your stage2 file it wont get moved by defrag.
Hope that helps.
In response to the subject I have to agree with _mark(). I dont think it's posible to write a good bootloader of that nature unless you use multiple stages like GRUB