Jump to content











Photo
- - - - -

Boot to Windows XP from Grub4dos


  • Please log in to reply
6 replies to this topic

#1 theonlylawislove

theonlylawislove
  • Members
  • 5 posts
  •  
    United States

Posted 01 August 2013 - 06:37 PM

I have a system that boots to windows xp fine.
 
I have a thumbdrive with GRUBFORDOS that I am attempting to boot to the windows xp partition (hd0,0).
 
Here is my menu.lst file on my thumbdrive.
 
timeout 20
default 0


title WINDOWS XP
root (hd0,0)
chainloader /ntldr


title CommandLine
commandline


title Reboot
reboot


title Halt
halt
 
When WINDOWS XP boots, I get an error (in french I think).
 
 
NOTE: I don't get this error at all when booting from the drive that the XP installation is on (using Windows bootloader I assume).
 
How do I get my menu.lst file to support booting this Windows XP installation?


#2 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 01 August 2013 - 07:10 PM

You are likely having an issue with disk (device enumeration).
When you boot normally your internal hard disk is FIRST (and possibly only) Disk, i.e., in grub4dos notation, (hd0).
The Windows (the folder \Windows\System32\) is most likely - like NTLDR is - on it's first partition, hence (hd0,0).
Everything works, and in the BOOT.INI you have a line similar to:
 
 



multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect

whcich means, on ARCPATH notation:
the "Windows":
\WINDOWS
that resides on first partition:
partition(1)
of first disk:
rdisk(0)
(the multi(0)disk(0) is irrelevant).
 
When you boot from the USB stick the BIOS enumerates the stick as FIRST device, i.e. the devices become:

  • (hd0) the USB stick
  • (hd1) the internal disk

In ARCPATH syntax, the (hd1) is multi(0)disk(0)rdisk(1)partition(1) but your BOOT.INI entry has multi(0)disk(0)rdisk(0)partition(1), thus it attempts to find \Windows\System32\ (and the HAL) on the USB stick, and since it is not there it throws an error.
 
Solution:
exchange device order in grub4dos, i.e. try on command line:
 
 



map (hd0) (hd1)
map (hd1) (hd0)
map --hook
root (hd0,0)
chainloader /ntldr
boot

:cheers:
Wonko



#3 halikus

halikus

    Frequent Member

  • Advanced user
  • 110 posts
  •  
    Canada

Posted 12 August 2013 - 04:31 PM

This should scan all drives for ntldr and boot it if it helps.

iftitle [find --set-root --devices=h /NTLDR && call set ntldr=%@root^%] %ntldr% NTLDR of Windows NT/2K/XP\n    Boot NTLDR of Windows NT/2K/XP\n    %ntldr%
#find --set-root --ignore-floppies --ignore-cd /ntldr
map () %ntldr%
map %ntldr% ()
map --rehook
find --set-root --ignore-floppies --ignore-cd %ntldr%/ntldr
chainloader %ntldr%/ntldr


#4 Zoso

Zoso

    Silver Member

  • Advanced user
  • 640 posts
  •  
    Isle of Man

Posted 12 August 2013 - 11:18 PM


This should scan all drives for ntldr and boot it if it helps.

iftitle [find --set-root --devices=h /NTLDR && call set ntldr=%@root^%] %ntldr% NTLDR of Windows NT/2K/XP\n    Boot NTLDR of Windows NT/2K/XP\n    %ntldr%#find --set-root --ignore-floppies --ignore-cd /ntldrmap () %ntldr%map %ntldr% ()map --rehookfind --set-root --ignore-floppies --ignore-cd %ntldr%/ntldrchainloader %ntldr%/ntldr

hi halikus, that would be very handy! what happens when more than one ntldr is present when using this? thanks

#5 halikus

halikus

    Frequent Member

  • Advanced user
  • 110 posts
  •  
    Canada

Posted 13 August 2013 - 01:32 AM

Much like the embedded grldr, it just scans the root of all drives until it finds the file, and then tries to boot it\shows a menu entry.  There are more complicated ways to populate all instances of ntldr, but who has more than 1 instance of Win XP these day?  1 is pushing it :)

 

I adapted it from the following for bootmgr, so if it doesn't work, its because i missed something simple.  I will add this.  /bootmgr is useless without \boot\bcd, so for error checking in anything bootmgr related on HDDs, i add a check for both files.  I know ntldr used to be a thorn in my side as it was a common file in the root of various things for a long time, and the wrong drive would often get flagged if i had another ntldr in the root of another drive.  So it doesn't get picked up as a win install cd or etc, i would put a check in for /ntldr and /windows/explorer.exe or something.

iftitle [find --set-root --devices=h /bootmgr && call set bootmgr=%@root^%] Boot BOOTMGR of Windows VISTA/WIN7/WIN2008 on %bootmgr%\n    Boot BOOTMGR of Windows VISTA/WIN7/WIN2008 on %bootmgr%    
chainloader %bootmgr%/bootmgr


#6 Zoso

Zoso

    Silver Member

  • Advanced user
  • 640 posts
  •  
    Isle of Man

Posted 13 August 2013 - 05:39 AM

I just happen to have five different versions of XP (including POS2009 and x64) on the same drive and only one of them is in a primary partition. I hardly use seven, I dont like it but I still have three versions available on the same drive as the five XPs.


Im trying to see how I could use your entries in my complicated usb hdd set-up or if it is even useful in this case because I have entries for these already but it would be nice to have only one extra that would find an XP on a systems internal hdd that I booted from usb that has five on it already. sorry if that doesnt make sense.. Im just curious more than anything. grub4dos is awesome! thanks

#7 halikus

halikus

    Frequent Member

  • Advanced user
  • 110 posts
  •  
    Canada

Posted 13 August 2013 - 05:54 AM

Hmmm, maybe try this if complicated is ok.

 

Run this in menu.lst or beginning of setup as a g4b

!BAT
#DetHDD.g4b
set n=1
set skip=0
find --devices=h > (md)0x20A+6
call :loop
clear
set dev
goto :EOF

:loop
debug off
cat --locate=\x0a --number=1 --skip=%skip% (md)0x20A+6 || exit
set /a length=%?%-%skip%
cat --skip=%skip% --length=%length% (md)0x20A+6 | set dev%n%=
set /a skip=%length%+%skip%+1

set /a n=%n%+1

goto :loop

This will find all hard drives and give them a variable of %dev1% %dev2% %dev3% , etc.

 

Then, you can optionally run something like this as a g4b to search all the hdds found for ntldr, or whatever else you want.  Repeat %dev1% to %dev9%

!BAT
if "%dev1%"=="" &&  goto :eof
if not "%dev1%"=="" &&  ls %dev1%/_ISO/ > nul && set isodir1=(/_ISO)
if not "%dev1%"=="" &&  ls %dev1%/sources/ > nul && set sources1=(/sources)
if not "%dev1%"=="" && if exist %dev1%/bootmgr  &&  if exist %dev1%/boot/BCD && set winmgr1=(/bootmgr)
if not "%dev1%"=="" && if exist %dev1%/ntldr && set winldr1=(/ntldr)
if not "%dev1%"=="" && if exist %dev1%/Windows/explorer.exe && set windir1=(Windows)
if not "%dev1%"=="" && if exist %dev1%/boot/grub/menu.lst && set grldr1=(Grub)
if not "%dev1%"=="" && if exist %dev1%/boot/grub/g2ldr && set g2ldr1=(Grub2)
if not "%dev1%"=="" && if exist %dev1%/casper/vmlinuz && if exist %dev1%/casper/initrd.lz  && set casper1=(Ubuntu)

if "%dev2%"=="" &&  goto :eof
if not "%dev2%"=="" && if exist %dev2%/ntldr && set winldr2=(/ntldr)

3

4 etc

....and then use a menu.lst with this (2nd g4b not needed)

 

iftitle [if exist %dev1%/ntldr]  Boot XP  /ntldr from %dev1%\n    Boot XP\n    %dev1%  /ntldr
root %dev1%
chainloader %dev1%/ntldr

 

iftitle [if exist %dev2%/ntldr]  Boot XP  /ntldr from %dev2%\n    Boot XP\n    %dev2%  /ntldr
root %dev2%
chainloader %dev2%/ntldr

 

etc to dev9

 

Its maybe not the best solution, but it will work.  I use it to display all the goodies on a drive with a menu entry like this

 

iftitle [if not "%dev1%"=="" && if exist %dev1%/bootmgr  &&  if exist %dev1%/boot/BCD] %dev1% Boot Windows Vista\\7\\8\n    %dev1%  Boot Windows Vista\\7\\8\n    %dev1%/bootmgr
root %dev1%
chainloader %dev1%/bootmgr

 

or this (2nd g4b needed)

 

iftitle [if not "%dev1%"==""]  ****  %dev1%  %isodir1%%casper1%%sources1%%winmgr1%%winldr1%%windir1%%grldr1%%g2ldr1%  ****\n    %dev1%  %isodir1%%sources1%%winmgr1%%windir1%%syslinux1%%grldr1%%g2ldr1%%casper1%
set hdd=%dev1%
set FCOUNTED=
/%grub%/Countfiles.g4b
configfile /%grub%/menu2HDD.lst


Edited by halikus, 13 August 2013 - 06:01 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users