[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Installing grub into the mbr of a disk image
From: |
Franklin PIAT |
Subject: |
Re: Installing grub into the mbr of a disk image |
Date: |
Fri, 18 Apr 2008 09:36:24 +0200 |
Hello,
On Thu, 2008-04-17 at 14:53 +0200, Iwan Vosloo wrote:
> Hi there,
>
> I'm trying to build a disk image, partitioned and with grub (0.97 on
> ubuntu gutsy) in its mbr. But my installing grub always overwrites the
> partition table.
>
> The idea is to boot the disk image in a VM, then to land in grub's
> commandline and take things from there. What am I misinderstanding?
Can't you just install linux within that partition, then get it to
install grub ?
> These are the steps I follow to create a typical 4GiB image:
> 1) Create the disk: dd if=/dev/zero of=/diskimage bs=516096c count=8000
> (from: http://www.osdev.org/osfaq2/index.php/Disk%20Images%20Under%
> 20Linux )
> (assuming disk geometry of 8000 cylinders, 16 heads, 63
> sectors/track, 512 bytes/sector)
>
> 2) Partition the disk:
> parted /diskimage -s mklabel msdos
> parted /diskimage -s mkpart primary ext3 32257B 1040cyl
> parted /diskimage -s mkpart primary linux-swap 1041cyl 9230cyl
> parted /diskimage -s mkpart primary ext3 9231cyl 100%
looks correct.
> 3) In order to install grub, I do:
> (from
> http://www.gnu.org/software/grub/manual/grub.html#Creating-a-GRUB-boot-floppy
> )
> dd if=/usr/lib/grub/i386-pc/stage1 of=/diskimage bs=512 count=1
> dd if=/usr/lib/grub/i386-pc/stage2 of=/diskimage bs=512 seek=1
You can't do that for hard disk.