From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JNsxP-00023m-G1 for mharc-grub-devel@gnu.org; Sat, 09 Feb 2008 11:53:39 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JNsxN-00022Z-L7 for grub-devel@gnu.org; Sat, 09 Feb 2008 11:53:37 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JNsxM-00022J-UT for grub-devel@gnu.org; Sat, 09 Feb 2008 11:53:37 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JNsxM-00022D-Qp for grub-devel@gnu.org; Sat, 09 Feb 2008 11:53:36 -0500 Received: from mailout01.sul.t-online.de ([194.25.134.80] helo=mailout01.sul.t-online.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JNsxM-00012Q-8x for grub-devel@gnu.org; Sat, 09 Feb 2008 11:53:36 -0500 Received: from fwd31.aul.t-online.de by mailout01.sul.t-online.com with smtp id 1JNsxI-00017I-01; Sat, 09 Feb 2008 17:53:32 +0100 Received: from [10.3.2.2] (bHtZyeZArhpoNeFV13g1R0S48vUvspHnYEPdwMW0dQluWkMjent9ugGrmNB0Jx5Q0a@[217.235.233.86]) by fwd31.aul.t-online.de with esmtp id 1JNswy-0wnRMe0; Sat, 9 Feb 2008 17:53:12 +0100 Message-ID: <47ADDA78.5020602@t-online.de> Date: Sat, 09 Feb 2008 17:53:12 +0100 From: Christian Franke User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071128 SeaMonkey/1.1.7 MIME-Version: 1.0 To: The development of GRUB 2 References: <47ACA35C.6080803@t-online.de> <20080208191743.GB24599@thorin> <47ACD19B.8040702@t-online.de> <20080208224510.GB12839@thorin> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-ID: bHtZyeZArhpoNeFV13g1R0S48vUvspHnYEPdwMW0dQluWkMjent9ugGrmNB0Jx5Q0a X-TOI-MSGID: a279fb8d-1970-44d1-9bc3-26da0f2dcb4b X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Subject: Re: [PATCH] Create floppy emulation boot CD with grub-mkimage X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Feb 2008 16:53:37 -0000 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