help-grub
[Top][All Lists]
Advanced

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

RE: Installing grub into the mbr of a disk image


From: Treutwein Bernhard
Subject: RE: Installing grub into the mbr of a disk image
Date: Fri, 18 Apr 2008 13:09:03 +0200

Hi Iwan,

this statement 

  dd if=/usr/lib/grub/i386-pc/stage1 of=/diskimage bs=512 count=1

must overwrite the partition table. Since it was meant for a floppy,
which doesn't have a partition table, it is no wonder.

I cannot say for sure, but maybe it is sufficient to use:

  dd if=/usr/lib/grub/i386-pc/stage1 of=/diskimage bs=446 count=1

see also: http://www.win.tue.nl/~aeb/partitions/partition_types.html
especially Sec. 2.7

Have fun ...
--
  Bernhard 

> -----Original Message-----
> From: Iwan Vosloo [mailto:address@hidden 
> Sent: Thursday, April 17, 2008 2:53 PM
> To: address@hidden
> Subject: Installing grub into the mbr of a disk image
> 
> 
> 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?
> 
> 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%
> 
>  3) In order to install grub, I do:
>     (from
> http://www.gnu.org/software/grub/manual/grub.html#Creating-a-G
RUB-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
        
Thanks
- Iwan








reply via email to

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