All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Franke <Christian.Franke@t-online.de>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
Date: Fri, 15 Feb 2008 23:32:49 +0100	[thread overview]
Message-ID: <47B61311.90005@t-online.de> (raw)
In-Reply-To: <20080210151412.GA7404@thorin>

[-- Attachment #1: Type: text/plain, Size: 1529 bytes --]

Robert Millan wrote:
> On Sun, Feb 10, 2008 at 02:43:40PM +0100, Christian Franke wrote:
>   
>> This results in 6 possible image variants:
>>
>> 1. Floppy:                 --image-type=floppy
>> 2. CD, no emulation:       --image-type=cdrom [--emulation=none]
>> 3. CD, floppy emulation:   --image-type=cdrom --emulation=floppy
>> 4. CD, hdd emulation:      --image-type=cdrom --emulation=hdd
>> 5. USB without partitions: --image-type=superfloppy
>> 6. USB with partitions:    --image-type=hdd
>>
>> It may be possible to use the image #1 as image #5.
>>     
>
> I don't think it is really practical to support USB drives in grub-mkrescue.
> You'd have to require root permissions, which IMO beats the point of having
> a separate script from grub-install in first place.
>
>   

It may be useful to create small rescue images which can be later put on 
USB key with dd.
(BTW: The "floppy" image actually boots from USB at least on one of my 
PC. It appears as hd0).

Here a new patch, it uses the --emulation=floppy syntax from above.

My recent tests (see "[PATCH] Ensure boot CD can be accessed") show that 
direct CD boot might always not work.

The patch also adds a --joliet option, useful to access the long file 
names on Windows (which has no RR support).

Christian

2008-02-15  Christian Franke  <franke@computer.org>

	* util/i386/pc/grub-mkrescue.in: Add --emulation=floppy
	to create a floppy emulation boot CD when non emulation mode
	does not work.
	Add --joliet to enable Joliet cdrom filesystem extension.



[-- Attachment #2: grub2-mkrescue-emulation.patch --]
[-- Type: text/x-patch, Size: 2554 bytes --]

--- grub2.orig/util/i386/pc/grub-mkrescue.in	2008-02-09 14:02:56.057039500 +0100
+++ grub2/util/i386/pc/grub-mkrescue.in	2008-02-15 23:09:26.843750000 +0100
@@ -46,6 +46,8 @@ Make GRUB rescue 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)
+  --emulation=TYPE        select boot emulation type floppy, or none (default)
+  --joliet                enable Joliet filesystem extension (cdrom only)
 
 grub-mkimage generates a bootable rescue image of the specified type.
 
@@ -56,6 +58,8 @@ EOF
 image_type=cdrom
 input_dir=${pkglibdir}
 grub_mkimage=grub-mkimage
+emulation=none
+joliet=
 
 # Check the arguments.
 for option in "$@"; do
@@ -82,6 +86,16 @@ for option in "$@"; do
             echo "Unknown image type \`$image_type'" 1>&2
             exit 1 ;;
         esac ;;
+    --emulation=*)
+    	emulation=`echo "$option" | sed 's/--emulation=//'`
+        case "$emulation" in
+          floppy|none) ;;
+          *)
+            echo "Unknown emulation type \`$emulation'" 1>&2
+            exit 1 ;;
+        esac ;;
+    --joliet)
+	joliet="-J" ;;
     -*)
 	echo "Unrecognized option \`$option'" 1>&2
 	usage
@@ -113,7 +127,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${emulation}" = xfloppy ] ; then
   # build memdisk
   memdisk_img=`mktemp`
   tar -C ${aux_dir} -cf ${memdisk_img} boot
@@ -125,8 +139,21 @@ 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}" = xcdrom ] ; then
+    floppy_dir=`mktemp -d`
+    floppy_img=${floppy_dir}/grub_floppy.img
+  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}" = xcdrom ] ; then
+    # build iso image
+    genisoimage -b grub_floppy.img \
+      -o ${output_image} -r ${joliet} ${floppy_dir}
+    rm -rf ${floppy_dir}
+  fi
 else
   # build core.img
   core_img=`mktemp`
@@ -139,7 +166,7 @@ else
   # build iso image
   genisoimage -b boot/grub/grub_eltorito \
     -no-emul-boot -boot-load-size 4 -boot-info-table \
-    -o ${output_image} -r ${aux_dir}
+    -o ${output_image} -r ${joliet} ${aux_dir}
   rm -rf ${aux_dir}
 fi
 

  reply	other threads:[~2008-02-15 22:32 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-08 18:45 [PATCH] Create floppy emulation boot CD with grub-mkimage Christian Franke
2008-02-08 19:17 ` Robert Millan
2008-02-08 22:03   ` Christian Franke
2008-02-08 22:45     ` Robert Millan
2008-02-08 23:07       ` Pavel Roskin
2008-02-08 23:10         ` Robert Millan
2008-02-08 23:17       ` Christian Franke
2008-02-08 23:35         ` Robert Millan
2008-02-09 11:56       ` Bean
2008-02-09 12:32         ` Robert Millan
2008-02-09 12:38           ` Bean
2008-02-09 16:53         ` Christian Franke
2008-02-09 17:15           ` Bean
2008-02-10 12:17             ` Christian Franke
2008-02-08 23:14 ` Robert Millan
2008-02-08 23:32   ` Christian Franke
2008-02-09 17:04     ` Christian Franke
2008-02-09 21:59       ` Robert Millan
2008-02-09 23:04         ` Pavel Roskin
2008-02-10 13:43           ` Christian Franke
2008-02-10 15:14             ` Robert Millan
2008-02-15 22:32               ` Christian Franke [this message]
2008-02-17 13:31                 ` Robert Millan
2008-02-17 15:29                   ` Christian Franke
2008-02-18  9:04                   ` tsah marco
2008-03-01 21:05                   ` Christian Franke
2008-03-03 20:46                     ` Robert Millan
2008-03-03 22:10                       ` Christian Franke
2008-03-03 22:24                         ` Robert Millan
2008-03-07 21:20                           ` Christian Franke
2008-04-13 15:13                             ` Robert Millan
  -- strict thread matches above, loose matches on Subject: below --
2008-03-04  2:11 Kalamatee
2008-03-04  2:12 ` Kalamatee
2008-03-04  9:22 Christian Franke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47B61311.90005@t-online.de \
    --to=christian.franke@t-online.de \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.