http://linux.derkeiler.com/Mailing-List
It shows a nice trick to get GRUB installed on a disk image.
It is pasted below:
****************************************
Here is a complete
sequence of commands that
- creates a harddisk image
- install multiboot specification compliant kernel to it
- install grub to the harddisk image
----------------------------------------
sudo dd if=/dev/zero of=disk.img bs=1024 count=1048576
sudo parted disk.img mklabel msdos
sudo parted disk.img mkpart primary ext2 0 954
sudo parted disk.img mkpart extended 954 1069
sudo parted disk.img mkpart logical linux-swap 954 1069
sudo parted disk.img set 1 boot on
sudo parted disk.img mkfs 1 ext2
sudo mount -o loop,offset=16384 -t ext2 disk.img mnt
sudo mkdir mnt/grub
sudo cp /boot/grub/stage1 mnt/grub
sudo cp /boot/grub/stage2 mnt/grub
sudo cp /boot/grub/e2fs_stage1_5 mnt/grub
# The contents of the `menu.lst' file should be:
#
# timeout 0
# default 0
# title minimal-kernel
# kernel (hd0,0)/minimal-kernel
#
sudo cp menu.lst mnt/grub
# The contents of the `grub.input' file should be:
#
# device (hd0) disk.img
# root (hd0,0)
# setup (hd0)
# quit
#
sudo grub --device-map=/dev/null < grub.input
# We finally copy a multiboot specification compliant kernel
# to our disk image. You can get the one I have tried here:
#
# http://altair.sk/uploads/minimal-ke
#
# Its homepage :)
#
# http://altair.sk/mediawiki/index.php/Mi
#
sudo cp minimal-kernel mnt
sudo umount mnt
# And you can boot it ...
qemu -m 100 -hda disk.img -boot c -no-kqemu
----------------------------------------
Anonymous
February 7 2009, 18:48:45 UTC 3 years ago
GRUB on a Disk Image
Todd, thanks. Here's a nice walk-through of how to get GRUB on a disk image in article format:http://www.omninerd.com/articles/Install
February 8 2009, 00:56:34 UTC 3 years ago
Re: GRUB on a Disk Image
Thanks for the link!