Page 1 of 1

installing Grub on a Harddisk image

Posted: Sun Jun 20, 2004 5:26 pm
by Simage
ok, I've been trying this for a while, got myself a nice sexy hard drive image file, formattered, partioned all taht good stuff. but grub doesn't want to install onto it...


any ideas??

Re:installing Grub on a Harddisk image

Posted: Sun Jun 20, 2004 11:54 pm
by Solar
Version of GRUB?
Which Emulator? (Bochs?)
Exact procedure followed?
Error message?

Come on. Only precise questions get precise answers.

Re:installing Grub on a Harddisk image

Posted: Mon Jun 21, 2004 12:31 pm
by Simage
FreeBSD 5.2-current
GRUB 0.95
bochs 2.1.1

on linux....

dd if=/dev/zero of=~/bochs/30M.disk bs=516096c count=61

losetup /dev/loop0 ~/bochs/30M.disk

fdisk /dev/loop0 #did this in interactive mode...

losetup -d /dev/loop0

losetup -o32256 /dev/loop0 ~/bochs/30M.disk

mke2fs -b1024 /dev/loop0 #blocks can't remember the number of blocks... easy enough to find tho...

detach the loopback again...

move the file to the bsd box.... used SCP for this... simple enough...

mdconfig -t vnode -f bochs/30M.disk
mount -t ext2fs /dev/md0s1 /mnt
grub-install --root-directory=/mnt /dev/md0


and then I get a nice little message saying that md0 is not a bios device...

Re:installing Grub on a Harddisk image

Posted: Mon Jun 21, 2004 8:57 pm
by Curufir
Try the technique outlined here:

http://www.uruk.org/orig-grub/install.html

Only difference would be that you'd create /boot/grub (And copy the stage2 files) when you have the partition hooked up on the loopback device.

Then load up the emulator of your choice from a grub floppy and install to the emulated harddrive.

Should work...I think...maybe ;D.

Re:installing Grub on a Harddisk image

Posted: Mon Jun 21, 2004 9:29 pm
by Simage
fine for floppies... the problem is preserving the partition table tho... if you just do the dd you over write the partition table.... of course... hmm... if you don't copy the full 512 bytes.... that might work....

update :
nope no workie... least not dd to a file... kills the rest of the file... now... to a device... about to test that

Re:installing Grub on a Harddisk image

Posted: Tue Jun 22, 2004 12:40 am
by Solar
You could set up a floppy image file, dd' GRUB (stage1 and stage2) to it, and then boot Bochs from the floppy image. That brings you to a GRUB prompt, and you could install GRUB to the hard disk image file from inside the emulation...?

Re:installing Grub on a Harddisk image

Posted: Tue Jun 22, 2004 10:58 am
by Curufir
That's what I was suggesting Solar.

There's no possibility of just being able to DD to the hard-drive image.