Jump to content











Photo
* * * * * 1 votes

Grub4dos Find and boot


  • Please log in to reply
113 replies to this topic

#1 DarkPhoeniX

DarkPhoeniX

    Frequent Member

  • Team Reboot
  • 452 posts
  • Location:In the middle of nowhere
  • Interests:Interesting Things
  •  
    South Africa

Posted 21 July 2012 - 02:49 AM

I found A few scripts and modified some like this:
#Boot From HardDrive Menu



#splashimage /boot/face.gz

timeout 30

default 0



title Previous Menu

configfile /menu.lst



title     

root ()



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

chainloader %bootmgr%/bootmgr



#title Boot NTLDR of Windows NT/2K/XP

iftitle [find --set-root --devices=h /NTLDR && call set bootmgr=%@root^%] Boot NTLDR of Windows NT/2K/XP on %bootmgr%

#find --set-root --ignore-floppies --ignore-cd /ntldr

map () %bootmgr%

map %bootmgr% ()

map --rehook

find --set-root --ignore-floppies --ignore-cd /ntldr

chainloader /ntldr



#title Boot The Recovery Console of Windows NT/2K/XP

iftitle [find --set-root --devices=h /cmldr && call set bootmgr=%@root^%] Boot The Recovery Console (cmldr) of Windows NT/2K/XP on %bootmgr%

fallback 3

find --set-root --ignore-floppies --ignore-cd /cmldr

map () %bootmgr%

map %bootmgr% ()

map --rehook

find --set-root --ignore-floppies --ignore-cd /cmldr

chainloader /cmldr

#####################################################################

# write string "cmdcons" to memory 0000:7C03 in 2 steps:

#####################################################################

# step 1. Write 4 chars "cmdc" at 0000:7C03

#write 0x7C03 0x63646D63

# step 2. Write 3 chars "ons" and an ending null at 0000:7C07

#write 0x7C07 0x00736E6F

#    or.

#write --offset=3 (md)0x3e+1 cmdcons

#    or

calc *0x7c03=0x00736E6F63646D63



#title Boot IO.SYS of Windows 9x/Me

iftitle [find --set-root --devices=h /IO.SYS && call set bootmgr=%@root^%] Boot IO.SYS of Windows 9x/Me on %bootmgr%

find --set-root %bootmgr%/io.sys

chainloader %bootmgr%/io.sys



#title Boot Linux with menu.lst already installed

iftitle [find --set-root --devices=h /menu.lst && call set bootmgr=%@root^%] Boot Linux with menu.lst already installed on %bootmgr%

find --set-root %bootmgr%/sbin/init

configfile %bootmgr%/boot/grub/menu.lst

 

title Boot Floppy (fd0)

chainloader (fd0)+1

rootnoverify (fd0)



title     

root ()



title Reboot

reboot

 

title Shutdown

halt
I dont know if it will work,since i dont know a lot about GRUB4DOS
Since on some laptops their are more then one BOOTMGR (Recovery programs)
I fear that this scipt will only find one at a time
How do i find all ?
must i use something like this:

iftitle [if exist (hd0,0)/test.img] boot to (hd0,0)/test.img

    map --mem (hd0,0)/test.img (fd0)

    map --hook

    chainloader (fd0)+1

Or is thare a script that will show all the bootabe drives without hard coding every drive and partition (hd0.0)(hd0.1)(hd1.0)ect

#2 DarkPhoeniX

DarkPhoeniX

    Frequent Member

  • Team Reboot
  • 452 posts
  • Location:In the middle of nowhere
  • Interests:Interesting Things
  •  
    South Africa

Posted 21 July 2012 - 02:55 AM

Looks like my internet is up to ******
Admin please delete other posts!! :cold:

Fixed it my self :loleverybody:

#3 SIW2

SIW2

    Frequent Member

  • Advanced user
  • 123 posts

Posted 21 July 2012 - 03:44 AM

Care to let everyone know what you did?

#4 DarkPhoeniX

DarkPhoeniX

    Frequent Member

  • Team Reboot
  • 452 posts
  • Location:In the middle of nowhere
  • Interests:Interesting Things
  •  
    South Africa

Posted 21 July 2012 - 03:59 AM

Care to let everyone know what you did?

Multi-post about 4 times SORY
But i deleted the topics
now about my post....can you help

#5 SIW2

SIW2

    Frequent Member

  • Advanced user
  • 123 posts

Posted 21 July 2012 - 04:11 AM

What method are you using to do this:

show all the bootabe drives without hard coding every drive and partition (hd0.0)(hd0.1)(hd1.0)ect



#6 DarkPhoeniX

DarkPhoeniX

    Frequent Member

  • Team Reboot
  • 452 posts
  • Location:In the middle of nowhere
  • Interests:Interesting Things
  •  
    South Africa

Posted 21 July 2012 - 04:22 AM

something like:

iftitle [if exist (hd0,0)/test.img] boot to (hd0,0)/test.img

    map --mem (hd0,0)/test.img (fd0)

    map --hook

    chainloader (fd0)+1



iftitle [if exist (hd0,1)/test.img] boot to (hd0,1)/test.img

    map --mem (hd0,1)/test.img (fd0)

    map --hook

    chainloader (fd0)+1



#7 DarkPhoeniX

DarkPhoeniX

    Frequent Member

  • Team Reboot
  • 452 posts
  • Location:In the middle of nowhere
  • Interests:Interesting Things
  •  
    South Africa

Posted 15 August 2012 - 07:36 PM

Working some more i came up with this to boot bootmgr:

iftitle [if exist (hd0,0)/bootmgr] Boot to Windows VISTA/7/8 on (hd0,0)

chainloader (hd0,0)/bootmgr

iftitle [if exist (hd0,1)/bootmgr] Boot to Windows VISTA/7/8 on (hd0,1)

chainloader (hd0,1)/bootmgr

iftitle [if exist (hd0,2)/bootmgr] Boot to Windows VISTA/7/8 on (hd0,2)

chainloader (hd0,2)/bootmgr

iftitle [if exist (hd0,3)/bootmgr] Boot to Windows VISTA/7/8 on (hd0,3)

chainloader (hd0,3)/bootmgr

iftitle [if exist (hd0,4)/bootmgr] Boot to Windows VISTA/7/8 on (hd0,4)

chainloader (hd0,4)/bootmgr



iftitle [if exist (hd1,0)/bootmgr] Boot to Windows VISTA/7/8 on (hd1,0)

chainloader (hd1,0)/bootmgr

iftitle [if exist (hd1,1)/bootmgr] Boot to Windows VISTA/7/8 on (hd1,1)

chainloader (hd1,1)/bootmgr

iftitle [if exist (hd1,2)/bootmgr] Boot to Windows VISTA/7/8 on (hd1,2)

chainloader (hd1,2)/bootmgr

iftitle [if exist (hd1,3)/bootmgr] Boot to Windows VISTA/7/8 on (hd1,3)

chainloader (hd1,3)/bootmgr

iftitle [if exist (hd1,4)/bootmgr] Boot to Windows VISTA/7/8 on (hd1,4)

chainloader (hd1,4)/bootmgr



iftitle [if exist (hd2,0)/bootmgr] Boot to Windows VISTA/7/8 on (hd2,0)

chainloader (hd2,0)/bootmgr

iftitle [if exist (hd2,1)/bootmgr] Boot to Windows VISTA/7/8 on (hd2,1)

chainloader (hd2,1)/bootmgr

iftitle [if exist (hd2,2)/bootmgr] Boot to Windows VISTA/7/8 on (hd2,2)

chainloader (hd2,2)/bootmgr

iftitle [if exist (hd2,3)/bootmgr] Boot to Windows VISTA/7/8 on (hd2,3)

chainloader (hd2,3)/bootmgr

iftitle [if exist (hd2,4)/bootmgr] Boot to Windows VISTA/7/8 on (hd2,4)

chainloader (hd2,4)/bootmgr



iftitle [if exist (hd3,0)/bootmgr] Boot to Windows VISTA/7/8 on (hd3,0)

chainloader (hd3,0)/bootmgr

iftitle [if exist (hd3,1)/bootmgr] Boot to Windows VISTA/7/8 on (hd3,1)

chainloader (hd0,1)/bootmgr

iftitle [if exist (hd3,2)/bootmgr] Boot to Windows VISTA/7/8 on (hd3,2)

chainloader (hd3,2)/bootmgr

iftitle [if exist (hd3,3)/bootmgr] Boot to Windows VISTA/7/8 on (hd3,3)

chainloader (hd3,3)/bootmgr

iftitle [if exist (hd3,4)/bootmgr] Boot to Windows VISTA/7/8 on (hd3,4)

chainloader (hd3,4)/bootmgr



iftitle [if exist (hd4,0)/bootmgr] Boot to Windows VISTA/7/8 on (hd4,0)

chainloader (hd4,0)/bootmgr

iftitle [if exist (hd4,1)/bootmgr] Boot to Windows VISTA/7/8 on (hd4,1)

chainloader (hd4,1)/bootmgr

iftitle [if exist (hd4,2)/bootmgr] Boot to Windows VISTA/7/8 on (hd4,2)

chainloader (hd0,2)/bootmgr

iftitle [if exist (hd4,3)/bootmgr] Boot to Windows VISTA/7/8 on (hd4,3)

chainloader (hd4,3)/bootmgr

iftitle [if exist (hd4,4)/bootmgr] Boot to Windows VISTA/7/8 on (hd4,4)

chainloader (hd4,4)/bootmgr


but this is slow....
Can you think of somthing faster
maby using
find --set-root

#8 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 15 August 2012 - 09:00 PM

iftitle [find --set-root /bootmgr] Boot to Windows VISTA/7/8 on first ptn that has bootmgr
find --set-root /bootmgr
chainloader
/bootmgr

#9 DarkPhoeniX

DarkPhoeniX

    Frequent Member

  • Team Reboot
  • 452 posts
  • Location:In the middle of nowhere
  • Interests:Interesting Things
  •  
    South Africa

Posted 15 August 2012 - 09:37 PM

iftitle [find --set-root /bootmgr] Boot to Windows VISTA/7/8 on first ptn that has bootmgr
find --set-root /bootmgr
chainloader
/bootmgr

I know how to do that
but wat if thare is more then one bootmgr on the system.
i want to grub4dos to find all bootmgr on all the hdd on all ptn and show them



Eg. of menu selections:
Boot to Windows VISTA/7/8 found on (hd0,0)

Boot to Windows VISTA/7/8 found on (hd1,2)


but it only shows the bootable drives

i tryd this but it dose not work:


find --set-root --ignore-floppies --ignore-cd /bootmgr

echo %@root% && set dev1=%@root% && set boot1=1



iftitle [if "%boot1%"=="1"] Boot to Windows VISTA/7/8 on %dev1%

chainloader %dev1%/bootmgr





find --set-root --ignore-floppies --ignore-cd --ignore-%dev1% /bootmgr

echo %@root% && set dev2=%@root% && set boot2=1



iftitle [if "%boot2%"=="1"] Boot to Windows VISTA/7/8 on %dev2%

chainloader %dev2%/bootmgr



find --set-root --ignore-floppies --ignore-cd --ignore-%dev1% --ignore-%dev2% /bootmgr

echo %@root% && set dev3=%@root% && set boot3=1



iftitle [if "%boot3%"=="1"] Boot to Windows VISTA/7/8 on %dev3%

chainloader %dev3%/bootmgr



if "--ignore-%dev1% " could work then you would see 3 bootable bootmgr's if thet are avalable

#10 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 16 August 2012 - 09:19 AM

Maybe you could do something with find which would be faster like...

#ensure debug messages turned on so find lists all partitions

debug on

find --ignore-floppies --ignore-cd /bootmgr > (md)0x220+1

debug off

cat --locate="(hd0,0)" (md)0x220+1 && set HD00=1

cat --locate="(hd0,1)" (md)0x220+1 && set HD01=1
etc.

then



# reload menu a 2nd time so variables are set

if "%RAN%"=="1" set RAN=1 || set RAN=1 && configfile /menu.lst



iftitle [if "%HD00%"=="1"] Boot to bootmgr from hd0,0

chainloader (hd0,0)/bootmgr



iftitle [if "%HD01%"=="1"] Boot to bootmgr from hd0,1

chainloader (hd0,1)/bootmgr

Note: make sure there are no spaces at the end of the && set HDxx=1 lines!

OR

just use cat in iftitle like this and no need for variables (but memory at (md)0x220 must not be used by any other menu command.)

iftitle [cat --locate="(hd0,0)" (md)0x220+1] BOOTMGR on HD0,0

chainloader (hd0,0)/bootmgr

  • DarkPhoeniX likes this

#11 DarkPhoeniX

DarkPhoeniX

    Frequent Member

  • Team Reboot
  • 452 posts
  • Location:In the middle of nowhere
  • Interests:Interesting Things
  •  
    South Africa

Posted 18 August 2012 - 04:11 PM

After some more work i came up with :


#FileName: mboot.lst

#ensure debug messages turned on so find lists all partitions

echo Searching For Bootable Devices

debug -1

timeout 5

default 0

debug on

#ntldr finder

find --ignore-floppies --ignore-cd /ntldr && set ntfound=1

#bootmgr finder

find --ignore-floppies /bootmgr && set mgrfound=1

#find --ignore-floppies --ignore-cd /bootmgr && set mgrfound=1

#bootmgr io.sys

find --ignore-floppies /bootmgr && set iofound=1



debug off

# reload menu a 2nd time so variables are set

if "%loadm%"=="1" set loadm=1 || set loadm=1 && configfile /mboot.lst

#goto lst

if "%ntfound%"=="1" && configfile /nt.lst

if "%mgrfound%"=="1" && configfile /mgr.lst

if "%iofound%"=="1" && configfile /io.lst

title Nothing Found Previous Menu

configfile /menu.lst

title Reboot

reboot



title Shutdown

halt



#FileName: nt.lst

echo Found NTLDR

debug -1

#ntldr finder

debug on

find --ignore-floppies --ignore-cd /ntldr > (md)0x220+1

debug off

#HD and PRT finder

cat --locate="(hd0,0)" (md)0x220+1 && set NTHD00=1

cat --locate="(hd0,1)" (md)0x220+1 && set NTHD01=1

cat --locate="(hd0,2)" (md)0x220+1 && set NTHD02=1

cat --locate="(hd0,3)" (md)0x220+1 && set NTHD03=1

cat --locate="(hd0,4)" (md)0x220+1 && set NTHD04=1

cat --locate="(hd1,0)" (md)0x220+1 && set NTHD10=1

cat --locate="(hd1,1)" (md)0x220+1 && set NTHD11=1

# reload menu a 2nd time so variables are set

if "%loadnt%"=="1" set loadnt=1 || set loadnt=1 && configfile /nt.lst

timeout 30

default 0

title Previous Menu

configfile /menu.lst

title

root ()



#ntldr title

iftitle [if "%NTHD00%"=="1"] Boot to ntldr from hd0,0

chainloader (hd0,0)/ntldr

iftitle [if "%NTHD01%"=="1"] Boot to ntldr from hd0,1

chainloader (hd0,1)/ntldr

iftitle [if "%NTHD02%"=="1"] Boot to ntldr from hd0,2

chainloader (hd0,2)/ntldr

iftitle [if "%NTHD03%"=="1"] Boot to ntldr from hd0,3

chainloader (hd0,3)/ntldr

iftitle [if "%NTHD04%"=="1"] Boot to ntldr from hd0,4

chainloader (hd0,4)/ntldr

iftitle [if "%NTHD10%"=="1"] Boot to ntldr from hd1,0

chainloader (hd1,0)/ntldr

iftitle [if "%NTHD11%"=="1"] Boot to ntldr from hd1,1

chainloader (hd1,1)/ntldr

#found bootmgr

iftitle [if "%mgrfound%"=="1"] Found BOOTMGR

configfile /mgr.lst

#found io.sys

iftitle [if "%iofound%"=="1"] Found io.sys

configfile /mgr.lst

title

root ()

title Previous Menu

configfile /menu.lst

title Reboot

reboot



title Shutdown

halt









#FileName: mgr.lst

echo Found BOOTMGR

debug -1

timeout 30

default 0



#bootmgr finder

debug on

find --ignore-floppies /bootmgr > (md)0x220+1

#find --ignore-floppies --ignore-cd /bootmgr > (md)0x220+1

debug off

#HD and PRT finder

cat --locate="(hd0,0)" (md)0x220+1 && set MGRHD00=1

cat --locate="(hd0,1)" (md)0x220+1 && set MGRHD01=1

cat --locate="(hd0,2)" (md)0x220+1 && set MGRHD02=1

cat --locate="(hd0,3)" (md)0x220+1 && set MGRHD03=1

cat --locate="(hd0,4)" (md)0x220+1 && set MGRHD04=1

cat --locate="(hd1,0)" (md)0x220+1 && set MGRHD10=1

cat --locate="(hd1,1)" (md)0x220+1 && set MGRHD11=1

cat --locate="(cd)" (md)0x220+1 && set MGRCD=1

# reload menu a 2nd time so variables are set

if "%loadmgr%"=="1" set loadmgr=1 || set loadmgr=1 && configfile /mgr.lst

#bootmgr title

iftitle [if "%MGRHD00%"=="1"] Boot to bootmgr from hd0,0

chainloader (hd0,0)/bootmgr

iftitle [if "%MGRHD01%"=="1"] Boot to bootmgr from hd0,1

chainloader (hd0,1)/bootmgr

iftitle [if "%MGRHD02%"=="1"] Boot to bootmgr from hd0,2

chainloader (hd0,2)/bootmgr

iftitle [if "%MGRHD03%"=="1"] Boot to bootmgr from hd0,3

chainloader (hd0,3)/bootmgr

iftitle [if "%MGRHD04%"=="1"] Boot to bootmgr from hd0,4

chainloader (hd0,4)/bootmgr

iftitle [if "%MGRHD10%"=="1"] Boot to bootmgr from hd1,0

chainloader (hd1,0)/bootmgr

iftitle [if "%MGRHD11%"=="1"] Boot to bootmgr from hd1,1

chainloader (hd1,1)/bootmgr

iftitle [if "%MGRCD%"=="1"] Boot to bootmgr from ODD

chainloader (CD)/bootmgr

#found io.sys

iftitle [if "%iofound%"=="1"] Found io.sys

configfile /mgr.lst

title

root ()

title Previous Menu

configfile /menu.lst

title Reboot

reboot



title Shutdown

halt









#FileName: io.lst

echo Found IO.SYS

debug -1

#io.sys finder

debug on

find --ignore-floppies --ignore-cd /io.sys > (md)0x220+1

debug off

#HD and PRT finder

cat --locate="(hd0,0)" (md)0x220+1 && set IOHD00=1

cat --locate="(hd0,1)" (md)0x220+1 && set IOHD01=1

cat --locate="(hd0,2)" (md)0x220+1 && set IOHD02=1

cat --locate="(hd0,3)" (md)0x220+1 && set IOHD03=1

cat --locate="(hd0,4)" (md)0x220+1 && set IOHD04=1

cat --locate="(hd1,0)" (md)0x220+1 && set IOHD10=1

cat --locate="(hd1,1)" (md)0x220+1 && set IOHD11=1

# reload menu a 2nd time so variables are set

if "%loadnt%"=="1" set loadnt=1 || set loadnt=1 && configfile /io.lst

timeout 30

default 0

#io.sys title

iftitle [if "%IOHD00%"=="1"] Boot to io.sys from hd0,0

chainloader (hd0,0)/io.sys

iftitle [if "%IOHD01%"=="1"] Boot to io.sys from hd0,1

chainloader (hd0,1)/io.sys

iftitle [if "%IOHD02%"=="1"] Boot to io.sys from hd0,2

chainloader (hd0,2)/io.sys

iftitle [if "%IOHD03%"=="1"] Boot to io.sys from hd0,3

chainloader (hd0,3)/io.sys

iftitle [if "%IOHD04%"=="1"] Boot to io.sys from hd0,4

chainloader (hd0,4)/io.sys

iftitle [if "%IOHD10%"=="1"] Boot to io.sys from hd1,0

chainloader (hd1,0)/io.sys

iftitle [if "%IOHD11%"=="1"] Boot to io.sys from hd1,1

chainloader (hd1,1)/io.sys

title

root ()

title Previous Menu

configfile /menu.lst

title Reboot

reboot



title Shutdown

halt






Id like to know if there are errors
And will "(md)0x220+1" used in different menu's give errors
And how do i get this to boot Linux ,android

moreover i tested it to boot XP ,Win 8 and Win 7,it works fast...
note: win 8 has 2 bootmgr's the one on (HD0.0) works the other one fails to boot on (hd0.1)
Thanx For The help!

#12 DarkPhoeniX

DarkPhoeniX

    Frequent Member

  • Team Reboot
  • 452 posts
  • Location:In the middle of nowhere
  • Interests:Interesting Things
  •  
    South Africa

Posted 19 August 2012 - 10:06 AM

IO.lst seems to cuse errors
XP has a IO.SYS

#13 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 23 August 2012 - 10:30 AM

Untested ...
iftitle [if "%IOHD00%"=="1" && if not exist (hd0,0)/ntldr] Boot to io.sys from hd0,0


#14 jc24

jc24

    Newbie

  • Members
  • 11 posts

Posted 22 April 2013 - 01:52 AM

I'm trying to apply a similar configuration without luck. From what i can tell either the HDxx variables are not being set or the configfile is not reloaded. I've stripped the menu.lst to the following for troubleshooting (grub4dos version 0.4.5c 2013-03-29):

 

 

debug on
find --ignore-floppies /bootmgr > (md)0x220+1
debug off

#--HD and PRT finder
cat --locate="(cd0)" (md)0x220+1 &; set CD0=1
cat --locate="(hd0,0)" (md)0x220+1 &; set HD00=1
cat --locate="(hd0,1)" (md)0x220+1 &; set HD01=1
cat --locate="(hd0,2)" (md)0x220+1 &; set HD02=1
cat --locate="(hd0,3)" (md)0x220+1 &; set HD03=1
cat --locate="(hd1,0)" (md)0x220+1 &; set HD10=1
cat --locate="(hd1,1)" (md)0x220+1 &; set HD11=1
cat --locate="(hd1,2)" (md)0x220+1 &; set HD12=1
cat --locate="(hd1,3)" (md)0x220+1 &; set HD13=1

# reload menu a 2nd time so variables are set
if "%RAN%"=="1" set RAN=1 || set RAN=1 && configfile /menu.lst

timeout 15
default 0

iftitle [if "%HD00%"=="1"] Boot to bootmgr from hd0,0
chainloader (hd0,0)/bootmgr

iftitle [if "%HD01%"=="1"] Boot to bootmgr from hd0,1
chainloader (hd0,1)/bootmgr

iftitle [if "%HD02%"=="1"] Boot to bootmgr from hd0,2
chainloader (hd0,2)/bootmgr

iftitle [if "%HD03%"=="1"] Boot to bootmgr from hd0,3
chainloader (hd0,3)/bootmgr

iftitle [if "%HD10%"=="1"] Boot to bootmgr from hd1,0
chainloader (hd1,0)/bootmgr

iftitle [if "%HD11%"=="1"] Boot to bootmgr from hd1,1
chainloader (hd1,1)/bootmgr

iftitle [if "%HD11%"=="1"] Boot to bootmgr from hd1,2
chainloader (hd1,2)/bootmgr

iftitle [if "%HD11%"=="1"] Boot to bootmgr from hd1,3
chainloader (hd1,3)/bootmgr

title Reboot

 

 

Thanks



#15 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 22 April 2013 - 08:01 AM

Use latest version 



#16 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 22 April 2013 - 08:12 AM

Try

 

 

debug 1
find --ignore-floppies /bootmgr > (md)0x220+1
debug off
cat (md)0x220+1

#--HD and PRT finder
cat --locate="(cd0)" (md)0x220+1 &; set CD0=1
cat --locate="(hd0,0)" (md)0x220+1 &; set HD=0,0
cat --locate="(hd0,1)" (md)0x220+1 &; set HD=0,1
cat --locate="(hd0,2)" (md)0x220+1 &; set HD=0,2
cat --locate="(hd0,3)" (md)0x220+1 &; set HD=0,3
cat --locate="(hd1,0)" (md)0x220+1 &; set HD=1,0
cat --locate="(hd1,1)" (md)0x220+1 &; set HD=1,1
cat --locate="(hd1,2)" (md)0x220+1 &; set HD=1,2
cat --locate="(hd1,3)" (md)0x220+1 &; set HD=1,3

# reload menu a 2nd time so variables are set
if not "%RAN%"=="1"  set RAN=1 && configfile /menu.lst

timeout 15
default 0

iftitle [if not "%HD%"=="" if exist (hd%HD%)/bootmgr] Boot to bootmgr from hd%HD%
chainloader (hd%HD%)/bootmgr

 

 


#17 jc24

jc24

    Newbie

  • Members
  • 11 posts

Posted 24 April 2013 - 12:46 AM

I've upgraded to 0.4.5c 2013-04-19 and tried the menu you posted but with the same result.

 

I'm not sure if it makes a difference but I'm using on a 16GB usb key with two partitions and grub4dos installed on the first partition.



#18 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 24 April 2013 - 12:48 AM

What if you replace the &; with && - does it work then?



#19 jc24

jc24

    Newbie

  • Members
  • 11 posts

Posted 24 April 2013 - 11:54 PM

Both &; and && gave the same results. However, I've tried the second option you pasted previously (which eliminates the variables) and that is working.

 

debug 1
find --ignore-floppies /bootmgr > (md)0x220+1
debug off
cat (md)0x220+1

# reload menu a 2nd time so variables are set
if not "%RAN%"=="1"  set RAN=1 && configfile /menu.lst

timeout 15
default 0

iftitle [cat --locate="(cd)" (md)0x220+1] Boot Windows Vista/7/8 on CD
	chainloader (cd)/bootmgr

iftitle [cat --locate="(hd0,0)" (md)0x220+1] Boot Windows Vista/7/8 on HD0,0
	chainloader (hd0,0)/bootmgr

iftitle [cat --locate="(hd0,1)" (md)0x220+1] Boot Windows Vista/7/8 on HD0,1
	chainloader (hd0,1)/bootmgr

iftitle [cat --locate="(hd0,2)" (md)0x220+1] Boot Windows Vista/7/8 on HD0,2
	chainloader (hd0,2)/bootmgr

iftitle [cat --locate="(hd0,3)" (md)0x220+1] Boot Windows Vista/7/8 on HD0,3
	chainloader (hd0,3)/bootmgr

iftitle [cat --locate="(hd1,0)" (md)0x220+1] Boot Windows Vista/7/8 on HD1,0
	chainloader (hd1,0)/bootmgr

iftitle [cat --locate="(hd1,1)" (md)0x220+1] Boot Windows Vista/7/8 on HD1,1
	chainloader (hd1,1)/bootmgr

iftitle [cat --locate="(hd1,2)" (md)0x220+1] Boot Windows Vista/7/8 on HD1,2
	chainloader (hd1,2)/bootmgr

iftitle [cat --locate="(hd1,3)" (md)0x220+1] Boot Windows Vista/7/8 on HD1,3
	chainloader (hd1,3)/bootmgr

 

Is there a way to exclude the boot device from the results of the find?


Edited by jc24, 24 April 2013 - 11:56 PM.


#20 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 25 April 2013 - 07:20 AM

How much system memory does your system have that you are using to test?

Are you testing on a real system or emulator/vm?



#21 jc24

jc24

    Newbie

  • Members
  • 11 posts

Posted 25 April 2013 - 09:09 AM

I've used both real system (2GB RAM) and virtual (512MB RAM). Both systems produced the same results.



#22 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 25 April 2013 - 10:01 AM

The stripped menu lst in post 14 works for me - did you actually test the menu.lst you posted - or are you actually using a different menu.lst? It may be something that you haven't posted.

 

If you look on the grub4dos examples page on my site you will find:

# Ignore boot device and boot to Windows XP, Vista, 7 or 8 from the internal hard disk
# This works by mapping the boot device (bd) which may have bootmgr or ntldr on it, to a virtual memory drive so that files on it are not found by the find command
title Boot to Windows from an internal hard disk
map --mem (md)+8 (bd)
map --hook
find --set-root --ignore-floppies --ignore-cd /bootmgr || find --set-root --ignore-floppies --ignore-cd /ntldr
map (bd) (bd)
map --rehook
chainloader /bootmgr || chainloader /ntldr


#23 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 25 April 2013 - 12:46 PM

If I may, could you spend a few more words to explain this?:

 

 

# This works by mapping the boot device (bd) which may have bootmgr or ntldr on it, to a virtual memory drive so that files on it are not found by the find command

I am pretty sure that it works :thumbsup:, but what you describe in the above is not what the commands do, seemingly :unsure:.

 

 



map --mem (md)+8 (bd)

The syntax should be map FROM device TO device, so that means that you are mapping the memory drive (md) first 8 sectors (why 8?) to boot disk (bd).

But bootdisk is not a "real" device, it is a name for a device that has it's own name (say (hd0)) and that happens to be also the bootdisk.

So, if I get it right you are overwriting the current "definition" of the device that is "also" (bd) with *something else* and thus the "original device" disappears.  

What exactly does the:

 

 



map (bd) (bd)

later do?  :dubbio:

 

Why map --rehook is used? (in the sense is it *needed* or is it just the "orthodox" way? - I seem to have understood that in recent grub4dos map --hook can be used multiple times and that map --rehook is kept to keep backwards compatibility).

:cheers:
Wonko



#24 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 25 April 2013 - 04:00 PM

(bd) is the current drive or volume,  e.g. ls (bd)/  will list files on the boot volume.

 

I have added more comments below.

title Boot to Windows from an internal hard disk
# map some random 8 sectors in memory containing junk data as current disk device  (usually bd=hd0)
# using +1 will fail, using +2 or more will work, +8 is arbitrary!, --mem is not required as md is memory anyway???
map --mem (md)+8 (bd)
map --hook

# any access to (bd) = (hd0) will access memory sectors and result in bad partition message
# thus find command will try to access hd0 but fail as it is just junk!
find --set-root --ignore-floppies --ignore-cd /bootmgr || find --set-root --ignore-floppies --ignore-cd /ntldr

# this maps the current boot drive (hd0) to (hd0) again  and not (md)
map (bd) (bd)

# use rehook as --hook does not work (reports 'empty drive map table')
map --rehook
chainloader /bootmgr || chainloader /ntldr

a map command adds a mapping to a 'map table'

 

when you 'hook' it adds a patch to a 'hooked map table' which is in the int 13h interrupt handler.

 

so --hook will patch the interrupt table by patching any new map commands to the  current 'hooked map' table

 

If you use --rehook, it discards the whole current hooked map table, and then re-creates the hooked map table based on the current 'map' table.

 

As we have just mapped (md) to (md), the current map table will be empty of mappings so the new 'hooked map' table will be empty but rehook will not complain about an empty map table whereas hook does - so we need to use rehook.

 

We could just have used instead:

map --unhook
map --unmap=0x80

or

 

map (0x80) (0x80)
map --rehook


#25 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 25 April 2013 - 04:00 PM

(bd) is the current drive or volume,  e.g. ls (bd)/  will list files on the boot volume.

 

I have added more comments below.

title Boot to Windows from an internal hard disk
# map some random 8 sectors in memory containing junk data as current disk device  (usually bd=hd0)
# using +1 will fail, using +2 or more will work, +8 is arbitrary!, --mem is not required as md is memory anyway???
map --mem (md)+8 (bd)
map --hook

# any access to (bd) = (hd0) will access memory sectors and result in bad partition message
# thus find command will try to access hd0 but fail as it is just junk!
find --set-root --ignore-floppies --ignore-cd /bootmgr || find --set-root --ignore-floppies --ignore-cd /ntldr

# this maps the current boot drive (hd0) to (hd0) again  and not (md)
map (bd) (bd)

# use rehook as --hook does not work (reports 'empty drive map table')
map --rehook
chainloader /bootmgr || chainloader /ntldr

a map command adds a mapping to a 'map table'

 

when you 'hook' it adds a patch to a 'hooked map table' which is in the int 13h interrupt handler.

 

so --hook will patch the interrupt table by patching any new map commands to the  current 'hooked map' table

 

If you use --rehook, it discards the whole current hooked map table, and then re-creates the hooked map table based on the current 'map' table.

 

As we have just mapped (bd) to (bd), the current map table will be empty of mappings so the new 'hooked map' table will be empty but rehook will not complain about an empty map table whereas hook does - so we need to use rehook.

 

We could just have used instead:

map --unhook
map --unmap=0x80

or

 

map (0x80) (0x80)
map --rehook





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users