Jump to content











Photo
- - - - -

How to boot directly into Windows from kexec+Grub4DOS


  • Please log in to reply
6 replies to this topic

#1 shuss

shuss
  • Members
  • 3 posts
  •  
    India

Posted 25 February 2009 - 07:23 AM

Hi,

Suppose Windows is installed in the first partition of the first disk (hd0,0), how can I boot into it directly using kexec in Linux?

I did this:
# kexec -l grub.exe --command-line "root(hd0,0); chainloader (hd0,0)+1; boot"
# kexec -e

This takes me to the Grub4DOS menu. So, kexec is working, but apparently the command line arguments I'm passing to grub.exe are not doing the job right. What am I doing wrong here? Please help!

I see examples in the Grub4DOS manual that explain how to use an image file, but I just want to boot off the hard disk where Windows XP is installed.

TIA.

#2 tinybit

tinybit

    Gold Member

  • Developer
  • 1117 posts
  •  
    China

Posted 25 February 2009 - 07:42 AM

# kexec -l grub.exe --command-line "root(hd0,0); chainloader (hd0,0)+1; boot"
# kexec -e


try this
kexec -l grub.exe --command-line="--config-file=chainloader (hd0,0)+1;rootnoverify (hd0);boot"

kexec -e


#3 shuss

shuss
  • Members
  • 3 posts
  •  
    India

Posted 25 February 2009 - 08:43 AM

Hi,

Its working now. Can you please tell me the reason why "rootnoverify" is used here instead of "root". And I always thought root/rootnoverify needed to come before other commands like kernel/initrd/chainloader. Why doesn't the order matter here.

Thanks again!

#4 tinybit

tinybit

    Gold Member

  • Developer
  • 1117 posts
  •  
    China

Posted 25 February 2009 - 09:33 AM

Hi,

Its working now. Can you please tell me the reason why "rootnoverify" is used here instead of "root". And I always thought root/rootnoverify needed to come before other commands like kernel/initrd/chainloader. Why doesn't the order matter here.

Thanks again!


rootnoverify (hd0) here only changes the root-drive number to hex 80, which is the first BIOS harddrive number. The subsequent boot command will assign the root-drive number to the DL register, and pass control to the boot sector.

Note that Microsoft's boot sector alway uses hard coded hex 80 as boot drive number, so the rootnoverify (hd0) can be omitted.

And the ending boot command here can also be omitted. So you can write it as follows:
kexec -l grub.exe --command-line="--config-file=chainloader (hd0,0)+1"

kexec -e

Since you have used the (hd0,0) prefix to "+1" in the chainloader command, you does not have to use an additional root (hd0,0) command before the chainloader command.

#5 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7100 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 25 February 2009 - 10:26 AM

Can you please tell me the reason why "rootnoverify" is used here instead of "root". And I always thought root/rootnoverify needed to come before other commands like kernel/initrd/chainloader. Why doesn't the order matter here.


To clear this aspect, there is no need to put a root or rootnoverify BEFORE the chainloader command, as long as you use "absolute" paths/devices.

Think at the sequence of grub4dos commands as setting a number of variables.

An example:
title some image

map (hd0,0)/images/an_image.ima (fd0)

map --hook

chainloader (fd0)/io.sys

rootnoverify (fd0)

boot

Please note that the final boot command is implied when the sequence is inside a .lst or "configfile" and needed explicitly in command line mode.

The above could be written in a pseudo batch language as:
SET Variable_fd0=(hd0,0)/images/an_image.ima

SET Variable_to_be_chainloaded=(fd0)/io.sys

SET Variable_ROOT=(fd0)

CALL BOOT %Variable_fd0%%Variable_ROOT% %Variable_to_be_chainloaded%

It is irrelevant whether the "Variable_ROOT" is "set" before or after the "Variable_to_be_chainloaded", while it is VITAL that "Variable_fd0" is set before the other two as otherwise the latter may be invalid.

Now consider the same entry above rewritten:
title some image

map (hd0,0)/images/an_image.ima (fd0)

map --hook

rootnoverify (fd0)

chainloader /io.sys

boot

Since chainloader uses a "relative" path, the rootnoverify MUST come before the chainloader.

Another example, this:

title (hd0,0)

chainloader (hd0,0)+1

root (hd0,0)

boot
and this:
title (hd0,0)

root (hd0,0)

chainloader (hd0,0)+1

boot

Are exchangeable, but this needs this order:
title (hd0,0)

root (hd0,0)

chainloader +1

boot

When you use "dynamic" or "implied" paths/devices, the root must come before other commands.

A final example:
title (hd0,0)

find --set-root /tag_file_on_hd_0_0.tag

chainloader +1

boot


Hope the above clears the matter. :cheers:

jaclaz

#6 mr_

mr_

    Frequent Member

  • Members
  • 355 posts
  •  
    Germany

Posted 25 February 2009 - 01:01 PM

Hi,

Its working now.

Please tell me which grub4dos version and Linux/Distro you where using.

#7 shuss

shuss
  • Members
  • 3 posts
  •  
    India

Posted 26 February 2009 - 04:48 AM

Grub4DOS 0.4.2 and ASTLinux.

Regards




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users