All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Ensure boot CD can be accessed
@ 2008-02-10 12:23 Christian Franke
  2008-02-10 12:37 ` Bean
  0 siblings, 1 reply; 9+ messages in thread
From: Christian Franke @ 2008-02-10 12:23 UTC (permalink / raw)
  To: grub-devel

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

Detecting BIOS CD device by INT13 "Check Extensions" (AH=42) call does 
not work for all BIOSes.

This patch fixes this to allow access to the boot CD.

See also thread "[PATCH] Create floppy emulation boot CD with 
grub-mkimage". The "(cd0" patch from Bean is not included here but 
should also be applied.

Christian

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

	* disk/i386/pc/biosdisk.c: Include <grub/machine/kernel.h>.
	(GRUB_MOD_INIT): Make boot CD accessible even if BIOS does not report
	INT13 Extensions for grub_boot_drive.
	* include/grub/i386/pc/biosdisk.h (GRUB_BIOSDISK_MACHINE_CDROM_START):
	Change from 0xe0 to 0x9f to cover more BIOS variants.
	* include/grub/i386/pc/kernel.h (grub_boot_drive): Add EXPORT_VAR.



[-- Attachment #2: grub2-biosdisk-bootcd.patch --]
[-- Type: text/x-patch, Size: 1911 bytes --]

diff -rup --exclude CVS grub2.orig/disk/i386/pc/biosdisk.c grub2/disk/i386/pc/biosdisk.c
--- grub2.orig/disk/i386/pc/biosdisk.c	2008-02-03 20:29:51.500000000 +0100
+++ grub2/disk/i386/pc/biosdisk.c	2008-02-10 12:26:25.843750000 +0100
@@ -18,6 +18,7 @@
 
 #include <grub/machine/biosdisk.h>
 #include <grub/machine/memory.h>
+#include <grub/machine/kernel.h>
 #include <grub/disk.h>
 #include <grub/dl.h>
 #include <grub/mm.h>
@@ -391,6 +392,16 @@ GRUB_MOD_INIT(biosdisk)
 	}
     }
 
+  /* Some BIOSes do not report INT13 Extensions for the
+     boot CD.  Ensure that the boot CD can be accessed.  */
+  if (! found
+      && GRUB_BIOSDISK_MACHINE_CDROM_START <= grub_boot_drive
+      && grub_boot_drive < GRUB_BIOSDISK_MACHINE_CDROM_END)
+    {
+      cd_start = grub_boot_drive;
+      found = 1;
+    }
+
   cd_count = found;
 }
 
diff -rup --exclude CVS grub2.orig/include/grub/i386/pc/biosdisk.h grub2/include/grub/i386/pc/biosdisk.h
--- grub2.orig/include/grub/i386/pc/biosdisk.h	2008-02-03 20:29:52.187500000 +0100
+++ grub2/include/grub/i386/pc/biosdisk.h	2008-02-09 15:55:04.713289500 +0100
@@ -25,7 +25,7 @@
 #define GRUB_BIOSDISK_FLAG_LBA	1
 #define GRUB_BIOSDISK_FLAG_CDROM 2
 
-#define GRUB_BIOSDISK_MACHINE_CDROM_START	0xe0
+#define GRUB_BIOSDISK_MACHINE_CDROM_START	0x9f
 #define GRUB_BIOSDISK_MACHINE_CDROM_END		0xf0
 
 struct grub_biosdisk_data
diff -rup --exclude CVS grub2.orig/include/grub/i386/pc/kernel.h grub2/include/grub/i386/pc/kernel.h
--- grub2.orig/include/grub/i386/pc/kernel.h	2008-02-03 20:29:52.375000000 +0100
+++ grub2/include/grub/i386/pc/kernel.h	2008-02-10 00:16:43.812500000 +0100
@@ -71,7 +71,7 @@ extern grub_int32_t grub_memdisk_image_s
 extern char grub_prefix[];
 
 /* The boot BIOS drive number.  */
-extern grub_int32_t grub_boot_drive;
+extern grub_int32_t EXPORT_VAR(grub_boot_drive);
 
 /* The root BIOS drive number.  */
 extern grub_int32_t grub_root_drive;

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

* Re: [PATCH] Ensure boot CD can be accessed
  2008-02-10 12:23 [PATCH] Ensure boot CD can be accessed Christian Franke
@ 2008-02-10 12:37 ` Bean
  2008-02-10 12:47   ` Christian Franke
  0 siblings, 1 reply; 9+ messages in thread
From: Bean @ 2008-02-10 12:37 UTC (permalink / raw)
  To: The development of GRUB 2

On Feb 10, 2008 8:23 PM, Christian Franke <Christian.Franke@t-online.de> wrote:
> Detecting BIOS CD device by INT13 "Check Extensions" (AH=42) call does
> not work for all BIOSes.
>
> This patch fixes this to allow access to the boot CD.
>
> See also thread "[PATCH] Create floppy emulation boot CD with
> grub-mkimage". The "(cd0" patch from Bean is not included here but
> should also be applied.
>
> Christian
>
> 2008-02-10  Christian Franke  <franke@computer.org>
>
>         * disk/i386/pc/biosdisk.c: Include <grub/machine/kernel.h>.
>         (GRUB_MOD_INIT): Make boot CD accessible even if BIOS does not report
>         INT13 Extensions for grub_boot_drive.
>         * include/grub/i386/pc/biosdisk.h (GRUB_BIOSDISK_MACHINE_CDROM_START):
>         Change from 0xe0 to 0x9f to cover more BIOS variants.
>         * include/grub/i386/pc/kernel.h (grub_boot_drive): Add EXPORT_VAR.

i think we can assume grub_boot_drive as (cd0) if it's within range,
and start scanning from grub_boot_drive + 1.

-- 
Bean



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

* Re: [PATCH] Ensure boot CD can be accessed
  2008-02-10 12:37 ` Bean
@ 2008-02-10 12:47   ` Christian Franke
  2008-02-10 12:56     ` Bean
  0 siblings, 1 reply; 9+ messages in thread
From: Christian Franke @ 2008-02-10 12:47 UTC (permalink / raw)
  To: The development of GRUB 2

Bean wrote:
> On Feb 10, 2008 8:23 PM, Christian Franke <...> wrote:
>   
>> ...
>> 2008-02-10  Christian Franke  <franke@computer.org>
>>
>>         * disk/i386/pc/biosdisk.c: Include <grub/machine/kernel.h>.
>>         (GRUB_MOD_INIT): Make boot CD accessible even if BIOS does not report
>>         INT13 Extensions for grub_boot_drive.
>>         * include/grub/i386/pc/biosdisk.h (GRUB_BIOSDISK_MACHINE_CDROM_START):
>>         Change from 0xe0 to 0x9f to cover more BIOS variants.
>>         * include/grub/i386/pc/kernel.h (grub_boot_drive): Add EXPORT_VAR.
>>     
>
> i think we can assume grub_boot_drive as (cd0) if it's within range,
> and start scanning from grub_boot_drive + 1.
>
>   

Yes, I will provide a new patch. Should it include your init.c patch?

Christian




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

* Re: [PATCH] Ensure boot CD can be accessed
  2008-02-10 12:47   ` Christian Franke
@ 2008-02-10 12:56     ` Bean
  2008-02-10 14:42       ` Christian Franke
  0 siblings, 1 reply; 9+ messages in thread
From: Bean @ 2008-02-10 12:56 UTC (permalink / raw)
  To: The development of GRUB 2

On Feb 10, 2008 8:47 PM, Christian Franke <Christian.Franke@t-online.de> wrote:
> Bean wrote:
> > On Feb 10, 2008 8:23 PM, Christian Franke <...> wrote:
> >
> >> ...
> >> 2008-02-10  Christian Franke  <franke@computer.org>
> >>
> >>         * disk/i386/pc/biosdisk.c: Include <grub/machine/kernel.h>.
> >>         (GRUB_MOD_INIT): Make boot CD accessible even if BIOS does not report
> >>         INT13 Extensions for grub_boot_drive.
> >>         * include/grub/i386/pc/biosdisk.h (GRUB_BIOSDISK_MACHINE_CDROM_START):
> >>         Change from 0xe0 to 0x9f to cover more BIOS variants.
> >>         * include/grub/i386/pc/kernel.h (grub_boot_drive): Add EXPORT_VAR.
> >>
> >
> > i think we can assume grub_boot_drive as (cd0) if it's within range,
> > and start scanning from grub_boot_drive + 1.
> >
> >
>
> Yes, I will provide a new patch. Should it include your init.c patch?

you can include it so that the changes can be committed at the same time.

-- 
Bean



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

* Re: [PATCH] Ensure boot CD can be accessed
  2008-02-10 12:56     ` Bean
@ 2008-02-10 14:42       ` Christian Franke
  2008-02-15 21:13         ` Christian Franke
  0 siblings, 1 reply; 9+ messages in thread
From: Christian Franke @ 2008-02-10 14:42 UTC (permalink / raw)
  To: The development of GRUB 2

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

Bean wrote:
> On Feb 10, 2008 8:47 PM, Christian Franke <...> wrote:
>   
>> Bean wrote:
>>     
>>> On Feb 10, 2008 8:23 PM, Christian Franke <...> wrote:
>>>
>>>       
>>>> ...
>>>>         
>>> i think we can assume grub_boot_drive as (cd0) if it's within range,
>>> and start scanning from grub_boot_drive + 1.
>>>
>>>
>>>       
>> Yes, I will provide a new patch. Should it include your init.c patch?
>>     
>
> you can include it so that the changes can be committed at the same time.
>
>   

New patch below.

Christian

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

	* disk/i386/pc/biosdisk.c: Include <grub/machine/kernel.h>.
	(GRUB_MOD_INIT): Make boot CD accessible even if BIOS does not report
	INT13 Extensions for grub_boot_drive. Start CD scanning from
	grub_boot_drive + 1.
	* include/grub/i386/pc/biosdisk.h (GRUB_BIOSDISK_MACHINE_CDROM_START):
	Change from 0xe0 to 0x9f to cover more BIOS variants.
	* include/grub/i386/pc/kernel.h (grub_boot_drive): Add EXPORT_VAR.
	* kern/i386/pc/init.c (make_install_device): Always set boot CD device
	name to "(cd0)". Patch was provided by Bean.




[-- Attachment #2: grub2-biosdisk-bootcd-2.patch --]
[-- Type: text/x-patch, Size: 3183 bytes --]

diff -rup --exclude CVS grub2.orig/disk/i386/pc/biosdisk.c grub2/disk/i386/pc/biosdisk.c
--- grub2.orig/disk/i386/pc/biosdisk.c	2008-02-03 20:29:51.500000000 +0100
+++ grub2/disk/i386/pc/biosdisk.c	2008-02-10 15:16:19.343750000 +0100
@@ -18,6 +18,7 @@
 
 #include <grub/machine/biosdisk.h>
 #include <grub/machine/memory.h>
+#include <grub/machine/kernel.h>
 #include <grub/disk.h>
 #include <grub/dl.h>
 #include <grub/mm.h>
@@ -364,7 +365,8 @@ grub_disk_biosdisk_fini (void)
 
 GRUB_MOD_INIT(biosdisk)
 {
-  int drive, found = 0;
+  int drive = GRUB_BIOSDISK_MACHINE_CDROM_START;
+  int found = 0;
 
   if (grub_disk_firmware_is_tainted)
     {
@@ -375,8 +377,17 @@ GRUB_MOD_INIT(biosdisk)
 
   grub_disk_dev_register (&grub_biosdisk_dev);
 
-  for (drive = GRUB_BIOSDISK_MACHINE_CDROM_START;
-       drive < GRUB_BIOSDISK_MACHINE_CDROM_END; drive++)
+  /* Some BIOSes do not report INT13 Extensions for the
+     boot CD.  Ensure that the boot CD can be accessed.  */
+  if (GRUB_BIOSDISK_MACHINE_CDROM_START <= grub_boot_drive
+      && grub_boot_drive < GRUB_BIOSDISK_MACHINE_CDROM_END)
+    {
+      cd_start = grub_boot_drive;
+      drive = grub_boot_drive + 1;
+      found = 1;
+    }
+
+  for ( ; drive < GRUB_BIOSDISK_MACHINE_CDROM_END; drive++)
     {
       if (grub_biosdisk_check_int13_extensions (drive))
         {
diff -rup --exclude CVS grub2.orig/include/grub/i386/pc/biosdisk.h grub2/include/grub/i386/pc/biosdisk.h
--- grub2.orig/include/grub/i386/pc/biosdisk.h	2008-02-03 20:29:52.187500000 +0100
+++ grub2/include/grub/i386/pc/biosdisk.h	2008-02-09 15:55:04.713289500 +0100
@@ -25,7 +25,7 @@
 #define GRUB_BIOSDISK_FLAG_LBA	1
 #define GRUB_BIOSDISK_FLAG_CDROM 2
 
-#define GRUB_BIOSDISK_MACHINE_CDROM_START	0xe0
+#define GRUB_BIOSDISK_MACHINE_CDROM_START	0x9f
 #define GRUB_BIOSDISK_MACHINE_CDROM_END		0xf0
 
 struct grub_biosdisk_data
diff -rup --exclude CVS grub2.orig/include/grub/i386/pc/kernel.h grub2/include/grub/i386/pc/kernel.h
--- grub2.orig/include/grub/i386/pc/kernel.h	2008-02-03 20:29:52.375000000 +0100
+++ grub2/include/grub/i386/pc/kernel.h	2008-02-10 00:16:43.812500000 +0100
@@ -71,7 +71,7 @@ extern grub_int32_t grub_memdisk_image_s
 extern char grub_prefix[];
 
 /* The boot BIOS drive number.  */
-extern grub_int32_t grub_boot_drive;
+extern grub_int32_t EXPORT_VAR(grub_boot_drive);
 
 /* The root BIOS drive number.  */
 extern grub_int32_t grub_root_drive;
diff -rup --exclude CVS grub2.orig/kern/i386/pc/init.c grub2/kern/i386/pc/init.c
--- grub2.orig/kern/i386/pc/init.c	2008-02-03 20:29:53.125000000 +0100
+++ grub2/kern/i386/pc/init.c	2008-02-10 15:05:40.140625000 +0100
@@ -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',

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

* Re: [PATCH] Ensure boot CD can be accessed
  2008-02-10 14:42       ` Christian Franke
@ 2008-02-15 21:13         ` Christian Franke
  2008-03-02  8:42           ` Bean
  0 siblings, 1 reply; 9+ messages in thread
From: Christian Franke @ 2008-02-15 21:13 UTC (permalink / raw)
  To: The development of GRUB 2

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

Christian Franke wrote:
> ...
> New patch below.
>

Further testing outdated this patch. The boot CD appeared under the 
following drive numbers:

0x82 (old Toshiba Laptop with unknown BIOS)
0x9f (PC with Phoenix-Award BIOS, VMware)
0xe0 (VirtualBox)
0xef (PC with AMI BIOS, VirtualPC)

Current CVS would only work for 0xe0, with the previous patch it works 
for all >= 0x9f.

This new patch also handles the case that the CD appears under the 
legacy controller drive number (0x82 = secondary master). It is accessed 
as "hd2" in this case.

Christian

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

	* disk/i386/pc/biosdisk.c: Include <grub/machine/kernel.h>.
	(grub_biosdisk_iterate): Always list boot drive.
	(grub_biosdisk_open): Assume CD if get diskinfo fails for boot drive
	not detected as CD before.
	(GRUB_MOD_INIT): Make boot CD accessible even if BIOS does not report
	INT13 Extensions for boot drive. Start CD scanning from
	grub_boot_drive + 1.
	* include/grub/i386/pc/biosdisk.h (GRUB_BIOSDISK_MACHINE_CDROM_START):
	Change from 0xe0 to 0x9f to cover more BIOS variants.
	* include/grub/i386/pc/kernel.h (grub_boot_drive): Add EXPORT_VAR.
	* kern/i386/pc/init.c (make_install_device): Always set boot CD device
	name to "(cd0)". Patch was provided by Bean.



[-- Attachment #2: grub2-biosdisk-bootcd-3.patch --]
[-- Type: text/x-patch, Size: 5305 bytes --]

diff -rup --exclude CVS grub2.orig/disk/i386/pc/biosdisk.c grub2/disk/i386/pc/biosdisk.c
--- grub2.orig/disk/i386/pc/biosdisk.c	2008-02-03 20:29:51.500000000 +0100
+++ grub2/disk/i386/pc/biosdisk.c	2008-02-15 21:16:56.921875000 +0100
@@ -18,6 +18,7 @@
 
 #include <grub/machine/biosdisk.h>
 #include <grub/machine/memory.h>
+#include <grub/machine/kernel.h>
 #include <grub/disk.h>
 #include <grub/dl.h>
 #include <grub/mm.h>
@@ -91,6 +92,11 @@ grub_biosdisk_iterate (int (*hook) (cons
 	return 1;
     }
 
+  /* List boot drive as hard disk if not detected as hard disk or CD.  */
+  if (drive <= grub_boot_drive && grub_boot_drive < cd_start)
+    if (grub_biosdisk_call_hook (hook, grub_boot_drive))
+      return 1;
+
   for (drive = cd_start; drive < cd_start + cd_count; drive++)
     if (grub_biosdisk_call_hook (hook, drive))
       return 1;
@@ -119,12 +125,11 @@ grub_biosdisk_open (const char *name, gr
   data->drive = drive;
   data->flags = 0;
 
-  if (drive >= cd_start)
-    {
-      data->flags = GRUB_BIOSDISK_FLAG_LBA | GRUB_BIOSDISK_FLAG_CDROM;
-      data->sectors = 32;
-      total_sectors = 9000000;  /* TODO: get the correct size.  */
-    }
+  int is_cd = 0;
+
+  if (cd_start <= drive && drive < cd_start + cd_count)
+    /* INT13 Extensions or boot CD detected during init.  */
+    is_cd = 1;
   else if (drive & 0x80)
     {
       /* HDD */
@@ -154,19 +159,32 @@ grub_biosdisk_open (const char *name, gr
 	}
     }
 
-  if (drive < cd_start)
+  if (! is_cd)
     {
-      if (grub_biosdisk_get_diskinfo_standard (drive,
-					       &data->cylinders,
-					       &data->heads,
-					       &data->sectors) != 0)
+      if (! grub_biosdisk_get_diskinfo_standard (drive,
+						 &data->cylinders,
+						 &data->heads,
+						 &data->sectors))
+	{
+	  if (! total_sectors)
+	    total_sectors = data->cylinders * data->heads * data->sectors;
+	}
+      else if (drive == grub_boot_drive)
+	/* Some old BIOSes return a legacy controller drive number
+	   for the boot CD.  Ensure that the boot CD can be accessed.  */
+	is_cd = 1;
+      else
         {
           grub_free (data);
           return grub_error (GRUB_ERR_BAD_DEVICE, "cannot get C/H/S values");
         }
+    }
 
-      if (! total_sectors)
-        total_sectors = data->cylinders * data->heads * data->sectors;
+  if (is_cd)
+    {
+      data->flags = GRUB_BIOSDISK_FLAG_LBA | GRUB_BIOSDISK_FLAG_CDROM;
+      data->sectors = 32;
+      total_sectors = 9000000;  /* TODO: get the correct size.  */
     }
 
   disk->total_sectors = total_sectors;
@@ -364,7 +382,8 @@ grub_disk_biosdisk_fini (void)
 
 GRUB_MOD_INIT(biosdisk)
 {
-  int drive, found = 0;
+  int drive = GRUB_BIOSDISK_MACHINE_CDROM_START;
+  int found = 0;
 
   if (grub_disk_firmware_is_tainted)
     {
@@ -375,8 +394,17 @@ GRUB_MOD_INIT(biosdisk)
 
   grub_disk_dev_register (&grub_biosdisk_dev);
 
-  for (drive = GRUB_BIOSDISK_MACHINE_CDROM_START;
-       drive < GRUB_BIOSDISK_MACHINE_CDROM_END; drive++)
+  /* Some BIOSes do not report INT13 Extensions for the
+     boot CD.  Ensure that the boot CD can be accessed.  */
+  if (GRUB_BIOSDISK_MACHINE_CDROM_START <= grub_boot_drive
+      && grub_boot_drive < GRUB_BIOSDISK_MACHINE_CDROM_END)
+    {
+      cd_start = grub_boot_drive;
+      drive = grub_boot_drive + 1;
+      found = 1;
+    }
+
+  for ( ; drive < GRUB_BIOSDISK_MACHINE_CDROM_END; drive++)
     {
       if (grub_biosdisk_check_int13_extensions (drive))
         {
diff -rup --exclude CVS grub2.orig/include/grub/i386/pc/biosdisk.h grub2/include/grub/i386/pc/biosdisk.h
--- grub2.orig/include/grub/i386/pc/biosdisk.h	2008-02-03 20:29:52.187500000 +0100
+++ grub2/include/grub/i386/pc/biosdisk.h	2008-02-09 15:55:04.713289500 +0100
@@ -25,7 +25,7 @@
 #define GRUB_BIOSDISK_FLAG_LBA	1
 #define GRUB_BIOSDISK_FLAG_CDROM 2
 
-#define GRUB_BIOSDISK_MACHINE_CDROM_START	0xe0
+#define GRUB_BIOSDISK_MACHINE_CDROM_START	0x9f
 #define GRUB_BIOSDISK_MACHINE_CDROM_END		0xf0
 
 struct grub_biosdisk_data
diff -rup --exclude CVS grub2.orig/include/grub/i386/pc/kernel.h grub2/include/grub/i386/pc/kernel.h
--- grub2.orig/include/grub/i386/pc/kernel.h	2008-02-03 20:29:52.375000000 +0100
+++ grub2/include/grub/i386/pc/kernel.h	2008-02-10 00:16:43.812500000 +0100
@@ -71,7 +71,7 @@ extern grub_int32_t grub_memdisk_image_s
 extern char grub_prefix[];
 
 /* The boot BIOS drive number.  */
-extern grub_int32_t grub_boot_drive;
+extern grub_int32_t EXPORT_VAR(grub_boot_drive);
 
 /* The root BIOS drive number.  */
 extern grub_int32_t grub_root_drive;
diff -rup --exclude CVS grub2.orig/kern/i386/pc/init.c grub2/kern/i386/pc/init.c
--- grub2.orig/kern/i386/pc/init.c	2008-02-03 20:29:53.125000000 +0100
+++ grub2/kern/i386/pc/init.c	2008-02-10 15:05:40.140625000 +0100
@@ -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',

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

* Re: [PATCH] Ensure boot CD can be accessed
  2008-02-15 21:13         ` Christian Franke
@ 2008-03-02  8:42           ` Bean
  2008-03-03 20:46             ` Christian Franke
  0 siblings, 1 reply; 9+ messages in thread
From: Bean @ 2008-03-02  8:42 UTC (permalink / raw)
  To: The development of GRUB 2

On Sat, Feb 16, 2008 at 5:13 AM, Christian Franke
<Christian.Franke@t-online.de> wrote:
> Christian Franke wrote:
>  > ...
>  > New patch below.
>  >
>
>  Further testing outdated this patch. The boot CD appeared under the
>  following drive numbers:
>
>  0x82 (old Toshiba Laptop with unknown BIOS)
>  0x9f (PC with Phoenix-Award BIOS, VMware)
>  0xe0 (VirtualBox)
>  0xef (PC with AMI BIOS, VirtualPC)
>
>  Current CVS would only work for 0xe0, with the previous patch it works
>  for all >= 0x9f.
>
>  This new patch also handles the case that the CD appears under the
>  legacy controller drive number (0x82 = secondary master). It is accessed
>  as "hd2" in this case.
>
>  Christian
>
>  2008-02-15  Christian Franke  <franke@computer.org>
>
>
>         * disk/i386/pc/biosdisk.c: Include <grub/machine/kernel.h>.
>         (grub_biosdisk_iterate): Always list boot drive.
>         (grub_biosdisk_open): Assume CD if get diskinfo fails for boot drive
>         not detected as CD before.
>
>         (GRUB_MOD_INIT): Make boot CD accessible even if BIOS does not report
>         INT13 Extensions for boot drive. Start CD scanning from
>
>
>         grub_boot_drive + 1.
>         * include/grub/i386/pc/biosdisk.h (GRUB_BIOSDISK_MACHINE_CDROM_START):
>         Change from 0xe0 to 0x9f to cover more BIOS variants.
>         * include/grub/i386/pc/kernel.h (grub_boot_drive): Add EXPORT_VAR.
>         * kern/i386/pc/init.c (make_install_device): Always set boot CD device
>         name to "(cd0)". Patch was provided by Bean.

I'm thinking, is there a more generic way to test for cd drive ? also,
if the cd drive can appear as (hd2), maybe we can use (hdx) for other
cases as well, such as (hd96), etc. The name might be a little
strange, but we can get the bios drive number quite easily, which can
be useful sometimes (some boot loader need to know the boot drive
number).

-- 
Bean



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

* Re: [PATCH] Ensure boot CD can be accessed
  2008-03-02  8:42           ` Bean
@ 2008-03-03 20:46             ` Christian Franke
  2008-03-05  7:05               ` Bean
  0 siblings, 1 reply; 9+ messages in thread
From: Christian Franke @ 2008-03-03 20:46 UTC (permalink / raw)
  To: The development of GRUB 2

Bean wrote:
> On Sat, Feb 16, 2008 at 5:13 AM, Christian Franke
> <...> wrote:
>   
>> ...
>>  Further testing outdated this patch. The boot CD appeared under the
>>  following drive numbers:
>>
>>  0x82 (old Toshiba Laptop with unknown BIOS)
>>  0x9f (PC with Phoenix-Award BIOS, VMware)
>>  0xe0 (VirtualBox)
>>  0xef (PC with AMI BIOS, VirtualPC)
>>
>>  Current CVS would only work for 0xe0, with the previous patch it works
>>  for all >= 0x9f.
>>
>>  This new patch also handles the case that the CD appears under the
>>  legacy controller drive number (0x82 = secondary master). It is accessed
>>  as "hd2" in this case.
>>
>>  Christian
>>
>>  ...
>>     
>
> I'm thinking, is there a more generic way to test for cd drive ? also,
> if the cd drive can appear as (hd2), maybe we can use (hdx) for other
> cases as well, such as (hd96), etc. The name might be a little
> strange, but we can get the bios drive number quite easily, which can
> be useful sometimes (some boot loader need to know the boot drive
> number).
>
>   

Good point.

Besides the heuristics "(boot drive >= 0x9f) => (likely a boot CD)", 
there is apparently no clean method to distinguish CD from HDD on the 
legacy BIOS call level.

Is the special handling for CD in grub_biosdisk_rw() necessary, or can 
it be generalized to work with both CD and HDD? In the latter case, no 
actual CD detection is necessary.

So is would be probably better to remove the (cdN) device names and 
accept funny names like e.g. (hd111) for boot CD 0xef. It also would be 
easier to track down problems when the boot device number is no longer 
hidden behind (cd0).

BTW: None of the BIOSes I tested provided access to a second (non-boot) 
CD drive.

Christian




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

* Re: [PATCH] Ensure boot CD can be accessed
  2008-03-03 20:46             ` Christian Franke
@ 2008-03-05  7:05               ` Bean
  0 siblings, 0 replies; 9+ messages in thread
From: Bean @ 2008-03-05  7:05 UTC (permalink / raw)
  To: The development of GRUB 2

On Tue, Mar 4, 2008 at 4:46 AM, Christian Franke
<Christian.Franke@t-online.de> wrote:
> Bean wrote:
>  > On Sat, Feb 16, 2008 at 5:13 AM, Christian Franke
>  > <...> wrote:
>  >
>  >> ...
>
> >>  Further testing outdated this patch. The boot CD appeared under the
>  >>  following drive numbers:
>  >>
>  >>  0x82 (old Toshiba Laptop with unknown BIOS)
>  >>  0x9f (PC with Phoenix-Award BIOS, VMware)
>  >>  0xe0 (VirtualBox)
>  >>  0xef (PC with AMI BIOS, VirtualPC)
>  >>
>  >>  Current CVS would only work for 0xe0, with the previous patch it works
>  >>  for all >= 0x9f.
>  >>
>  >>  This new patch also handles the case that the CD appears under the
>  >>  legacy controller drive number (0x82 = secondary master). It is accessed
>  >>  as "hd2" in this case.
>  >>
>  >>  Christian
>  >>
>  >>  ...
>
> >>
>  >
>  > I'm thinking, is there a more generic way to test for cd drive ? also,
>  > if the cd drive can appear as (hd2), maybe we can use (hdx) for other
>  > cases as well, such as (hd96), etc. The name might be a little
>  > strange, but we can get the bios drive number quite easily, which can
>  > be useful sometimes (some boot loader need to know the boot drive
>  > number).
>  >
>  >
>
>  Good point.
>
>  Besides the heuristics "(boot drive >= 0x9f) => (likely a boot CD)",
>  there is apparently no clean method to distinguish CD from HDD on the
>  legacy BIOS call level.
>
>  Is the special handling for CD in grub_biosdisk_rw() necessary, or can
>  it be generalized to work with both CD and HDD? In the latter case, no
>  actual CD detection is necessary.
>
>  So is would be probably better to remove the (cdN) device names and
>  accept funny names like e.g. (hd111) for boot CD 0xef. It also would be
>  easier to track down problems when the boot device number is no longer
>  hidden behind (cd0).
>
>  BTW: None of the BIOSes I tested provided access to a second (non-boot)
>  CD drive.

I take a look at grub legacy, it uses INT 13 FUNC 4B01 to check for
cdrom, maybe i can write a patch later.

-- 
Bean



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

end of thread, other threads:[~2008-03-05  7:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-10 12:23 [PATCH] Ensure boot CD can be accessed Christian Franke
2008-02-10 12:37 ` Bean
2008-02-10 12:47   ` Christian Franke
2008-02-10 12:56     ` Bean
2008-02-10 14:42       ` Christian Franke
2008-02-15 21:13         ` Christian Franke
2008-03-02  8:42           ` Bean
2008-03-03 20:46             ` Christian Franke
2008-03-05  7:05               ` Bean

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.