Page 1 of 1

install grub 2 to a disk image

Posted: Wed Sep 26, 2012 11:11 am
by mcheung63
Hi All, do you have any tutorial to install grub 2 (not legacy grub) to a disk image?
thanks
from Peter

Re: install grub 2 to a disk image

Posted: Wed Sep 26, 2012 11:31 am
by Combuster
Google has one.

Re: install grub 2 to a disk image

Posted: Wed Sep 26, 2012 2:29 pm
by Brendan
Hi,
mcheung63 wrote:Hi All, do you have any tutorial to install grub 2 (not legacy grub) to a disk image?
I honestly don't know (and google searches did not help me).

As far as I can tell, if you're not using Linux you're screwed, and if you are using Linux you're still screwed most of the time. The best option might be to use a Linux "Live" CD inside an emulator where the disk image looks like a real disk (and not a loopback device).

The thought of porting GRUB 2's installer to my "not a *nix clone" OS one day is enough to convince me that refusing to use GRUB 2 is the only sane approach in the long run. 8)


Cheers,

Brendan

Re: install grub 2 to a disk image

Posted: Thu Sep 27, 2012 2:22 am
by egos
It's easy to write a simple GRUB installer. But yeah you are right! Whether it is necessary?

Re: install grub 2 to a disk image

Posted: Thu Sep 27, 2012 3:32 am
by Combuster
and google searches did not help me
Fourth hit on the first try. Complete with commands and background information and reasons not to do it.

Re: install grub 2 to a disk image

Posted: Thu Sep 27, 2012 11:05 am
by Kazinsal
Use GRUB Legacy. From my experiments, I'm surprised that the FSF actually thinks GRUB2 is a brilliantly amazing bootloader and is the true successor to the good-enough GRUB Legacy. The automated grub.cfg generator creates absolutely massive config files, whereas a legacy menu.lst could boot Ubuntu with five or six lines (instead of a whopping 161!)

And then there's its hatred of installing to things that aren't physical hardware formatted in the way it wants, not the way you want. I'm considering writing an incredibly-cliche-titled short paper: "GRUB2 Considered Harmful".

And for the record, I still haven't found a pre-installed GRUB2 floppy image. Yet I know exactly where I could get GRUB Legacy images with a number of different filesystems...

Re: install grub 2 to a disk image

Posted: Thu Sep 27, 2012 4:51 pm
by egos
Search for "GrubOnFloppy-198" on this forum. I prefer Legacy GRUB too because it's compact and because I have no GRUB 2 packed into one file (or two files) that need for installation of GRUB 2 as my second stage boot loader by my setup tool (I can use modified GRUB as one of my second stage boot loaders).

Re: install grub 2 to a disk image

Posted: Fri Sep 28, 2012 4:46 am
by mcheung63
I can use grub legacy too, but just not grub 2

Re: install grub 2 to a disk image

Posted: Fri Sep 28, 2012 4:48 am
by mcheung63
we have no way to specify a device for grub2-mkdevicemap command, so grub2 probably can't install to a disk image.

Re: install grub 2 to a disk image

Posted: Fri Sep 28, 2012 5:09 am
by egos
It will can be installed if I will find a tool to copy files into floppy image. I have fat_imgen for Windows now but it has no support for nested folders to put /boot/grub/*.* files into image.

Re: install grub 2 to a disk image

Posted: Fri Sep 28, 2012 5:57 am
by Kevin
Brendan wrote:As far as I can tell, if you're not using Linux you're screwed, and if you are using Linux you're still screwed most of the time.
I once managed to install a GRUB 2 from a tyndur VM and still keep the system booting. I don't remember the exact steps; it was a bit ugly in comparison to GRUB 1, but not impossible to figure out. Basically I built an image with grub-mkimage first and then used grub-bios-setup to actually install it to the image. I remember that one of the issues I had was convincing GRUB to take the right search path for its modules.

More on topic, this is the shell script we use on Linux to create tyndur hard disk images with GRUB 2.