Page 1 of 1

problems in creating grub bootable disk

Posted: Sat Feb 20, 2010 5:49 am
by psnix
hi
which step for creating an bootable floppy with grup is wrong?

i get a per-installed version of grub from here

1.dd if=/dev/zero of=floppy.img bs=512 count=2880
2.losetup /dev/loop0 floppy
3. mkdosfs /dev/loop0
4. mount /dev/loop0 /mnt/floppy
5. coying boot to /mnt/floppy
6. dd if=/mnt/floppy/boot/grub/stage1 of=/dev/loop0 bs=512 count=1
7. dd if=/mnt/floppy/boot/grub/stage2 of=/dev/loop0 bs=512 seek=1

what is wrong?

Re: problems in creating grub bootable disk

Posted: Sat Feb 20, 2010 10:30 am
by Synon
pswin wrote:hi
which step for creating an bootable floppy with grup is wrong?

i get a per-installed version of grub from here

1.dd if=/dev/zero of=floppy.img bs=512 count=2880
2.losetup /dev/loop0 floppy
3. mkdosfs /dev/loop0
4. mount /dev/loop0 /mnt/floppy
5. coying boot to /mnt/floppy
6. dd if=/mnt/floppy/boot/grub/stage1 of=/dev/loop0 bs=512 count=1
7. dd if=/mnt/floppy/boot/grub/stage2 of=/dev/loop0 bs=512 seek=1

what is wrong?
There's a few things wrong with that, probably because most tutorials for setting up loop devices is completely wrong. Here's how I do it in my build script:

Code: Select all

LOOPDEV=`sudo losetup -f` # Get the first free loop device
sudo losetup $LOOPDEV <file> # Loop <file> on the loop device
sudo mount   $LOOPDEV <directory> # Mount the loop device on <directory>

# Do what you want to <directory> #

# Unmount the loop device
sudo umount $LOOPDEV # Unmount the loop device
sudo losetup -d $LOOPDEV # Free it