installing Grub on a Harddisk image

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
Simage

installing Grub on a Harddisk image

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

Re:installing Grub on a Harddisk image

Post by Solar »

Version of GRUB?
Which Emulator? (Bochs?)
Exact procedure followed?
Error message?

Come on. Only precise questions get precise answers.
Every good solution is obvious once you've found it.
Simage

Re:installing Grub on a Harddisk image

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

Re:installing Grub on a Harddisk image

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

Re:installing Grub on a Harddisk image

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

Re:installing Grub on a Harddisk image

Post 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...?
Every good solution is obvious once you've found it.
Curufir

Re:installing Grub on a Harddisk image

Post by Curufir »

That's what I was suggesting Solar.

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