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: Sat, 09 Feb 2008 17:53:12 +0100	[thread overview]
Message-ID: <47ADDA78.5020602@t-online.de> (raw)
In-Reply-To: <ca0f59980802090356i2bcacd4ch91931f9e8d61b567@mail.gmail.com>

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




  parent reply	other threads:[~2008-02-09 16:53 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 [this message]
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
  -- 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=47ADDA78.5020602@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.