flat assembler
Message board for the users of flat assembler.

Index > OS Construction > chainloded from GRUB, where am I?

Author
Thread Post new topic Reply to topic
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler
How can I tell what sector, or the offset of the partition, I was loaded from? Where's some documentation on what can be depended on after being chainloaded(ie is BDA overwritten by grub?)?
Post 13 Apr 2010, 08:37
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
Tyler,

GRUB itself expects ebx to point to struct grub_multiboot_info if at startup eax==0x2BADB002. You may consult Multiboot Specification and GRUB source as well.
Post 13 Apr 2010, 11:18
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler
Is it that way for chainloading? I want to make my own simple bootloader and chainload it, not using grub as the actual boot loader, just a means of booting my os without having to write it to a cd(no floppy drive) or the mbr. I've set aside a ~20mb partition to install my bootloader to, to boot from.
Post 13 Apr 2010, 21:07
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
Tyler,

In general case you get boot drive number in dl, according to BIOS Boot Specification Version 1.01 [PDF] (it seems that leftovers from int13/02 call partially came to the spec; most BIOSes jump to loaded sector right after 0xAA55 check; dump your BIOS and look at the boot sequence to be sure). Legacy bootsectors then follow standard search sequence to find active partition which was used to read them.

GRUB can load arbitrary data, thus the need for extra specs (like mentioned Multiboot).

How do you suppose to boot from that partition? GRUB/NTLDR/whatever chainload? Active partition flag? It depends.
Post 14 Apr 2010, 04:58
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.