Good Bootloader

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
shad

Good Bootloader

Post 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?
_mark

Re:Good Bootloader

Post by _mark »

I do not think so, but you did say a "GOOD" bootloader.

_mark()
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:Good Bootloader

Post 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.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Good Bootloader

Post 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) )
Tim

Re:Good Bootloader

Post 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.
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re:Good Bootloader

Post 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.
-- Stu --
Nairou

Re:Good Bootloader

Post 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.
jamescox3k

Re:Good Bootloader

Post 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
Post Reply