Page 1 of 1

Clarification of GRUB's usage

Posted: Wed Jun 04, 2008 7:22 am
by samoz
Hey guys, so I've scoured the internet for information for GRUB, and I must be reading something wrong because it seems like everything is conflicting information.

When I use GRUB to load my OS, do I need to do anything related to protected mode? Is that handled by GRUB? What about the A20 line?

Thanks!

Posted: Wed Jun 04, 2008 7:28 am
by Zenith
Well, yes, you still will have to deal with some aspects of protected mode.

GRUB (but only when loading a multiboot-compliant kernel, IIRC) will enter protected mode, enable the A20 line, etc. for you. When it loads your OS, its already running in segmented protected mode.

However, most people will want to change GRUB's default pmode environment, so they load their own GDT, implement paging, V86, multitasking, etc. - so there's still much to do after GRUB loads your kernel.

You might be interested in the GRUB wiki article.

Hope this helps! :wink:

Posted: Wed Jun 04, 2008 7:40 am
by samoz
Very much! Thanks you!

You said that I would want to change the default pmode environment, by that do you mean making changes in GRUB while still in real mode? Or am I misunderstanding?

Posted: Wed Jun 04, 2008 7:48 am
by JamesM
samoz wrote:Very much! Thanks you!

You said that I would want to change the default pmode environment, by that do you mean making changes in GRUB while still in real mode? Or am I misunderstanding?
No - GRUB loads you in protected mode, but in a minimal protected mode, so no paging, flat segments etc. It's possible you may want to change the environment GRUB starts you in to match your own wants/needs.

Posted: Wed Jun 04, 2008 7:49 am
by samoz
Do I change the way GRUB boots me in the Multiboot header?

Posted: Wed Jun 04, 2008 8:01 am
by JamesM
samoz wrote:Do I change the way GRUB boots me in the Multiboot header?
It depends on what you mean by "the way GRUB boots me". What exactly do you need to change?

Posted: Wed Jun 04, 2008 8:03 am
by Solar
Have you had a look at the multiboot header, in the GRUB / Multiboot specification? It should tell you pretty exactly what you can and cannot do with it.

Did you have a look at the Intel manuals, and an overall idea of what e.g. a GDT is about (and how to change one)?

Posted: Wed Jun 04, 2008 8:21 am
by samoz
It depends on what you mean by "the way GRUB boots me". What exactly do you need to change?
I don't think I know what I mean lol

I meant mostly your reference to a lack of paging and flat segments in an earlier post. Is the multiboot header where I can enable stuff like that?

I'll look into it a little more and actually sit down for a thorough read of the multiboot specs when I have some free time and I'm sure more questions will pop up at that time about specifics.

Posted: Wed Jun 04, 2008 8:58 am
by JamesM
samoz wrote:
It depends on what you mean by "the way GRUB boots me". What exactly do you need to change?
I don't think I know what I mean lol

I meant mostly your reference to a lack of paging and flat segments in an earlier post. Is the multiboot header where I can enable stuff like that?

I'll look into it a little more and actually sit down for a thorough read of the multiboot specs when I have some free time and I'm sure more questions will pop up at that time about specifics.
No - GRUB loads you with flat segments and no paging. It's up to you to enable them if you so choose.