problems in creating grub bootable disk

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
psnix
Member
Member
Posts: 50
Joined: Fri Oct 24, 2008 12:34 pm

problems in creating grub bootable disk

Post 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?
Synon
Member
Member
Posts: 169
Joined: Sun Sep 06, 2009 3:54 am
Location: Brighton, United Kingdom

Re: problems in creating grub bootable disk

Post 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
Post Reply