[Lguest] Creating distro root disk image
Rusty Russell
rusty at rustcorp.com.au
Fri Aug 17 14:03:51 EST 2007
On Thu, 2007-08-16 at 20:55 -0500, Jason Yeh wrote:
> This is the only image left on the hard disk:
>
> jyeh at socrates:~/vmware/Ubuntu$ file guestos.img
> guestos.img: x86 boot sector; partition 1: ID=0x83, active, starthead 1,
> startsector 63, 40098177 sectors; partition 2: ID=0x5, starthead 254,
> startsector 40098240, 1831410 sectors, code offset 0x48
>
> The lguest command is:
> sudo /home/jyeh/Dev/linux-2.6-git/Documentation/lguest/lguest 64m
> /home/jyeh/Dev/linux-2.6-git/vmlinux --tunnet=192.168.19.1
> --block=/home/jyeh/vmware/Ubuntu/guestos.img root=/dev/lgba
OK, the fast way of fixing this is to make a copy of the partition
without the boot sector on the front:
dd if=guestos.img of=guestos.img-part1 bs=512 skip=63
Then use --block=/home/jyeh/vmware/Ubuntu/guestos.img-part1
The better way is to apply this one-liner and boot with
"root=/dev/lgba1":
==
The lguest block device only requests one minor, which means
partitions don't work (eg "root=/dev/lgba1").
Let's follow the crowd and ask for 16.
Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
diff -r f624b0b8f457 drivers/block/lguest_blk.c
--- a/drivers/block/lguest_blk.c Fri Aug 17 11:18:01 2007 +1000
+++ b/drivers/block/lguest_blk.c Fri Aug 17 12:45:11 2007 +1000
@@ -308,9 +308,13 @@ static int lguestblk_probe(struct lguest
}
/* This allocates a "struct gendisk" where we pack all the information
- * about the disk which the rest of Linux sees. We ask for one minor
- * number; I do wonder if we should be asking for more. */
- bd->disk = alloc_disk(1);
+ * about the disk which the rest of Linux sees. The argument is the
+ * number of minor devices desired: we need one minor for the main
+ * disk, and one for each partition. Of course, we can't possibly know
+ * how many partitions are on the disk (add_disk does that).
+ *
+ * Worst. Interface. Ever. */
+ bd->disk = alloc_disk(16);
if (!bd->disk) {
err = -ENOMEM;
goto out_unregister_blkdev;
More information about the Lguest
mailing list