Clarification of GRUB's usage

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
User avatar
samoz
Member
Member
Posts: 59
Joined: Sun Jun 01, 2008 1:16 pm

Clarification of GRUB's usage

Post 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!
User avatar
Zenith
Member
Member
Posts: 224
Joined: Tue Apr 10, 2007 4:42 pm

Post 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:
"Sufficiently advanced stupidity is indistinguishable from malice."
User avatar
samoz
Member
Member
Posts: 59
Joined: Sun Jun 01, 2008 1:16 pm

Post 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?
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post 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.
User avatar
samoz
Member
Member
Posts: 59
Joined: Sun Jun 01, 2008 1:16 pm

Post by samoz »

Do I change the way GRUB boots me in the Multiboot header?
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post 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?
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Post 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)?
Every good solution is obvious once you've found it.
User avatar
samoz
Member
Member
Posts: 59
Joined: Sun Jun 01, 2008 1:16 pm

Post 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.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

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