Home > linfati.cl > Boot a floppy image from grub2

Boot a floppy image from grub2

Create a directory for the boot image and copy memdisk to /boot

mkdir /boot/images/
aptitude install syslinux
cp /usr/lib/syslinux/memdisk /boot

Create a script /etc/grub.d/40_custom to auto-detect the floppy image at the directory

#!/bin/sh

set -e

IMAGES=/boot/images
. /usr/lib/grub/grub-mkconfig_lib
if test -e /boot/memdisk ; then
  MEMDISKPATH=$( make_system_path_relative_to_its_root "/boot/memdisk" )
  echo "Found memdisk: $MEMDISKPATH" >&2
  find $IMAGES -name "*.img" | sort |
  while read image ; do
      IMAGEPATH=$( make_system_path_relative_to_its_root "$image" )
      echo "Found floppy image: $IMAGEPATH" >&2
      cat << EOF
menuentry "Bootable floppy: $(basename $IMAGEPATH | sed s/.img//)" {
EOF
      prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
      cat << EOF
        linux16 $MEMDISKPATH bigraw
        initrd16 $IMAGEPATH
}
EOF
  done
fi

# exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

and call update-grub2

Categories: linfati.cl Tags: , ,
  1. Sam Rene Rika Amadeus Van Kerckhoven
    February 15th, 2010 at 22:49 | #1

    Hi,

    Finally I managed to boot a floppy image through your blog.
    I’m booting from within Grub2 (nothing else works).
    Do you know a way to mount multiple floppy images through grub ?
    (I have the four debian netinstall floppies on the hd and no other media available)
    thx

  1. No trackbacks yet.