Windows,grub and grub2
Hi,
----- Original Message ----
Quoted 194 lines
From: Viswesh S <[email protected]>
To: The development of GRUB 2 <[email protected]>
Sent: Tuesday, 14 October, 2008 5:04:53 PM
Subject: Re: Windows,grub and grub2Hi,
----- Original Message ----
Quoted 5 lines
From: Bean
To: The development of GRUB 2
Sent: Monday, 29 September, 2008 4:20:57 PM
Subject: Re: Windows,grub and grub2Quoted 24 lines
Quoted 23 lines · Viswesh S
Hi,
----- Original Message ----
Quoted 18 lines
From: Bean
To: The development of GRUB 2
Sent: Tuesday, 23 September, 2008 7:20:49 PM
Subject: Re: Windows,grub and grub2Quoted 12 lines · Viswesh S
----- Original Message ----
Quoted 7 lines
From: Bean
To: The development of GRUB 2
Sent: Monday, 22 September, 2008 9:10:26 AM
Subject: Re: Windows,grub and grub2Quoted 1 line · Viswesh S
Below is the dump of screen output while chainloading the ntfsnew
file.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
***************************************
DI=CFF0 SI=07EE BP=1FF0 SP=1FE8 BX=0000 DX=0000 CX=0000 AX=0000 CS=0000 SS=0000 DS=0000 ES=0000 FG=0246 IP=7C57DI=7FF0 SI=07EE BP=1FF0 SP=7BF4 BX=55AA DX=0000 CX=0000 AX=0100
CX=07C0
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
DS=07C0 ES=0000 FG=0007 IP=0082
******************************************
Could you please let me know the way to disassemble the binary filewithout
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
any header.The way in which you decoded the boot record.
Also one more thing to let you know is that,
with the grub-1.96 ( without the chainloader patch of
disk->dev->read()Quoted 6 lines
) ,
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
with windows2003 in partition 1 and linux in partition 3, when we
chainload,
Quoted 1 line
Quoted 1 line
Quoted 1 line
if we look at the partition table passed to another bootloader ie
location
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
0x7be- we can see that it is junk, but the surprising point is that,in
Quoted 110 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
this case as I have mentioned in my first mail, windows boots up from grub2.So it is that the partition table is not required for the
chainloader
Quoted 45 lines
Quoted 45 lines
Quoted 33 lines
Quoted 24 lines
Quoted 1 line
thing and just the boot record is sufficient
Hi,
Oh, sorry for another long delay. I disassemble the file with ida, which is an amazing tool. I don't know if there is open source alternative, please let me know if you find one.
The output from ida is in masm format, I modify it a bit so that it can be compiled using nasm. Please note that nasm doesn't generate the same binary file as original one, but you can get an idea what it does.
From the output, the program fails at the second int 13 call, int 13/ah = 48h. Although I notice that DL=0, which is not supposed to happen. Perhaps you can add a
grub_printfingrub_chainloader_bootto show the value of boot drive:static
grub_err_tgrub_chainloader_boot(void)
{
grub_printf("boot_drive=%d\n",boot_drive);grub_chainloader_real_boot(boot_drive,boot_part_addr);Quoted 8 lines
/* Never reach here. */
returnGRUB_ERR_NONE;
}--
BeanQuoted 5 lines
Hi,
The value of boot drive is
0x80.This was the same value in
disk->drivealso.Hi,
Interesting, perhaps %dx is changed somewhere. Please try the following patch, it dumps the value of %dx just before jumping to the boot sector.
Quoted 6 lines
Quoted 2 lines
--
BeanThe patch works and now Windows is booting perfectly fine from Grub2.
I will go through the assembly and try to understand what modifications you
have done.So there is a problem in Grub2 code, which needs to be fixed ?
Quoted 2 lines
Till this point, I was chainloading grub from Grub2 and then chainloading
Windows2008 from it.
Quoted 2 lines
Thanks for the consistent help till this point and for the future also.
Hi,
That's strange, the patch doesn't do anything except output the value of dx:
/* set up to pass boot drive */
popl %edx
+ movl %edx, %edi/* ESI must point to a partition table entry */ popl %esi
call
prot_to_real
.code16(quoted diff) +6
-0+ + push %dx + call hex_out + push %di + call hex_out +ljmp $0, $GRUB_MEMORY_MACHINE_BOOT_LOADER_ADDR
(quoted diff) +25
-0+ +hex_out: + pushw %bp + movw %sp, %bp + pushaw + movb $0xE, %ah + movw $7, %bx + movw $4, %cx + movw 4(%bp), %dx +1: + rol $4, %dx + movb %dl, %al + andb $0xF, %al + cmpb $10, %al + jb 2f + subb $('0'-'A'+10), %al +2: + addb $'0', %al + int $0x10 + loop 1b + movb $' ', %al + int $0x10 + popaw + popw %bp + ret $2.code32
#include "
../loader.S"Quoted 12 lines
Perhaps you can try:
1, %edi is used as backup register in case %edx is changed by
prot_to_real, you can remove "movl %edx, %edi", "push %di", "callhex_out" and see if it still works.2, It's possible that the bug is position related, replace "push %dx", "call
hex_out" with equal number of nop and see what happens.Signature · 1 line
BeanWe can remove the patch completely, without putting nop also, but just comment out the following code
/*
xorl %eax, %eax
callEXT_C(grub_gate_a20)
*/
Quoted 7 lines
This is the only difference and when I comment out this, Windows boots up from Grub2.
Regards,
Viswesh
So is this a bug in grub2 ?
Can you people confirm this ?
Viswesh
Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/
I have been trying to get windows and OS X to boot on my Mac Book Pro (booting grub2 natively -- no chainloading) but have been unable to get it to boot chainloaded objects. I haven't really been able to troubleshoot it yet. I am using a CVS build, but it is about 5 weeks old now. I just haven't had a chance to troubleshoot this any further because I have been busy moving, so take this for what it is worth.
James
Quoted 243 lines · Viswesh S
Hi,
----- Original Message ----
Quoted 5 lines
From: Viswesh S <[email protected]>
To: The development of GRUB 2 <[email protected]>
Sent: Tuesday, 14 October, 2008 5:04:53 PM
Subject: Re: Windows,grub and grub2Quoted 34 lines
Hi,
----- Original Message ----
Quoted 29 lines
From: Bean
To: The development of GRUB 2
Sent: Monday, 29 September, 2008 4:20:57 PM
Subject: Re: Windows,grub and grub2Quoted 23 lines · Viswesh S
Hi,
----- Original Message ----
Quoted 18 lines
From: Bean
To: The development of GRUB 2
Sent: Tuesday, 23 September, 2008 7:20:49 PM
Subject: Re: Windows,grub and grub2Quoted 12 lines · Viswesh S
----- Original Message ----
Quoted 7 lines
From: Bean
To: The development of GRUB 2
Sent: Monday, 22 September, 2008 9:10:26 AM
Subject: Re: Windows,grub and grub2Quoted 1 line · Viswesh S
Below is the dump of screen output while chainloading the
ntfsnew
Quoted 10 lines
file.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
***************************************
DI=CFF0 SI=07EE BP=1FF0 SP=1FE8 BX=0000 DX=0000 CX=0000 AX=0000 CS=0000 SS=0000 DS=0000 ES=0000 FG=0246 IP=7C57DI=7FF0 SI=07EE BP=1FF0 SP=7BF4 BX=55AA DX=0000 CX=0000 AX=0100
CX=07C0
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
DS=07C0 ES=0000 FG=0007 IP=0082
******************************************
Could you please let me know the way to disassemble the binaryfile
Quoted 9 lines
Quoted 6 lines
without
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
any header.The way in which you decoded the boot record.
Also one more thing to let you know is that,
with the grub-1.96 ( without the chainloader patch of
disk->dev->read()Quoted 2 lines
) ,
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
with windows2003 in partition 1 and linux in partition 3, when
we
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
chainload,
Quoted 1 line
Quoted 1 line
Quoted 1 line
if we look at the partition table passed to another bootloader
ie
Quoted 2 lines
Quoted 2 lines
location
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
0x7be- we can see that it is junk, but the surprising point isthat,
Quoted 2 lines
in
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
this case as I have mentioned in my first mail, windows boots
up from
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
grub2.So it is that the partition table is not required for the
chainloader
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
thing and just the boot record is sufficient
Hi,
Oh, sorry for another long delay. I disassemble the file with
ida,
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
which is an amazing tool. I don't know if there is open source alternative, please let me know if you find one.
The output from ida is in masm format, I modify it a bit so that
it
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
can be compiled using nasm. Please note that nasm doesn't
generate the
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
same binary file as original one, but you can get an idea what it does.
From the output, the program fails at the second int 13 call, int 13/ah = 48h. Although I notice that DL=0, which is not supposed
to
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
happen. Perhaps you can add a
grub_printfin
grub_chainloader_boottoQuoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 8 lines
show the value of boot drive:
static
grub_err_tgrub_chainloader_boot(void)
{
grub_printf("boot_drive=%d\n",boot_drive);grub_chainloader_real_boot(boot_drive,boot_part_addr);Quoted 8 lines
/* Never reach here. */
returnGRUB_ERR_NONE;
}--
BeanHi,
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
The value of boot drive is
0x80.This was the same value in
disk->drivealso.Hi,
Interesting, perhaps %dx is changed somewhere. Please try the following patch, it dumps the value of %dx just before jumping to
the
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
boot sector.
--
BeanThe patch works and now Windows is booting perfectly fine from Grub2.
I will go through the assembly and try to understand what
modifications you
Quoted 1 line
Quoted 1 line
have done.So there is a problem in Grub2 code, which needs to be fixed
?
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Till this point, I was chainloading grub from Grub2 and then
chainloading
Quoted 3 lines
Quoted 3 lines
Windows2008 from it.
Quoted 2 lines
Thanks for the consistent help till this point and for the future
also.
Quoted 4 lines
Quoted 4 lines
Hi,
That's strange, the patch doesn't do anything except output the value
of dx:
Quoted 52 lines
Quoted 52 lines
/* set up to pass boot drive */ popl %edx(quoted diff) +32
-0+ movl %edx, %edi /* ESI must point to a partition table entry */ popl %esi call prot_to_real .code16 + + push %dx + call hex_out + push %di + call hex_out + ljmp $0, $GRUB_MEMORY_MACHINE_BOOT_LOADER_ADDR + +hex_out: + pushw %bp + movw %sp, %bp + pushaw + movb $0xE, %ah + movw $7, %bx + movw $4, %cx + movw 4(%bp), %dx +1: + rol $4, %dx + movb %dl, %al + andb $0xF, %al + cmpb $10, %al + jb 2f + subb $('0'-'A'+10), %al +2: + addb $'0', %al + int $0x10 + loop 1b + movb $' ', %al + int $0x10 + popaw + popw %bp + ret $2 .code32#include "
../loader.S"Perhaps you can try:
1, %edi is used as backup register in case %edx is changed by
prot_to_real, you can remove "movl %edx, %edi", "push %di", "callhex_out" and see if it still works.Quoted 8 lines
Quoted 6 lines
2, It's possible that the bug is position related, replace "push %dx", "call
hex_out" with equal number of nop and see what happens.--
BeanWe can remove the patch completely, without putting nop also, but just
comment
Quoted 8 lines
out the following code
/*
xorl %eax, %eax
callEXT_C(grub_gate_a20)
*/This is the only difference and when I comment out this, Windows boots up
from
Quoted 6 lines
Grub2.
Regards,
VisweshSo is this a bug in grub2 ?
Can you people confirm this ?
Viswesh
Add more friends to your messenger and enjoy! Go to
http://messenger.yahoo.com/invite/_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel