[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] installing a boot loader into the disk images

From: Mark A. Williamson
Subject: Re: [Qemu-devel] installing a boot loader into the disk images
Date: Sat, 11 Sep 2004 16:11:21 +0100
User-agent: KMail/1.6.2

> > The loop block device is handy becuase it allows you to make a file
> > appear as a block device to the rest of the OS.  Unfortunately, it does
> > not support partitions within the "file" device.  There are patches
> > available on the internet which if applied to your host kernel may enable
> > this...
> Lets take this approach.
> Now my problem is:
> I use a disk with one partition. I put the kernel on thr proper location
> and install lilo/grub on it. Will this work? I think the boot loader will
> be looking for a normal setup, not this hack.

I skirted round this issue a bit ;-)

The loop device would make the file appear like a disk, so you could install a 
bootloader.  You've still, unfortunately, got to get partitions onto it 

A brief test suggests that fdisk will manipulate disk files directly, so you 
could probably partition your image using that.  You will be able to losetup 
it then but the kernel won't see the partitions since loop block devices 
don't support partitions.

Depending on whether Lilo / Grub actually use the Linux partition support this 
may still be enough to allow an install to the loop device.

You'll have to figure out a way of getting files onto this disk image at some 
stage :-)  Some possibilities:
* Use a distro running in QEmu to copy the files across (which it could in 
turn get from NFS, SAMBA, etc.)
* Patch your host kernel so that it understands partitions in loop devices
* Use losetup to individually map the partitions to loop devices, using the -o 
(offset) switch, then mount those.  (I saw a script for doing this on a 
mailing list somewhere - Google knows)

Remember while doing all this to avoid having two "views" of the disk at once 
(e.g. avoid setups where the same part of the file appears at multiple 
mountpoints / devices simultaneously, since this may corrupt the image).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]