Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KR4PG-0000ZJ-Bf for mharc-grub-devel@gnu.org; Thu, 07 Aug 2008 08:15:50 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KR4PE-0000Yn-RA for grub-devel@gnu.org; Thu, 07 Aug 2008 08:15:48 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KR4PD-0000YI-K1 for grub-devel@gnu.org; Thu, 07 Aug 2008 08:15:48 -0400 Received: from [199.232.76.173] (port=47028 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KR4PD-0000YF-EA for grub-devel@gnu.org; Thu, 07 Aug 2008 08:15:47 -0400 Received: from web31605.mail.mud.yahoo.com ([68.142.198.151]:48638) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1KR4PC-0000Vg-Vq for grub-devel@gnu.org; Thu, 07 Aug 2008 08:15:47 -0400 Received: (qmail 34394 invoked by uid 60001); 7 Aug 2008 12:15:46 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Message-ID; b=Oln15X4jFxuGNxL4MM/XeYdIRbjCuN14eR5nj7+zQ6M7LRK0OhogOKvr/B3UJ2TjerHxk8SHTycc+tsbSeGAUZ0ywoxkqLf34BAJEg87zB/G8DAICQ5j//+Q3zleX6bMYDnPDnI3uA/ON9lAi+JVIBQ9yZ9Xg4uv4i020KVggGk=; Received: from [202.62.94.130] by web31605.mail.mud.yahoo.com via HTTP; Thu, 07 Aug 2008 05:15:46 PDT X-Mailer: YahooMailRC/1042.48 YahooMailWebService/0.7.218 Date: Thu, 7 Aug 2008 05:15:46 -0700 (PDT) From: Viswesh S To: The development of GRUB 2 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-451962081-1218111346=:33456" Message-ID: <276306.33456.qm@web31605.mail.mud.yahoo.com> X-detected-kernel: by monty-python.gnu.org: FreeBSD 6.x (1) Subject: Re: [PATCH] Drivemap module 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: Thu, 07 Aug 2008 12:15:49 -0000 --0-451962081-1218111346=:33456 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable =0A=0A=0A=0AFrom: Javier Mart=C3=ADn =0ATo: The devel= opment of GRUB 2 =0ASent: Wednesday, 6 August, 2008 11:= 01:19 PM=0ASubject: Re: [PATCH] Drivemap module=0A=0AEl mi=C3=A9, 06-08-200= 8 a las 07:43 -0700, Viswesh S escribi=C3=B3:=0A> Hi,=0A> =0A>=C2=A0 =0A> = =0A> Could you let all know how to use your drivemap command.Is it similar= =0A> to the map command in legacy grub.=0A=0AHi there. Information about th= e use of a command is better placed in the=0Awiki than in this list, howeve= r this command is not merged in yet, and I=0Areckon its "help" feature coul= d be quite better.=0A=0ACurrently, the "safe" GRUB2 commands for booting fr= om (hd1,1) is:=0A=0Adrivemap (hd0) (hd1)=0Adrivemap (hd1) (hd0)=0Aset root= =3D(hd0)=0Achainloader (hd1,1)+1=0Aboot=0A=0AMaybe an explanation of what "= drivemap" does would put a bit of light=0Ahere:=0A=0A=C2=A0=C2=A0=C2=A0 * T= he BIOS hard disks are numbered from 0 to 128 (actually from 0x80 to=0A0xFF= because the lower numbers are reserved for floppy disks). These=0Anumbers = are used to select the target drive when issuing I/O requests=0Athrough the= BIOS routines (INT 13h)=0A=C2=A0=C2=A0=C2=A0 * When the BIOS loads a boot = sector and transfers control to it, the DL=0Aregister contains the "boot di= sk number", i.e. the disk from which the=0Abootsector was loaded. This allo= ws the bootsector to load its OS from=0Athe same disk it was run, instead o= f having to probe every single disk=0Ain the system.=0A=C2=A0=C2=A0=C2=A0 *= The "chainloader" command works like the BIOS: it loads a bootsector=0Aint= o memory and jumps to it. In this case, the value in DL corresponds=0Ato th= e disk that was set as "root drive" to GRUB. If no root drive is=0Aset, the= OS receives 0xFF, which should be recognized as an impossible=0Adrive. Som= e OSes will just trust this and fail (i.e. FreeDOS) while=0Aothers will try= to boot from the first hard disk (0x80).=0A=C2=A0=C2=A0=C2=A0 * The "drive= map" command acts as the old TSRs from the DOS times: when=0Athe "boot" com= mand is issued, it installs its own handler for INT 13h=0Arequests, which p= erforms the requested mappings and then call the old=0A(usually BIOS) handl= er with the changed parameters. Thus, an OS=0Aaccessing the drive through t= he BIOS routines will see the drives moved,=0Aduplicated or whatever the ma= ppings provided. Again: drivemap does NOT=0Amodify the "live" drive mapping= s within GRUB; its changes only affect=0Athe booted OS.=0A=0AThe strange ro= ot=3D(hd0) line that appears to contradict the chainloader=0Aline is there = because drivemap has no communication with the particular=0Aloader. If you = set root to (hd1,1) and then issue chainloader and boot,=0Athe OS will rece= ive 0x81 in DL because hd1 was the second hard drive=0Awhen chainloader was= issued (remember that drivemap doesn't act until=0A"boot"). Thus, the targ= et OS will try to boot from what _it_ sees as the=0Asecond hard disk, which= will now be the old hd0 - wrong.=0A=0AIf the target OS does not need to ac= cess the old hd0 or it only uses the=0ABIOS routines for the boot process (= i.e. it later uses ATA drivers and=0Awill redetect everything from scratch)= , you can leave the second=0Adrivemap line out and use a more compact scrip= t like this:=0A=0Adrivemap (hd0) (hd1)=0Aset root=3D(hd1,1)=0Achainloader += 1=0Aboot=0A=0AThis will work on Windows, because no matter where it tries t= o boot from=0Ait will find the same disk: both the first and second BIOS di= sks point=0Ato hd1 now. However, if you use a DOS-like system which uses th= e BIOS=0Aroutines exclusively (i.e. FreeDOS) then your hd0 disk would have= =0Adisappeared to it and you'd have D: to be a mirror of C:. In order to=0A= have hd0 as D:, hd1 as C: and everything working, you need the first=0Ascri= pt I posted, which makes the complete swap and then makes FreeDOS=0Aload fr= om the "first" hard drive (i.e. hd1). This is the setup I have=0Aextensivel= y tested in QEMU, while the Windows boot has been tested in=0Aboth QEMU (wi= th ReactOS) and some random computers including mine (with=0AWindows XP Hom= e and Windows XP Pro x64).=0A=0AI'm looking forward to streamline the drive= map syntax, so that the two=0Adrivemap lines can be fused into one like "dr= ivemap --swap (hd0) (hd1)".=0AHowever, given that it's not a bug and that G= RUB is still in heavy=0Adevelopment (and thus syntax changes are acceptable= ), I'd prefer to have=0Athe patch integrated as it is - so we have the func= tionality - and then=0Amodify what's needed - so we have it pretty.=0A=0A-H= abbit=0A=0AHi,=0AI have tried the same and different combinations,but still= the machine is going for reset after I execute the boot command.=0AAs noth= ing gets displayed also,I am not sure where exactly this is going wrong als= o.=0AWhat all might be the details in which I might have to look on, if I h= ave to boot windows using grub2 only.=0AViswesh=0A=0A=0A Connect with = friends all over the world. Get Yahoo! India Messenger at http://in.messeng= er.yahoo.com/?wm=3Dn/ --0-451962081-1218111346=:33456 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

=0A

=0A
From: Javier Mart=C3=ADn <lordhabbit@gmail.c= om>
To: The development of GRUB 2 <grub-devel@gnu.org>
Sent:= Wednesday, 6 August, 2008 11:01:19 PM
Subject: Re: [PATCH] Drivemap mod= ule

El mi=C3=A9, 06-08-2008 a las 07:43 -0700, Viswesh S escribi=C3= =B3:
> Hi,
>
> 
>
> Could you let all= know how to use your drivemap command.Is it similar
> to the map com= mand in legacy grub.

Hi there. Information about the use of a comman= d is better placed in the
wiki than in this list, however this command i= s not merged in yet, and I
reckon its "help" feature could be quite bett= er.

Currently, the "safe" GRUB2 commands for booting from (hd1,1) is= :

drivemap (hd0) (hd1)
drivemap (hd1) (hd0)
set root=3D(hd0)chainloader (hd1,1)+1
boot

Maybe an explanation of what "drivem= ap" does would put a bit of light
here:

    * The BIOS hard disks are numbere= d from 0 to 128 (actually from 0x80 to
0xFF because the lower numbers ar= e reserved for floppy disks). These
numbers are used to select the targe= t drive when issuing I/O requests
through the BIOS routines (INT 13h)    * When the BIOS loads a boot sector and transfers contr= ol to it, the DL
register contains the "boot disk number", i.e. the disk= from which the
bootsector was loaded. This allows the bootsector to loa= d its OS from
the same disk it was run, instead of having to probe every= single disk
in the system.
    * The "chainloader" co= mmand works like the BIOS: it loads a bootsector
into memory and jumps t= o it. In this case, the value in DL corresponds
to the disk that was set= as "root drive" to GRUB. If no root drive is
set, the OS receives 0xFF,= which should be recognized as an impossible
drive. Some OSes will just trust this and fail (i.e. FreeDOS) while
others will try to b= oot from the first hard disk (0x80).
    * The "drivemap"= command acts as the old TSRs from the DOS times: when
the "boot" comman= d is issued, it installs its own handler for INT 13h
requests, which per= forms the requested mappings and then call the old
(usually BIOS) handle= r with the changed parameters. Thus, an OS
accessing the drive through t= he BIOS routines will see the drives moved,
duplicated or whatever the m= appings provided. Again: drivemap does NOT
modify the "live" drive mappi= ngs within GRUB; its changes only affect
the booted OS.

The stran= ge root=3D(hd0) line that appears to contradict the chainloader
line is = there because drivemap has no communication with the particular
loader. = If you set root to (hd1,1) and then issue chainloader and boot,
the OS w= ill receive 0x81 in DL because hd1 was the second hard drive
when chainloader was issued (remember that drivemap doesn't act until
"boot"= ). Thus, the target OS will try to boot from what _it_ sees as the
secon= d hard disk, which will now be the old hd0 - wrong.

If the target OS= does not need to access the old hd0 or it only uses the
BIOS routines f= or the boot process (i.e. it later uses ATA drivers and
will redetect ev= erything from scratch), you can leave the second
drivemap line out and u= se a more compact script like this:

drivemap (hd0) (hd1)
set root= =3D(hd1,1)
chainloader +1
boot

This will work on Windows, beca= use no matter where it tries to boot from
it will find the same disk: bo= th the first and second BIOS disks point
to hd1 now. However, if you use= a DOS-like system which uses the BIOS
routines exclusively (i.e. FreeDO= S) then your hd0 disk would have
disappeared to it and you'd have D: to = be a mirror of C:. In order to
have hd0 as D:, hd1 as C: and everything working, you need the first
script I posted, which makes the= complete swap and then makes FreeDOS
load from the "first" hard drive (= i.e. hd1). This is the setup I have
extensively tested in QEMU, while th= e Windows boot has been tested in
both QEMU (with ReactOS) and some rand= om computers including mine (with
Windows XP Home and Windows XP Pro x64= ).

I'm looking forward to streamline the drivemap syntax, so that th= e two
drivemap lines can be fused into one like "drivemap --swap (hd0) (= hd1)".
However, given that it's not a bug and that GRUB is still in heav= y
development (and thus syntax changes are acceptable), I'd prefer to ha= ve
the patch integrated as it is - so we have the functionality - and th= en
modify what's needed - so we have it pretty.

-Habbit
= =0A
Hi,
=0A
 
=0A
I have tried the same and differen= t combinations,but still the machine is going for reset after I execute the= boot command.
=0A
 
=0A
As nothing gets displayed also,I am not= sure where exactly this is going wrong also.
=0A
 
=0A
What all= might be the details in which I might have to look on, if I have to boot w= indows using grub2 only.
=0A
 
=0A
Viswesh

= =0A=0A=0A=0A
Unlimited freedom, unlimited s= torage. Get it now<= /html> --0-451962081-1218111346=:33456--