How to install grub into an .img file?

Posted by Francesco Turco on Super User See other posts from Super User or by Francesco Turco
Published on 2010-04-14T18:03:28Z Indexed on 2010/04/14 18:13 UTC
Read the original article Hit count: 411

Filed under:
|

I did the following:

  1. created an empty .img file with dd
  2. associated it to /dev/loop0 with losetup
  3. created a partition in it with fdisk
  4. formatted such partition with mke2fs
  5. copied a custom GNU/Linux system into that partition

Now I'd like to make the .img file bootable by installing grub into its MBR and /boot directory. My goal is to load the .img file with qemu. It would be better if grub2 is used instead of grub legacy.

Thanks.

© Super User or respective owner

Related posts about linux

Related posts about grub