grub-devel
[Top][All Lists]
Advanced

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

[PATCH] Create floppy emulation boot CD with grub-mkimage


From: Christian Franke
Subject: [PATCH] Create floppy emulation boot CD with grub-mkimage
Date: Fri, 08 Feb 2008 19:45:48 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071128 SeaMonkey/1.1.7

A CD created by "grub-mkrescue --image-type=cdrom" does not work for me for some reason. Is it probably necessary to supply -boot-load-seg to genisoimage?

But booting a grub2 rescue floppy image in El Torito emulation mode works. This patch adds the image type "floppycd" to create such a CD.

Christian

2008-02-08  Christian Franke  <address@hidden>

        * util/i386/pc/grub-mkrescue.in: Add --image-type=floppycd
        to create a floppy emulation boot CD when non emulation mode
        does not work.


--- grub2.orig/util/i386/pc/grub-mkrescue.in    2008-02-03 20:29:54.562500000 
+0100
+++ grub2/util/i386/pc/grub-mkrescue.in 2008-02-08 18:21:27.734375000 +0100
@@ -45,7 +45,7 @@ Make GRUB rescue image.
   --overlay=DIR           overlay directory DIR in the memdisk image
   --pkglibdir=DIR         use images from directory DIR instead of ${pkglibdir}
   --grub-mkimage=FILE     use FILE as grub-mkimage
-  --image-type=TYPE       select floppy or cdrom (default)
+  --image-type=TYPE       select floppy, floppycd, or cdrom (default)
 
 grub-mkimage generates a bootable rescue image of the specified type.
 
@@ -77,7 +77,7 @@ for option in "$@"; do
     --image-type=*)
        image_type=`echo "$option" | sed 's/--image-type=//'`
         case "$image_type" in
-          floppy|cdrom) ;;
+          floppy|floppycd|cdrom) ;;
           *)
             echo "Unknown image type \`$image_type'" 1>&2
             exit 1 ;;
@@ -113,7 +113,7 @@ if test "x$overlay" = x ; then : ; else
   cp -dpR ${overlay}/* ${aux_dir}/
 fi
 
-if [ "x${image_type}" = "xfloppy" ] ; then
+if [ "x${image_type}" = "xfloppy" -o "x${image_type}" = "xfloppycd" ] ; then
   # build memdisk
   memdisk_img=`mktemp`
   tar -C ${aux_dir} -cf ${memdisk_img} boot
@@ -125,8 +125,20 @@ if [ "x${image_type}" = "xfloppy" ] ; th
   rm -f ${memdisk_img}
 
   # build floppy image
-  cat ${input_dir}/boot.img ${core_img} /dev/zero | dd bs=1024 count=1440 > 
$output_image
+  if [ "x${image_type}" = "xfloppycd" ] ; then
+    floppy_dir=`mktemp -d`
+    floppy_img=${floppy_dir}/grub_floppy
+  else
+    floppy_img=${output_image}
+  fi
+  cat ${input_dir}/boot.img ${core_img} /dev/zero | dd bs=1024 count=1440 > 
${floppy_img}
   rm -f ${core_img}
+
+  if [ "x${image_type}" = "xfloppycd" ] ; then
+    # build iso image
+    genisoimage -b grub_floppy -o ${output_image} -r ${floppy_dir}
+    rm -rf ${floppy_dir}
+  fi
 else
   # build core.img
   core_img=`mktemp`

reply via email to

[Prev in Thread] Current Thread [Next in Thread]