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

Re: Installing grub directly to a file



On Thursday 08 November 2001 00:48, Timo Benk wrote:
> On Wed, Nov 07, 2001 at 01:38:30AM +0800, csj wrote:
[...]
> > Is there a way for me to install grub directly to "grub_boot.fdd"
> > and have a file system on that file at the same time?
[...]

> Try the following:
>
> this recipe is heavily based on information provided to me by
> Petr Konecny.
>
> first make a 2.88MB zeroed image file.
> dd if=/dev/zero of=/tmp/boot288.img bs=512 count=5760
>
> then set up the loop device.
> losetup /dev/loop0 /tmp/boot288.img

This appears to be the missing link. I had assumed creating a 
filesystem (below) would be enough to do the trick.

> then format it with the ext2 filesystem.
> mke2fs /dev/loop0
>
> mount it under /mnt.
> mount /dev/loop0 /mnt
>
> create a directory named grub.
> mkdir /mnt/grub
>
> copy the grub stage files onto the floppy image.
> cp /usr/lib/grub/i386-pc/stage[12] /mnt/grub
>
> create a device map file.
> echo "(fd0) /dev/loop4" > /tmp/dev.map

A slight case of sticky keys? I made this one "(fd0) /dev/loop0" 

> install grub to the image.
> /sbin/grub --device-map=/tmp/dev.map <<END
> root (fd0)
> setup (fd0)
> END
>
> -----<snip>------
> # grub menu file menu.lst
>
> timeout 5
> title Rescue System
> root (fd0)
> kernel /vmlinuz root=/dev/ram0 ramdisk_size=4096 init=/linuxrc rw
> -----<snap>------
>
> now copy the initrdfs.gz and the kernel to /mnt and unmount /mnt.
> finally detach the loop device:
> losetup -d /dev/loop0
>
> voila, that's it.

Except for the above note, no complaints from the patient thus far. I 
omitted the initrd stuff because I don't seem to have it. I'm still 
waiting to (not "waiting for a" ;-) reboot, however, to see the results 
of the surgery.

Vielen dank

-- 
Sir Isaac Newton:
"If I have seen further, it is by standing on the shoulders of giants."



Reply to: