All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Create floppy emulation boot CD with grub-mkimage
@ 2008-02-08 18:45 Christian Franke
  2008-02-08 19:17 ` Robert Millan
  2008-02-08 23:14 ` Robert Millan
  0 siblings, 2 replies; 34+ messages in thread
From: Christian Franke @ 2008-02-08 18:45 UTC (permalink / raw)
  To: grub-devel

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

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  <franke@computer.org>

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



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

--- 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`

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  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 23:14 ` Robert Millan
  1 sibling, 1 reply; 34+ messages in thread
From: Robert Millan @ 2008-02-08 19:17 UTC (permalink / raw)
  To: The development of GRUB 2

On Fri, Feb 08, 2008 at 07:45:48PM +0100, Christian Franke wrote:
> A CD created by "grub-mkrescue --image-type=cdrom" does not work for me 
> for some reason.

This is AFAIK the most widely used method for CD boot.  Do other CDs work for
you?

If this is a bug, I think it's better to fix it instead of adding workarounds.

> Is it probably necessary to supply -boot-load-seg to 
> genisoimage?

Could you test that?

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-02-08 19:17 ` Robert Millan
@ 2008-02-08 22:03   ` Christian Franke
  2008-02-08 22:45     ` Robert Millan
  0 siblings, 1 reply; 34+ messages in thread
From: Christian Franke @ 2008-02-08 22:03 UTC (permalink / raw)
  To: The development of GRUB 2

Robert Millan wrote:
> On Fri, Feb 08, 2008 at 07:45:48PM +0100, Christian Franke wrote:
>   
>> A CD created by "grub-mkrescue --image-type=cdrom" does not work for me 
>> for some reason.
>>     
>
> This is AFAIK the most widely used method for CD boot.  Do other CDs work for
> you?
>
>   

Yes, all of my boot CDs work :-)

Meantime, I found the problem: cdboot.img was > 512 bytes. I forgot to 
add the ld script necessary for the Cygwin build (-N does not work). 
Should have checked this first, sorry.

Now the CD boots, but the result is interesting:

Real PC: escape to rescue mode, root=hd31, no (cd0) device, no modules.

VMWare: same.

VirtualPC: escape to rescue mode, root=cd15, (cd0) exists, normal mode 
can be started manually.

VirtualBox: Works as expected.


Both floppy and "floppy(on)cd" both work as expected.


> If this is a bug, I think it's better to fix it instead of adding workarounds.
>
>   

Yes, but the patch provides the end-user with a simple way to create a 
fall back boot CD when the normal boot CD does not work for whatever 
reason. And the patch does not break anything existing.

Christian




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-02-08 22:03   ` Christian Franke
@ 2008-02-08 22:45     ` Robert Millan
  2008-02-08 23:07       ` Pavel Roskin
                         ` (2 more replies)
  0 siblings, 3 replies; 34+ messages in thread
From: Robert Millan @ 2008-02-08 22:45 UTC (permalink / raw)
  To: The development of GRUB 2

On Fri, Feb 08, 2008 at 11:03:07PM +0100, Christian Franke wrote:
> 
> Yes, all of my boot CDs work :-)
> 
> Meantime, I found the problem: cdboot.img was > 512 bytes. I forgot to 
> add the ld script necessary for the Cygwin build (-N does not work). 
> Should have checked this first, sorry.

Is this a remaining patch that was needed for Cygwin?

> Now the CD boots, but the result is interesting:
> 
> Real PC: escape to rescue mode, root=hd31, no (cd0) device, no modules.
> 
> VMWare: same.
> 
> VirtualPC: escape to rescue mode, root=cd15, (cd0) exists, normal mode 
> can be started manually.
> 
> VirtualBox: Works as expected.

Interesting, yes.  But no idea what it means :-(

Maybe Bean will know ...

> >If this is a bug, I think it's better to fix it instead of adding 
> >workarounds.
> 
> Yes, but the patch provides the end-user with a simple way to create a 
> fall back boot CD when the normal boot CD does not work for whatever 
> reason. And the patch does not break anything existing.

You could ask Marco or Okuji and see what they think about it.  If they
agree with you, I'll have to shut up ;-)

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  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-09 11:56       ` Bean
  2 siblings, 1 reply; 34+ messages in thread
From: Pavel Roskin @ 2008-02-08 23:07 UTC (permalink / raw)
  To: The development of GRUB 2, Robert Millan

Quoting Robert Millan <rmh@aybabtu.com>:

> You could ask Marco or Okuji and see what they think about it.  If they
> agree with you, I'll have to shut up ;-)

I'm neither of both, but here are my two cents:

I think it's a good idea.  Many old BIOSes are buggy when it comes to  
CD-ROM boot support.  Having an extra option doesn't hurt, especially  
for rescuing the system.    The change doesn't bloat the bootloader,  
it only enlarges an extra script slightly.  Having a bootable floppy  
image on a CD could be handy in some circumstances.  Maintenance is  
easy, since both CD images can be checked in qemu.

-- 
Regards,
Pavel Roskin



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-02-08 23:07       ` Pavel Roskin
@ 2008-02-08 23:10         ` Robert Millan
  0 siblings, 0 replies; 34+ messages in thread
From: Robert Millan @ 2008-02-08 23:10 UTC (permalink / raw)
  To: The development of GRUB 2

On Fri, Feb 08, 2008 at 06:07:59PM -0500, Pavel Roskin wrote:
> Quoting Robert Millan <rmh@aybabtu.com>:
> 
> >You could ask Marco or Okuji and see what they think about it.  If they
> >agree with you, I'll have to shut up ;-)
> 
> I'm neither of both, but here are my two cents:
> 
> I think it's a good idea.  Many old BIOSes are buggy when it comes to  
> CD-ROM boot support.

Well, if you're sure about that, then I don't mind.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  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 23:14 ` Robert Millan
  2008-02-08 23:32   ` Christian Franke
  1 sibling, 1 reply; 34+ messages in thread
From: Robert Millan @ 2008-02-08 23:14 UTC (permalink / raw)
  To: The development of GRUB 2

On Fri, Feb 08, 2008 at 07:45:48PM +0100, Christian Franke wrote:
>    --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)

I find this user interface confusing.  How does one know what "floppycd" means?

I think it'd be much easier to understand if this was a separate option,
something like:

--image-type=TYPE       select floppy or cdrom (default)
--some-option           explain what it does

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-02-08 22:45     ` Robert Millan
  2008-02-08 23:07       ` Pavel Roskin
@ 2008-02-08 23:17       ` Christian Franke
  2008-02-08 23:35         ` Robert Millan
  2008-02-09 11:56       ` Bean
  2 siblings, 1 reply; 34+ messages in thread
From: Christian Franke @ 2008-02-08 23:17 UTC (permalink / raw)
  To: The development of GRUB 2

Robert Millan wrote:
> On Fri, Feb 08, 2008 at 11:03:07PM +0100, Christian Franke wrote:
>   
>> Yes, all of my boot CDs work :-)
>>
>> Meantime, I found the problem: cdboot.img was > 512 bytes. I forgot to 
>> add the ld script necessary for the Cygwin build (-N does not work). 
>> Should have checked this first, sorry.
>>     
>
> Is this a remaining patch that was needed for Cygwin?
>
>   

This it is a small update to the "[PATCH] Build on Cygwin" posted here 
2007-11-23, no feedback yet.


>> Now the CD boots, but the result is interesting:
>>
>> Real PC: escape to rescue mode, root=hd31, no (cd0) device, no modules.
>>
>> VMWare: same.
>>
>> VirtualPC: escape to rescue mode, root=cd15, (cd0) exists, normal mode 
>> can be started manually.
>>
>> VirtualBox: Works as expected.
>>     
>
> Interesting, yes.  But no idea what it means :-(
>
>   

I will investigate this further ...

Christian




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-02-08 23:14 ` Robert Millan
@ 2008-02-08 23:32   ` Christian Franke
  2008-02-09 17:04     ` Christian Franke
  0 siblings, 1 reply; 34+ messages in thread
From: Christian Franke @ 2008-02-08 23:32 UTC (permalink / raw)
  To: The development of GRUB 2

Robert Millan wrote:
> On Fri, Feb 08, 2008 at 07:45:48PM +0100, Christian Franke wrote:
>   
>>    --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)
>>     
>
> I find this user interface confusing.  How does one know what "floppycd" means?
>
> I think it'd be much easier to understand if this was a separate option,
> something like:
>
> --image-type=TYPE       select floppy or cdrom (default)
> --some-option           explain what it does
>
>   

Good point.

--emulation     create floppy emulation cdrom image

Christian




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-02-08 23:17       ` Christian Franke
@ 2008-02-08 23:35         ` Robert Millan
  0 siblings, 0 replies; 34+ messages in thread
From: Robert Millan @ 2008-02-08 23:35 UTC (permalink / raw)
  To: The development of GRUB 2

On Sat, Feb 09, 2008 at 12:17:16AM +0100, Christian Franke wrote:
> 
> This it is a small update to the "[PATCH] Build on Cygwin" posted here 
> 2007-11-23, no feedback yet.

Ok, I just replied.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-02-08 22:45     ` Robert Millan
  2008-02-08 23:07       ` Pavel Roskin
  2008-02-08 23:17       ` Christian Franke
@ 2008-02-09 11:56       ` Bean
  2008-02-09 12:32         ` Robert Millan
  2008-02-09 16:53         ` Christian Franke
  2 siblings, 2 replies; 34+ messages in thread
From: Bean @ 2008-02-09 11:56 UTC (permalink / raw)
  To: The development of GRUB 2

On Feb 9, 2008 6:45 AM, Robert Millan <rmh@aybabtu.com> wrote:
> On Fri, Feb 08, 2008 at 11:03:07PM +0100, Christian Franke wrote:
> >
> > Yes, all of my boot CDs work :-)
> >
> > Meantime, I found the problem: cdboot.img was > 512 bytes. I forgot to
> > add the ld script necessary for the Cygwin build (-N does not work).
> > Should have checked this first, sorry.
>
> Is this a remaining patch that was needed for Cygwin?
>
> > Now the CD boots, but the result is interesting:
> >
> > Real PC: escape to rescue mode, root=hd31, no (cd0) device, no modules.
> >
> > VMWare: same.
> >
> > VirtualPC: escape to rescue mode, root=cd15, (cd0) exists, normal mode
> > can be started manually.
> >
> > VirtualBox: Works as expected.

For VirtualPC, try the following patch:

diff --git a/kern/i386/pc/init.c b/kern/i386/pc/init.c
index 7237492..5eb5484 100644
--- a/kern/i386/pc/init.c
+++ b/kern/i386/pc/init.c
@@ -77,9 +77,9 @@ make_install_device (void)
       if (grub_root_drive == 0xFF)
         grub_root_drive = grub_boot_drive;

-      if (grub_root_drive >= GRUB_BIOSDISK_MACHINE_CDROM_START)
-        grub_sprintf (dev, "(cd%u",
-		      grub_root_drive - GRUB_BIOSDISK_MACHINE_CDROM_START);
+      if ((grub_root_drive >= GRUB_BIOSDISK_MACHINE_CDROM_START) &&
+          (grub_root_drive < GRUB_BIOSDISK_MACHINE_CDROM_END))
+	grub_strcpy (dev, "(cd0)");
       else
         grub_sprintf (dev, "(%cd%u",
 		      (grub_root_drive & 0x80) ? 'h' : 'f',

For Real PC, you should be able to fix it by setting
GRUB_BIOSDISK_MACHINE_CDROM_START to 0x9F in
/include/grub/i386/pc/biosdisk.h, but i don't recommend using it as
default value.

-- 
Bean



^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  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
  1 sibling, 1 reply; 34+ messages in thread
From: Robert Millan @ 2008-02-09 12:32 UTC (permalink / raw)
  To: The development of GRUB 2

On Sat, Feb 09, 2008 at 07:56:16PM +0800, Bean wrote:
>        if (grub_root_drive == 0xFF)
>          grub_root_drive = grub_boot_drive;
> 
> -      if (grub_root_drive >= GRUB_BIOSDISK_MACHINE_CDROM_START)
> -        grub_sprintf (dev, "(cd%u",
> -		      grub_root_drive - GRUB_BIOSDISK_MACHINE_CDROM_START);
> +      if ((grub_root_drive >= GRUB_BIOSDISK_MACHINE_CDROM_START) &&
> +          (grub_root_drive < GRUB_BIOSDISK_MACHINE_CDROM_END))
> +	grub_strcpy (dev, "(cd0)");
>        else
>          grub_sprintf (dev, "(%cd%u",
>  		      (grub_root_drive & 0x80) ? 'h' : 'f',

I'm confused by this.  Did you mean the opposite?  I.e. when grub_root_drive
is out of bounds, set dev to cd0.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-02-09 12:32         ` Robert Millan
@ 2008-02-09 12:38           ` Bean
  0 siblings, 0 replies; 34+ messages in thread
From: Bean @ 2008-02-09 12:38 UTC (permalink / raw)
  To: The development of GRUB 2

On Feb 9, 2008 8:32 PM, Robert Millan <rmh@aybabtu.com> wrote:
> On Sat, Feb 09, 2008 at 07:56:16PM +0800, Bean wrote:
> >        if (grub_root_drive == 0xFF)
> >          grub_root_drive = grub_boot_drive;
> >
> > -      if (grub_root_drive >= GRUB_BIOSDISK_MACHINE_CDROM_START)
> > -        grub_sprintf (dev, "(cd%u",
> > -                   grub_root_drive - GRUB_BIOSDISK_MACHINE_CDROM_START);
> > +      if ((grub_root_drive >= GRUB_BIOSDISK_MACHINE_CDROM_START) &&
> > +          (grub_root_drive < GRUB_BIOSDISK_MACHINE_CDROM_END))
> > +     grub_strcpy (dev, "(cd0)");
> >        else
> >          grub_sprintf (dev, "(%cd%u",
> >                     (grub_root_drive & 0x80) ? 'h' : 'f',
>
> I'm confused by this.  Did you mean the opposite?  I.e. when grub_root_drive
> is out of bounds, set dev to cd0.

in biosdisk, cdrom drive is probed from
GRUB_BIOSDISK_MACHINE_CDROM_START to GRUB_BIOSDISK_MACHINE_CDROM_END,
the first one found is treated as (cd0).

-- 
Bean



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-02-09 11:56       ` Bean
  2008-02-09 12:32         ` Robert Millan
@ 2008-02-09 16:53         ` Christian Franke
  2008-02-09 17:15           ` Bean
  1 sibling, 1 reply; 34+ messages in thread
From: Christian Franke @ 2008-02-09 16:53 UTC (permalink / raw)
  To: The development of GRUB 2

Bean wrote:
>> ...
>>     
>>> Now the CD boots, but the result is interesting:
>>>
>>> Real PC: escape to rescue mode, root=hd31, no (cd0) device, no modules.
>>>
>>> VMWare: same.
>>>
>>> VirtualPC: escape to rescue mode, root=cd15, (cd0) exists, normal mode
>>> can be started manually.
>>>
>>> VirtualBox: Works as expected.
>>>       
>
> For VirtualPC, try the following patch:
>
> diff --git a/kern/i386/pc/init.c b/kern/i386/pc/init.c
> index 7237492..5eb5484 100644
> --- a/kern/i386/pc/init.c
> +++ b/kern/i386/pc/init.c
> @@ -77,9 +77,9 @@ make_install_device (void)
>        if (grub_root_drive == 0xFF)
>          grub_root_drive = grub_boot_drive;
>
> -      if (grub_root_drive >= GRUB_BIOSDISK_MACHINE_CDROM_START)
> -        grub_sprintf (dev, "(cd%u",
> -		      grub_root_drive - GRUB_BIOSDISK_MACHINE_CDROM_START);
> +      if ((grub_root_drive >= GRUB_BIOSDISK_MACHINE_CDROM_START) &&
> +          (grub_root_drive < GRUB_BIOSDISK_MACHINE_CDROM_END))
> +	grub_strcpy (dev, "(cd0)");
>        else
>          grub_sprintf (dev, "(%cd%u",
>  		      (grub_root_drive & 0x80) ? 'h' : 'f',
>
>   

Thanks. This works, after changing "(cd0)" to "(cd0" :-)


> For Real PC, you should be able to fix it by setting
> GRUB_BIOSDISK_MACHINE_CDROM_START to 0x9F in
> /include/grub/i386/pc/biosdisk.h, but i don't recommend using it as
> default value.
>
>   

With this change, the rescue CD works also on the real PC (Asus MB with 
Phoenix Award BIOS) and VMware.

I have added this to get diagnostic output of boot/root_drive:

--- grub2.orig/kern/i386/pc/init.c    2008-02-03 20:29:53.125000000 +0100
+++ grub2/kern/i386/pc/init.c    2008-02-09 17:01:17.093750000 +0100
@@ -247,6 +247,12 @@
 void
 grub_machine_set_prefix (void)
 {
+  char val[20];
+  grub_sprintf (val, "0x%02x", grub_boot_drive);
+  grub_env_set ("drive_boot", val);
+  grub_sprintf (val, "0x%02x", grub_root_drive);
+  grub_env_set ("drive_root", val);
+
   /* Initialize the prefix.  */
   grub_env_set ("prefix", make_install_device ());
 }


Results:

PC: grub_boot_drive=0x9f, but INT13 Extensions reported for 0x9f

VMware: grub_boot_drive=0x9f

VirtualPC: grub_boot_drive=0xef

VirtualBox: grub_boot_drive=0xe0

GRUB_MOD_INIT(biosdisk) detects INT13 Extensions for 0x9f on the real 
PC, therefore "(cd0)" does not appear in "ls" output.
Nevertheless, access to (cd0) and everthing else works as expected due 
to the default setting of
biosdisk.c::cd_start = 0x9f.

But this won't work with any other setting of 
GRUB_BIOSDISK_MACHINE_CDROM_START.


Conclusions:
- I like standards, because there are so many to choose from :-)
- We probably should discuss boot CD drive detection in a new thread.
- A floppy emulation rescue CD as a last resort makes sense ;-)

Christian




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-02-08 23:32   ` Christian Franke
@ 2008-02-09 17:04     ` Christian Franke
  2008-02-09 21:59       ` Robert Millan
  0 siblings, 1 reply; 34+ messages in thread
From: Christian Franke @ 2008-02-09 17:04 UTC (permalink / raw)
  To: The development of GRUB 2

Christian Franke wrote:
> Robert Millan wrote:
>> On Fri, Feb 08, 2008 at 07:45:48PM +0100, Christian Franke wrote:
>>  
>>>    --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)
>>>     
>>
>> I find this user interface confusing.  How does one know what 
>> "floppycd" means?
>>
>> I think it'd be much easier to understand if this was a separate option,
>> something like:
>>
>> --image-type=TYPE       select floppy or cdrom (default)
>> --some-option           explain what it does
>>
>>   
>
> Good point.
>
> --emulation     create floppy emulation cdrom image
>

or

--boot-type=(native|emulation)
                     select cdrom native (default) or floppy emulation 
boot type

Christian




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-02-09 16:53         ` Christian Franke
@ 2008-02-09 17:15           ` Bean
  2008-02-10 12:17             ` Christian Franke
  0 siblings, 1 reply; 34+ messages in thread
From: Bean @ 2008-02-09 17:15 UTC (permalink / raw)
  To: The development of GRUB 2

On Feb 10, 2008 12:53 AM, Christian Franke <Christian.Franke@t-online.de> wrote:
> Bean wrote:
> >> ...
> >>
> >>> Now the CD boots, but the result is interesting:
> >>>
> >>> Real PC: escape to rescue mode, root=hd31, no (cd0) device, no modules.
> >>>
> >>> VMWare: same.
> >>>
> >>> VirtualPC: escape to rescue mode, root=cd15, (cd0) exists, normal mode
> >>> can be started manually.
> >>>
> >>> VirtualBox: Works as expected.
> >>>
> >
> > For VirtualPC, try the following patch:
> >
> > diff --git a/kern/i386/pc/init.c b/kern/i386/pc/init.c
> > index 7237492..5eb5484 100644
> > --- a/kern/i386/pc/init.c
> > +++ b/kern/i386/pc/init.c
> > @@ -77,9 +77,9 @@ make_install_device (void)
> >        if (grub_root_drive == 0xFF)
> >          grub_root_drive = grub_boot_drive;
> >
> > -      if (grub_root_drive >= GRUB_BIOSDISK_MACHINE_CDROM_START)
> > -        grub_sprintf (dev, "(cd%u",
> > -                   grub_root_drive - GRUB_BIOSDISK_MACHINE_CDROM_START);
> > +      if ((grub_root_drive >= GRUB_BIOSDISK_MACHINE_CDROM_START) &&
> > +          (grub_root_drive < GRUB_BIOSDISK_MACHINE_CDROM_END))
> > +     grub_strcpy (dev, "(cd0)");
> >        else
> >          grub_sprintf (dev, "(%cd%u",
> >                     (grub_root_drive & 0x80) ? 'h' : 'f',
> >
> >
>
> Thanks. This works, after changing "(cd0)" to "(cd0" :-)
>
>
> > For Real PC, you should be able to fix it by setting
> > GRUB_BIOSDISK_MACHINE_CDROM_START to 0x9F in
> > /include/grub/i386/pc/biosdisk.h, but i don't recommend using it as
> > default value.
> >
> >
>
> With this change, the rescue CD works also on the real PC (Asus MB with
> Phoenix Award BIOS) and VMware.
>
> I have added this to get diagnostic output of boot/root_drive:
>
> --- grub2.orig/kern/i386/pc/init.c    2008-02-03 20:29:53.125000000 +0100
> +++ grub2/kern/i386/pc/init.c    2008-02-09 17:01:17.093750000 +0100
> @@ -247,6 +247,12 @@
>  void
>  grub_machine_set_prefix (void)
>  {
> +  char val[20];
> +  grub_sprintf (val, "0x%02x", grub_boot_drive);
> +  grub_env_set ("drive_boot", val);
> +  grub_sprintf (val, "0x%02x", grub_root_drive);
> +  grub_env_set ("drive_root", val);
> +
>    /* Initialize the prefix.  */
>    grub_env_set ("prefix", make_install_device ());
>  }
>
>
> Results:
>
> PC: grub_boot_drive=0x9f, but INT13 Extensions reported for 0x9f
>
> VMware: grub_boot_drive=0x9f
>
> VirtualPC: grub_boot_drive=0xef
>
> VirtualBox: grub_boot_drive=0xe0
>
> GRUB_MOD_INIT(biosdisk) detects INT13 Extensions for 0x9f on the real
> PC, therefore "(cd0)" does not appear in "ls" output.
> Nevertheless, access to (cd0) and everthing else works as expected due
> to the default setting of
> biosdisk.c::cd_start = 0x9f.
>
> But this won't work with any other setting of
> GRUB_BIOSDISK_MACHINE_CDROM_START.
>
>
> Conclusions:
> - I like standards, because there are so many to choose from :-)
> - We probably should discuss boot CD drive detection in a new thread.
> - A floppy emulation rescue CD as a last resort makes sense ;-)
>
> Christian

I don't know which drive to start scanning for cdrom. 0x9F means at
most 31 hard drives, i think it's fine for the most time.

-- 
Bean



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-02-09 17:04     ` Christian Franke
@ 2008-02-09 21:59       ` Robert Millan
  2008-02-09 23:04         ` Pavel Roskin
  0 siblings, 1 reply; 34+ messages in thread
From: Robert Millan @ 2008-02-09 21:59 UTC (permalink / raw)
  To: The development of GRUB 2

On Sat, Feb 09, 2008 at 06:04:07PM +0100, Christian Franke wrote:
> Christian Franke wrote:
> >Robert Millan wrote:
> >>On Fri, Feb 08, 2008 at 07:45:48PM +0100, Christian Franke wrote:
> >> 
> >>>   --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)
> >>>    
> >>
> >>I find this user interface confusing.  How does one know what 
> >>"floppycd" means?
> >>
> >>I think it'd be much easier to understand if this was a separate option,
> >>something like:
> >>
> >>--image-type=TYPE       select floppy or cdrom (default)
> >>--some-option           explain what it does
> >>
> >>  
> >
> >Good point.
> >
> >--emulation     create floppy emulation cdrom image
> >
> 
> or
> 
> --boot-type=(native|emulation)
>                     select cdrom native (default) or floppy emulation 
> boot type

Since it is a flag for enabling a compatibility option, I think it's more
like a boolean.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-02-09 21:59       ` Robert Millan
@ 2008-02-09 23:04         ` Pavel Roskin
  2008-02-10 13:43           ` Christian Franke
  0 siblings, 1 reply; 34+ messages in thread
From: Pavel Roskin @ 2008-02-09 23:04 UTC (permalink / raw)
  To: The development of GRUB 2

On Sat, 2008-02-09 at 22:59 +0100, Robert Millan wrote:

> > --boot-type=(native|emulation)
> >                     select cdrom native (default) or floppy emulation 
> > boot type
> 
> Since it is a flag for enabling a compatibility option, I think it's more
> like a boolean.

Actually, there is also hard drive emulation, which might be useful for
USB flash keys eventually, so it's not a boolean option.  But we can
always change it later.

-- 
Regards,
Pavel Roskin



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-02-09 17:15           ` Bean
@ 2008-02-10 12:17             ` Christian Franke
  0 siblings, 0 replies; 34+ messages in thread
From: Christian Franke @ 2008-02-10 12:17 UTC (permalink / raw)
  To: The development of GRUB 2

Bean wrote:
> On Feb 10, 2008 12:53 AM, Christian Franke <...> wrote:
>   
>> ...
>> Results:
>>
>> PC: grub_boot_drive=0x9f, but INT13 Extensions reported for 0x9f
>>
>> VMware: grub_boot_drive=0x9f
>>
>> VirtualPC: grub_boot_drive=0xef
>>
>> VirtualBox: grub_boot_drive=0xe0
>>
>> GRUB_MOD_INIT(biosdisk) detects INT13 Extensions for 0x9f on the real
>> PC, therefore "(cd0)" does not appear in "ls" output.
>> Nevertheless, access to (cd0) and everthing else works as expected due
>> to the default setting of
>> biosdisk.c::cd_start = 0x9f.
>>
>> ...
>>     
>
> I don't know which drive to start scanning for cdrom. 0x9F means at
> most 31 hard drives, i think it's fine for the most time.
>
>   

Agree.

Sorry, my info was wrong, it should read:

PC: Reports INT13 Extensions *not* available for drive 0x9f.

All VMs: INT13 Extensions available for grub_boot_drive.


CD device scanning fails if BIOS reports no INT13 Extensions for the 
boot CD drive. I will post a patch in a new thread.
Please apply your init.c "(cd0" patch also, as it is necessary if 
grub_boot_drive is not equal to ..._CDROM_START.

Christian




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-02-09 23:04         ` Pavel Roskin
@ 2008-02-10 13:43           ` Christian Franke
  2008-02-10 15:14             ` Robert Millan
  0 siblings, 1 reply; 34+ messages in thread
From: Christian Franke @ 2008-02-10 13:43 UTC (permalink / raw)
  To: The development of GRUB 2

Pavel Roskin wrote:
> On Sat, 2008-02-09 at 22:59 +0100, Robert Millan wrote:
>
>   
>>> --boot-type=(native|emulation)
>>>                     select cdrom native (default) or floppy emulation 
>>> boot type
>>>       
>> Since it is a flag for enabling a compatibility option, I think it's more
>> like a boolean.
>>     
>
> Actually, there is also hard drive emulation, which might be useful for
> USB flash keys eventually, so it's not a boolean option.  But we can
> always change it later.
>
>   

There is a hdd emulation mode for bootable CD in the El Torito standard.

AFIAK, there is no emulation mode for bootable USB flash keys. Their 
images are identical to large floppies ("superfloppy" without 
partitions) or hard disks (with partitions). Some BIOS boot both types, 
some don't.

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.

Christian




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-02-10 13:43           ` Christian Franke
@ 2008-02-10 15:14             ` Robert Millan
  2008-02-15 22:32               ` Christian Franke
  0 siblings, 1 reply; 34+ messages in thread
From: Robert Millan @ 2008-02-10 15:14 UTC (permalink / raw)
  To: The development of GRUB 2

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.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-02-10 15:14             ` Robert Millan
@ 2008-02-15 22:32               ` Christian Franke
  2008-02-17 13:31                 ` Robert Millan
  0 siblings, 1 reply; 34+ messages in thread
From: Christian Franke @ 2008-02-15 22:32 UTC (permalink / raw)
  To: The development of GRUB 2

[-- 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
 

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-02-15 22:32               ` Christian Franke
@ 2008-02-17 13:31                 ` Robert Millan
  2008-02-17 15:29                   ` Christian Franke
                                     ` (2 more replies)
  0 siblings, 3 replies; 34+ messages in thread
From: Robert Millan @ 2008-02-17 13:31 UTC (permalink / raw)
  To: The development of GRUB 2

On Fri, Feb 15, 2008 at 11:32:49PM +0100, Christian Franke wrote:
> >
> >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).

Yes, but how different would those be from floppy output?  As you point out,
floppy images work as well.

Besides, dd'ing a grub image to that stick would render the rest of the device
useless for filesystem data.

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

Is there any drawback in using --joliet ?  If not, I think it's better to do
it by default to avoid "option creep".

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  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
  2 siblings, 0 replies; 34+ messages in thread
From: Christian Franke @ 2008-02-17 15:29 UTC (permalink / raw)
  To: The development of GRUB 2

Robert Millan wrote:
> On Fri, Feb 15, 2008 at 11:32:49PM +0100, Christian Franke wrote:
>   
>>> 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).
>>     
>
> Yes, but how different would those be from floppy output?  As you point out,
> floppy images work as well.
>
>   

For a BIOS which handles USB flash drives like USB hard drives, a valid 
hard disk boot sector with a partition table should be present.
With the floppy image, GRUB detects bogus partitions on (hd0), because 
boot.img contains the "floppy_probe" code in the partition table space. 
The boot sector is also not properly patched for hdd (need to replace 
jmp by nop at "boot_drive_check").

But it actually works without any change.


> Besides, dd'ing a grub image to that stick would render the rest of the device
> useless for filesystem data.
>
>   

Yes. But if you need a rescue boot device when floppy or CD cannot be 
used for some reason, you probably do not care about this :-)

It may be possible to produce a rescue image with a valid partition 
table such that a filesystem partition can be added later.

Otherwise, grub-setup/install may work to install grub on an USB flash 
drive which has partition table and filesystem.


>> The patch also adds a --joliet option, useful to access the long file 
>> names on Windows (which has no RR support).
>>     
>
> Is there any drawback in using --joliet ?  If not, I think it's better to do
> it by default to avoid "option creep".
>
>   

I'm not aware of any drawback.

Christian




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  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
  2 siblings, 0 replies; 34+ messages in thread
From: tsah marco @ 2008-02-18  9:04 UTC (permalink / raw)
  To: The development of GRUB 2

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

Hi Robert and Frankie,

I would like to understand is it possible to install grub on usb?
 i  would like to do rescue disk,

and what are the steps you have done in-order to install grub in the usb,

What grub version did you used?
any code change in this version ?

i am working on suse 10.3 and fedora 7 linux dist

thanks Tsah



On Feb 17, 2008 3:31 PM, Robert Millan <rmh@aybabtu.com> wrote:

> On Fri, Feb 15, 2008 at 11:32:49PM +0100, Christian Franke wrote:
> > >
> > >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).
>
> Yes, but how different would those be from floppy output?  As you point
> out,
> floppy images work as well.
>
> Besides, dd'ing a grub image to that stick would render the rest of the
> device
> useless for filesystem data.
>
> > The patch also adds a --joliet option, useful to access the long file
> > names on Windows (which has no RR support).
>
> Is there any drawback in using --joliet ?  If not, I think it's better to
> do
> it by default to avoid "option creep".
>
> --
> Robert Millan
>
> <GPLv2> I know my rights; I want my phone call!
> <DRM> What use is a phone call… if you are unable to speak?
> (as seen on /.)
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>



-- 
Tsah
Marco
Cel - 972-54-5414357
Home - 972-774240642
Fax - 972-77-4240642

[-- Attachment #2: Type: text/html, Size: 2527 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  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
  2 siblings, 1 reply; 34+ messages in thread
From: Christian Franke @ 2008-03-01 21:05 UTC (permalink / raw)
  To: The development of GRUB 2

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

Robert Millan wrote:
> On Fri, Feb 15, 2008 at 11:32:49PM +0100, Christian Franke wrote:
>   
> ...
>   
>> The patch also adds a --joliet option, useful to access the long file 
>> names on Windows (which has no RR support).
>>     
>
> Is there any drawback in using --joliet ?  If not, I think it's better to do
> it by default to avoid "option creep".
>
>   

Here a new version of the patch with Joliet enabled always. Should not 
break anything.

Christian

2008-03-01  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.
	Enable Joliet CD filesystem extension.



[-- Attachment #2: grub2-mkrescue-emulation-2.patch --]
[-- Type: text/x-patch, Size: 2286 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-03-01 21:52:23.493466900 +0100
@@ -46,6 +46,7 @@
   --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)
 
 grub-mkimage generates a bootable rescue image of the specified type.
 
@@ -56,6 +57,7 @@
 image_type=cdrom
 input_dir=${pkglibdir}
 grub_mkimage=grub-mkimage
+emulation=none
 
 # Check the arguments.
 for option in "$@"; do
@@ -82,6 +84,14 @@
             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 ;;
     -*)
 	echo "Unrecognized option \`$option'" 1>&2
 	usage
@@ -113,7 +123,7 @@
   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 +135,21 @@
   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 -J ${floppy_dir}
+    rm -rf ${floppy_dir}
+  fi
 else
   # build core.img
   core_img=`mktemp`
@@ -139,7 +162,7 @@
   # 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 -J ${aux_dir}
   rm -rf ${aux_dir}
 fi
 

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-03-01 21:05                   ` Christian Franke
@ 2008-03-03 20:46                     ` Robert Millan
  2008-03-03 22:10                       ` Christian Franke
  0 siblings, 1 reply; 34+ messages in thread
From: Robert Millan @ 2008-03-03 20:46 UTC (permalink / raw)
  To: The development of GRUB 2

On Sat, Mar 01, 2008 at 10:05:22PM +0100, Christian Franke wrote:
> 
> Here a new version of the patch with Joliet enabled always. Should not 
> break anything.
> 
> Christian
> 
> 2008-03-01  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.
> 	Enable Joliet CD filesystem extension.
> 
> 

> --- grub2.orig/util/i386/pc/grub-mkrescue.in	2008-02-09 14:02:56.057039500 +0100
> +++ grub2/util/i386/pc/grub-mkrescue.in	2008-03-01 21:52:23.493466900 +0100
> @@ -46,6 +46,7 @@
>    --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)

Uhm maybe it'd be better to mention what the emulation is for.  As it is, user
might wonder what is the appropiate --emulation value for --image-type=floppy,
or even why --emulation=floppy doesn't produce floppy images.

What do you think?

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-03-03 20:46                     ` Robert Millan
@ 2008-03-03 22:10                       ` Christian Franke
  2008-03-03 22:24                         ` Robert Millan
  0 siblings, 1 reply; 34+ messages in thread
From: Christian Franke @ 2008-03-03 22:10 UTC (permalink / raw)
  To: The development of GRUB 2

Robert Millan wrote:
> On Sat, Mar 01, 2008 at 10:05:22PM +0100, Christian Franke wrote:
>   
> ...
>> --- grub2.orig/util/i386/pc/grub-mkrescue.in	2008-02-09 14:02:56.057039500 +0100
>> +++ grub2/util/i386/pc/grub-mkrescue.in	2008-03-01 21:52:23.493466900 +0100
>> @@ -46,6 +46,7 @@
>>    --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)
>>     
>
> Uhm maybe it'd be better to mention what the emulation is for.  As it is, user
> might wonder what is the appropiate --emulation value for --image-type=floppy,
> or even why --emulation=floppy doesn't produce floppy images.
>
> What do you think?
>
>   

OK, e.g.

. --emulation=TYPE        select El Torito boot emulation type floppy
.                         or none (default) (cdrom only)


Or with the help syntax used by the grub binaries:

. --emulation=(floppy|none) select El Torito boot emulation type (cdrom 
only)
.                           [default=none]


Christian




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-03-03 22:10                       ` Christian Franke
@ 2008-03-03 22:24                         ` Robert Millan
  2008-03-07 21:20                           ` Christian Franke
  0 siblings, 1 reply; 34+ messages in thread
From: Robert Millan @ 2008-03-03 22:24 UTC (permalink / raw)
  To: The development of GRUB 2

On Mon, Mar 03, 2008 at 11:10:31PM +0100, Christian Franke wrote:
> Robert Millan wrote:
> >On Sat, Mar 01, 2008 at 10:05:22PM +0100, Christian Franke wrote:
> >  
> >...
> >>--- grub2.orig/util/i386/pc/grub-mkrescue.in	2008-02-09 
> >>14:02:56.057039500 +0100
> >>+++ grub2/util/i386/pc/grub-mkrescue.in	2008-03-01 
> >>21:52:23.493466900 +0100
> >>@@ -46,6 +46,7 @@
> >>   --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)
> >>    
> >
> >Uhm maybe it'd be better to mention what the emulation is for.  As it is, 
> >user
> >might wonder what is the appropiate --emulation value for 
> >--image-type=floppy,
> >or even why --emulation=floppy doesn't produce floppy images.
> >
> >What do you think?
> >
> >  
> 
> OK, e.g.
> 
> . --emulation=TYPE        select El Torito boot emulation type floppy
> .                         or none (default) (cdrom only)
> 
> 
> Or with the help syntax used by the grub binaries:
> 
> . --emulation=(floppy|none) select El Torito boot emulation type (cdrom 
> only)
> .                           [default=none]

I don't mind either way.  Anyone else does?

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-03-03 22:24                         ` Robert Millan
@ 2008-03-07 21:20                           ` Christian Franke
  2008-04-13 15:13                             ` Robert Millan
  0 siblings, 1 reply; 34+ messages in thread
From: Christian Franke @ 2008-03-07 21:20 UTC (permalink / raw)
  To: The development of GRUB 2

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

Robert Millan wrote:
> ...
>>> Uhm maybe it'd be better to mention what the emulation is for.  As it is, 
>>> user
>>> might wonder what is the appropiate --emulation value for 
>>> --image-type=floppy,
>>> or even why --emulation=floppy doesn't produce floppy images.
>>>
>>> What do you think?
>>>
>>>  
>>>       
>> OK, e.g.
>>
>> . --emulation=TYPE        select El Torito boot emulation type floppy
>> .                         or none (default) (cdrom only)
>>
>>
>> Or with the help syntax used by the grub binaries:
>>
>> . --emulation=(floppy|none) select El Torito boot emulation type (cdrom 
>> only)
>> .                           [default=none]
>>     
>
> I don't mind either way.  Anyone else does?
>
>   

A new version of the patch is attached.

One might decide to unify bin<>sh help syntax later.

Christian

2008-03-07  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.
	Enable Joliet CD filesystem extension.



[-- Attachment #2: grub2-mkrescue-emulation-3.patch --]
[-- Type: text/x-patch, Size: 2473 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-03-07 21:20:43.046875000 +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 El Torito boot emulation type floppy
+                          or none (default) (cdrom only)
 
 grub-mkimage generates a bootable rescue image of the specified type.
 
@@ -56,6 +58,7 @@ EOF
 image_type=cdrom
 input_dir=${pkglibdir}
 grub_mkimage=grub-mkimage
+emulation=none
 
 # Check the arguments.
 for option in "$@"; do
@@ -82,6 +85,14 @@ 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 ;;
     -*)
 	echo "Unrecognized option \`$option'" 1>&2
 	usage
@@ -113,7 +124,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 +136,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 -J ${floppy_dir}
+    rm -rf ${floppy_dir}
+  fi
 else
   # build core.img
   core_img=`mktemp`
@@ -139,7 +163,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 -J ${aux_dir}
   rm -rf ${aux_dir}
 fi
 

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-03-07 21:20                           ` Christian Franke
@ 2008-04-13 15:13                             ` Robert Millan
  0 siblings, 0 replies; 34+ messages in thread
From: Robert Millan @ 2008-04-13 15:13 UTC (permalink / raw)
  To: The development of GRUB 2; +Cc: Christian Franke

On Fri, Mar 07, 2008 at 10:20:25PM +0100, Christian Franke wrote:
> 
> 2008-03-07  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.
> 	Enable Joliet CD filesystem extension.

Committed.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD  with grub-mkimage
@ 2008-03-04  9:22 Christian Franke
  0 siblings, 0 replies; 34+ messages in thread
From: Christian Franke @ 2008-03-04  9:22 UTC (permalink / raw)
  To: grub-devel

Kalamatee wrote:
> 
> Doesnt "El Torito" mean using no emulation?   
> 

--emulation=(floppy|none)  selects "El Torito" emulation mode (2|0)

"El Torito" Standard 1.0 (1995) specifies 5 emulation modes:

0  No Emulation
1  1.2MB Floppy
2  1.44MB Floppy
3  2.88MB Floppy
4  Hard Disk (drive 0x80)

See:
http://www.phoenix.com/NR/rdonlyres/98D3219C-9CC9-4DF5-B496-A286D893E36A/0/specscdrom.pdf

Christian






^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
  2008-03-04  2:11 Kalamatee
@ 2008-03-04  2:12 ` Kalamatee
  0 siblings, 0 replies; 34+ messages in thread
From: Kalamatee @ 2008-03-04  2:12 UTC (permalink / raw)
  To: grub-devel

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

bah ignore my last mail... yeah floppy or none makes sense

On 04/03/2008, Kalamatee <kalamatee@gmail.com> wrote:
>
> >>* *>* OK, e.g.*
> >>* *
> >>* . --emulation=TYPE        select El Torito boot emulation type floppy*
> >>* .                         or none (default) (cdrom only)*
> >>* *
> >>* *
> >>* Or with the help syntax used by the grub binaries:*
> >>* *
> >>* . --emulation=(floppy|none) select El Torito boot emulation type
> (cdrom *
> >>* only)*
> >>* .                           [default=none]*
>
> >I don't mind either way.  Anyone else does?
>
> Doesnt "El Torito" mean using no emulation?
>
> if so id word it differently since it is confusing otherwise...
>
> *--emulation=(floppy|eltorito)   if '--image-type=cdrom', this specifies
> the method used to boot **[default=eltorito]*
>

[-- Attachment #2: Type: text/html, Size: 1618 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] Create floppy emulation boot CD with grub-mkimage
@ 2008-03-04  2:11 Kalamatee
  2008-03-04  2:12 ` Kalamatee
  0 siblings, 1 reply; 34+ messages in thread
From: Kalamatee @ 2008-03-04  2:11 UTC (permalink / raw)
  To: grub-devel

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

>>* *>* OK, e.g.*
>>* *
>>* . --emulation=TYPE        select El Torito boot emulation type floppy*
>>* .                         or none (default) (cdrom only)*
>>* *
>>* *
>>* Or with the help syntax used by the grub binaries:*
>>* *
>>* . --emulation=(floppy|none) select El Torito boot emulation type (cdrom
*
>>* only)*
>>* .                           [default=none]*

>I don't mind either way.  Anyone else does?

Doesnt "El Torito" mean using no emulation?

if so id word it differently since it is confusing otherwise...

*--emulation=(floppy|eltorito)   if '--image-type=cdrom', this specifies the
method used to boot **[default=eltorito]*

[-- Attachment #2: Type: text/html, Size: 1242 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2008-04-13 15:14 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
2008-03-04  2:11 Kalamatee
2008-03-04  2:12 ` Kalamatee
2008-03-04  9:22 Christian Franke

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.