LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Virtualization and Cloud (http://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/)
-   -   Making a raw disk bootable (http://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/making-a-raw-disk-bootable-4175467859/)

TKH 06-29-2013 08:09 PM

Making a raw disk bootable
 
Hi, everyone!

I am trying to run my fresh-baked LFS which resides in a raw disk image. For now, QEMU is the best option.

The only problem is that the disk image is currently not bootable. It seems to be impossible to be done with grub, since (as far as I know, correct me if I'm wrong) grub doesn't really deal with disk images.

Does anyone know any possible way to put a bootloader on a raw disk image?

Thank you

Doc CPU 06-30-2013 06:35 AM

Hi there,

Quote:

Originally Posted by TKH (Post 4980960)
The only problem is that the disk image is currently not bootable.

then I wonder how you manage to boot it inside QEMU. If you managed that, you should easily install GRUB from within QEMU.

Quote:

Originally Posted by TKH (Post 4980960)
It seems to be impossible to be done with grub, since (as far as I know, correct me if I'm wrong) grub doesn't really deal with disk images.

I've never tried, but I don't see a reason why GRUB shouldn't install into a disk image file instead of, say, /dev/sda. After all, that's the Unix philosophy: "Everything is a file." It might be troublesome to juggle with the right partition references, but ...
A quick search on Google gave me two recipes on how it can be done:

http://ebroder.net/2009/08/04/instal...-a-disk-image/
http://www.slideshare.net/sukhdotin/...images-5094625

Neither of them is bleeding-edge; they seem to deal with GRUB legacy instead of GRUB2. But anyway, they outline the basic procedure.

[X] Doc CPU

jefro 06-30-2013 03:44 PM

Raw in this case I'd assume is only a term used by qemu to refer to how it uses a virtual hard drive file. Raw, QCOW some other image format won't change how you install a loader. You'd install a loader per LFS documentation. In searches, you don't need to use the term raw. It will give you a different set of results.

TKH 07-01-2013 05:19 PM

Hello, all.

Thank you for your replies.
I might have included some extra info for this matter.

First of all, I built the system from the host system. This is the system I'm using to run QEMU on. I put the entire thing on a loop mounted disk image (which I mentioned earlier as the "raw disk image" on the first post).

With this, I want to run the newly built system on VM on the same host used as the one that built this system.

The problem is that I don't know how to make this disk image bootable.

TKH 07-01-2013 05:21 PM

Quote:

Originally Posted by jefro (Post 4981316)
Raw in this case I'd assume is only a term used by qemu to refer to how it uses a virtual hard drive file. Raw, QCOW some other image format won't change how you install a loader. You'd install a loader per LFS documentation. In searches, you don't need to use the term raw. It will give you a different set of results.

I will start looking with this.
Thank you for your advice.

jefro 07-01-2013 07:47 PM

Qemu can use a virtual hard drive file either as the bootable disk or a secondary. It can also boot to some live cd or LFS type cd to help you.

I don't know how you built this on the host and then transferred it so there may be an issue there.

You make a linux disk (real or virtual) bootable by installing some sort of loader. There are a few choices and some may be difficult after the fact on a LFS built system. Not sure what you have exactly.


All times are GMT -5. The time now is 02:08 PM.