the GRUB, the OS, and the bare metal

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
xfelix
Member
Member
Posts: 25
Joined: Fri Feb 18, 2011 5:40 pm

the GRUB, the OS, and the bare metal

Post by xfelix »

Is there a simple way to use the GRUB terminal, to be able to boot my OS on the bare metal?
As of now, I'm using the QEMU that is loading the OS from a floppy disk image with GRUBS stage1 and stage2.
The More I See, The More I See There Is To See!
User avatar
xfelix
Member
Member
Posts: 25
Joined: Fri Feb 18, 2011 5:40 pm

Re: the GRUB, the OS, and the bare metal

Post by xfelix »

berkus wrote:What is the question about?
running on the bare metal means booting the OS on the actual machine. Can this be accomplished via GRUB?
and if so maybe some tips :mrgreen:
The More I See, The More I See There Is To See!
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: the GRUB, the OS, and the bare metal

Post by Brendan »

Hi,
xfelix wrote:
berkus wrote:What is the question about?
running on the bare metal means booting the OS on the actual machine. Can this be accomplished via GRUB?
and if so maybe some tips :mrgreen:
Yes.

First you need to install GRUB somewhere (if it's not already installed). Unfortunately GRUB is too lame to have it's own OS independent installer, so the easiest way to install GRUB is to install another OS (e.g. a distribution of Linux) so that the other OS's installer does all the work.

Note: this same problem effects all systems that try to use GRUB; and eventually this will include your OS when you have to find some way of installing GRUB from your OS's "installation CD" or something.

Then you have to put your OS's boot files in a file system that GRUB can access. If your OS has it's own native file system then GRUB can't/won't support it, and you'll need to either patch GRUB or use a "non-native" file system (where you can't prevent people using different OSs on the same machine from tampering with your boot files).

Then you have to configure GRUB. Unfortunately GRUB is too lame to have it's own inbuilt user-friendly configuration utility; so configuring GRUB depends on which version of GRUB (GRUB-legacy or GRUB2) you're using, and the easiest way to do it is by searching through the GRUB manual (and for GRUB2, hoping the documentation is at least a little bit up-to-date) and using a text editor. Of course because GRUB doesn't have it's own user-friendly configuration; a good user-friendly OS (e.g. Ubuntu) will have it's own scripting magic to auto-generate GRUB's configuration. This means changes you make manually to GRUB's configuration get trashed by these OSs. To fix that you'd have to track down the documentation for the other OS's scripting magic or find some other way to work around the problem (like using GRUB to chainload a different copy of GRUB).

Note: this same problem effects all systems that try to use GRUB to boot multiple/different OSs if one (or more) of those OSs make some attempt at being user-friendly; and eventually this will include your OS when you try to hide the ugly configuration mess from your unsuspecting end-users. Of course I don't think it's possible for your OSs to detect other OSs and automatically work-around the other OS's "GRUB configuration trashing" magic, so you'll have to let all the end-users figure out how to work around the problem on their own if they want to dual boot (kiss "user-friendly" goodbye).


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Post Reply