The script below (and attached mk_fdb.sh), creates a decent editable 1.4M vfat boot floppy image with Grub v1.98.

With Grub v1.99 (ftp version from the Grub homepage, compiled on Debian 6 x86) however the created boot floppy freezes after printing the 5 letters "GRUB ". It does also not work when I use the new "-a" flag on grub-setup. I first guessed there is a bug with --force not really going into decent blocklist creation as needed for this format. Yet a version with "32k MBR" partitioned vfat pseudo floppy (attached: mk_fdbootfat.sh), which also worked with Grub v1.98, now failes too with v1.99. The same freeze. So it seems to be a deeper bug.

(This same Grub v1.99 build works when installed on an internal with grub-install /dev/sda ...)


Robert

PS: With v1.99 also the "--diet" option for creating a iso 1.4M floppy image with grub-mkrescue disappeared (without error message is. Why remove a existing functionality? Now I need to strip off by hand.



--

#!/bin/sh
# Creates a vfat editable Grub2 boot floppy (not a read-only ISO9660 one like grub-mkrescue)
#
# template folder ./fdboot/boot/grub shall contain a grub2 tree like /boot/grub
#    including a grub.cfg,  stripped down to <= 1.4MB;
# or a tree copy from a "grub-mkrescue --diet ..." iso floppy (do "mv i386-pc/* ." ...)

# Note: works with Grub2 v1.98 ; seems to fail with current v1.99 Nov 2011 - bug in "grub-setup -a ..."?

# output image filename
fdimg=fdb.fat

# script
umount mnt
dd if=/dev/zero of=$fdimg count=2880
losetup -d /dev/loop0
losetup /dev/loop0 $fdimg || exit 1
fdformat /dev/loop0
mkfs.vfat /dev/loop0 || exit 1
mount /dev/loop0 mnt || exit 1  

#rm fdboot/boot/grub/i386-pc/efiemu.mod grcy_* ... strip off to 1.4MB / create by "grub-mkrescue --diet ..."
cp -a fdboot/* mnt/  || exit 1
#cp /boot/grub/grub.cfg mnt/boot/grub/

cat > mnt/boot/grub/device.map <<EOF
(fd0)   /dev/loop0
(hd0)   /dev/sda
(hd1)   /dev/sdb
EOF

cp /boot/grub/boot.img mnt/boot/grub/ || exit 1

grub-mkimage -o mnt/boot/grub/core.img -O i386-pc biosdisk fat part_msdos || exit 1

# --force is needed to force blocklists (for core.img) on floppy:
grub-setup --force -d mnt/boot/grub -m mnt/boot/grub/device.map /dev/loop0 || exit 1

# variant with -a for Grub2 1.99+ , but still no sucess:
#grub-setup -a --force -d mnt/boot/grub -m mnt/boot/grub/device.map /dev/loop0 || exit 1

umount mnt
losetup -d /dev/loop0

# copy the image to virtual machine image folder
cp -a $fdimg /hptemp/boot/

echo $fdimg created. Done.
echo TO MOUNT: mount -o loop $fdimg mnt

# write to a real floppy
#cp $fdimg /dev/fd0

mount -o loop $fdimg mnt

Attachment: mk_fdb.sh
Description: application/shellscript

Attachment: mk_fdbootfat.sh
Description: application/shellscript

_______________________________________________
Bug-grub mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-grub

Reply via email to