[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: |
Iwan Vosloo |
Subject: |
Re: Installing grub into the mbr of a disk image |
Date: |
Fri, 18 Apr 2008 09:18:09 +0200 |
Hi,
On Fri, 2008-04-18 at 09:36 +0200, Franklin PIAT wrote:
> On Thu, 2008-04-17 at 14:53 +0200, Iwan Vosloo wrote:
> > 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 ?
I am installing linux in it (via debootstrap), but grub-install cannot
(it seems) deal with such an image mounted on a loopback device?
> > 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.
My apologies, this was meant to be:
dd if=/usr/lib/grub/i386-pc/stage1 of=/diskimage bs=512 conv=notrunc
count=1
dd if=/usr/lib/grub/i386-pc/e2fs_stage1_5 of=/diskimage bs=512
conv=notrunc seek=1
But, from reading http://www.pixelbeat.org/docs/disk/ I understand that
that would also overwrite the partition table.
I could, however do the dd first, and then partition the disk.
Partitioning should leave grub intact.
The only thing that then still may be a problem is that grub stores the
location of stage1.5 in its stage1 (as I understand). And this may be
incorrect if I do things this way.
Thanks
-i