Installing GRUB to an hd image
- alethiophile
- Member
- Posts: 90
- Joined: Sat May 30, 2009 10:28 am
Installing GRUB to an hd image
I can't figure out how to install GRUB to an HD image so I can test it on an emulator. I create a bootable image as it says to in the GRUB wiki page and in the Grub docs, create the new os image, make a filesystem on it (I have tried both FAT16 and ext2), and boot with Qemu. When I try to install it, it gives me an error similar to 'cannot mount selected partition'. Also, when I try the find command on files I know are in the image, it returns 'cannot find file'. Does anyone know how to do this?
If I had an OS, there would be a link here.
Re: Installing GRUB to an hd image
Hi,
The workflow pretty much goes like this:
1) Create the (blank) HDD image using 'dd' or similar.
2) Mount it as loopback and run fdisk to set up the partition table. Create your partitions here.
3) Unmount. Remount as loopback with a byte offset to the start of the first partition.
4) Run mke2fs/mkdosfs on the loopback device to create the FS.
5) Copy the grub stage1/stage2 to /boot.
6) Create a menu.lst.
7) Copy your OS across and unmount.
See Loopback Device.
James
The workflow pretty much goes like this:
1) Create the (blank) HDD image using 'dd' or similar.
2) Mount it as loopback and run fdisk to set up the partition table. Create your partitions here.
3) Unmount. Remount as loopback with a byte offset to the start of the first partition.
4) Run mke2fs/mkdosfs on the loopback device to create the FS.
5) Copy the grub stage1/stage2 to /boot.
6) Create a menu.lst.
7) Copy your OS across and unmount.
See Loopback Device.
James
- alethiophile
- Member
- Posts: 90
- Joined: Sat May 30, 2009 10:28 am
Re: Installing GRUB to an hd image
Thanks. I hadn't been making a partition table, just using the whole disk.
If I had an OS, there would be a link here.