Jump to content

grub4dos backup and restore partion table with a script


Recommended Posts

Nevermind. I have success!!!!!! jaclaz you are a true genius. Your Method works like a bomb and could not have thought of anything better.

Good. :)

I would I use this in windows so that I can remap within windows?

Well, in Windows it may become tricky., in the sense that the most you can do is to change the partition entry but then you will have the need to disconnect and reconnect the device (or however use - I believe it depends on the actual Windows NT version that behave slightly differently -  some diskpart or maybe even devcon commands to "refresh" the "read" MBR).

What happens to the booted OS (if booted from the stick) when you basically "pull the carpet from under its feet" :w00t::ph34r: is to be seen.

Of course, depending on the situation you could integrate into the booted from stick OS or PE a filter driver like cfadisk.sys or dummydisk.sys and have all the volumes visible/mappable to drive letters.

If instead you want to change the partition entries from a "main" installed windows (not booted from the stick), it is just a matter of a set of dsfo/dsfi (or dd for windows) commands, the only issue is that you will need to get a copy of the whole 512 byte sector and modify it, then re-write it "as a whole".

Since very likely you will have 4096 bytes clusters you can even have a single file, let's call it pepperbox.mbr  ;) with as much as 8 copies of the MBR and then deploy/write the one you choose (using the dsfo/dsfi you will need a temp file, using dd for windows you can use it directly).

More or less you can take inspiration by the Windows NT batch corresponding to mbrview.g4b, mbrbatch.cmd if you want to actually write/change the partition entries:

http://reboot.pro/topic/3191-mbrbatch-001-alpha/

or from the CHPTNORD.CMD:

http://reboot.pro/topic/18610-grub4dos-setptn1g4b-batch-file-sets-a-primary-partition-as-1st-entry/

 

but basically you need just a few commands:

dsfo \\.\Physicaldriven 0 512 C:\myniceMBR1.mbr

change the MBR with grub4dos

dsfo \\.\Physicaldriven 0 512 C:\myniceMBR2.mbr

change the MBR with grub4dos

dsfo \\.\Physicaldriven 0 512 C:\myniceMBR3.mbr

...

And then write back:

dsfi \\.\Physicaldriven 0 512 C:\myniceMBR1.mbr

etc.

 

or:

dd if=\\.\Physicaldriven of=C:\pepperbox.mbr count=1

change the MBR with grub4dos

dd if=\\.\Physicaldriven of=C:\pepperbox.mbr count=1 seek=1

change the MBR with grub4dos

dd if=\\.\Physicaldriven of=C:\pepperbox.mbr count=1 seek=2

change the MBR with grub4dos

dd if=\\.\Physicaldriven of=C:\pepperbox.mbr count=1 seek=3

...

and then write back (as an example the third copy)_

dd of=\\.\Physicaldriven if=C:\pepperbox.mbr count=1 skip=2

 

You should get the idea. :), of course you need to be d@mn sure to get the right \\.Physicaldriven ....

 

jaclaz

Link to comment
Share on other sites

  • 2 months later...

Sorry to post again but I have ran into a new problem and was wondering if someone can help me. I have been archiving each partitions files so that it is faster to redo it on a new flashdrive. however I was wondering why I get a device inaccessable error when I do this

partnew (hd0,0) 0 0 0 partnew (hd0,0) 0x07 (hd0,4)+1root (hd0,0)bootloader /bootmgr boot

The partition contains a bcd store bootmgr file and a working bootable windows vhd. Note that if a clone the vhd to the usb at part 4 and correct the bcd I am able to boot into it using the above command but I cant boot into the vhd itself

Edited by silent001
Link to comment
Share on other sites

Not possible (in the sense that the partnew command is about Primary partitions only).

It can be done of course through some scripting, but it is not the easiest of the things to write a grub4dos batch for.

 

About the .vhd booting as partition, this is "normal" as the sheer moment you clone the .vhd to a partition, it is not anymore a .vhd but a partition/volume, and it is as well normal that you cannot boot that way from a .vhd inside a partition (unless you are using an edition of Windows that allows "native" .vhd booting) without an additional third party driver (such as Firadisk or WinVblock).

 

You will need to take some time on reboot.pro to understand the differences between "native" .vhd booting and booting through Firadisk or Winvblock, start here:

http://reboot.pro/topic/15516-create-native-boot-vhds/

http://reboot.pro/topic/15407-booting-from-vhd-in-grub4dos/

http://reboot.pro/files/file/321-vhd-w7-compact-make-mini-7/

 

jaclaz

Link to comment
Share on other sites

jaclaz thanks for the reply. I have figured out why it gave me the innaccesable_boot_device error. Turns out the must be no partition entries in the parition table other than the grub4dos partition and the windows partition. so my new code looks as follows 

partnew (hd0,1) 0x07 1302528 29360128root (hd0,1)partnew (hd0,0) 0x07 57925632 67106816partnew (hd0,2) 0 0 0partnew (hd,3) 0 0 0root (hd0,0)bootloader /bootmgr boot

This way it boots no problems. So now I have a question for how to create logical partitions using grub4dos because I tried the command 

partnew (hd0,4) 0x07 57925632 67106816

but it doesnt work please help me thank you

Edited by silent001
Link to comment
Share on other sites

  • 4 weeks later...

I have found something that works

http://clover-wiki.zetam.org/Contents

now my new question is if you have a grub menu.lst on one part eg (hd0,1)

and another (hd0,0)

how can I auto load a menu entry from (hd0,1) menu.lst through the menu.lst on (hd0,0)?

Please help me

EG.

 

menu.lst on (hd0,0)

title (hd0,1)root (hd0,1)chainloader /grldrboot#Autoselect option two on menu.lst of (hd0,1)

menu.lst on (hd0,1)

title Windowsroot (hd0,2)chainloader /bootmgrtitle reboothalt
Edited by silent001
Link to comment
Share on other sites

I am not sure to understand the question, however you can load another menu with the configfile command.

Do check the guide:

http://diddy.boot-land.net/grub4dos/Grub4dos.htm

 

http://diddy.boot-land.net/grub4dos/files/menu.htm#submenu

http://diddy.boot-land.net/grub4dos/files/commands.htm#configfile

 

*like*

title another menu on hard disk (hd0,1)

root (hd0,1)

configfile /another.lst

 

You can use more than one menu(s) with a single option or use the "default" mechanism.

 

jaclaz 

Link to comment
Share on other sites

Let me try explain again 

On my grub4dos partition the menu.lst in the root of the partition looks as follows

title Boot To First Hardrivefind --set-root /SYS.tagpartnew (hd0,2) 0x0B 95674368 29358080partnew (hd0,0) 0 0 0partnew (hd0,1) 0 0 0partnew (hd0,3) 0 0 0root (hd0,2)makeactiveroot (hd1,0)chainloader /bootmgrboot#start AVASTtitle AVASTfind --set-root /SYS.tagpartnew (hd0,2) 0x0B 95674368 29358080partnew (hd0,0) 0x07 26468352 2095104root (hd0,2)makeactiveroot (hd0,0)chainloader /bootmgrboot#end AVAST#start WIN7title WIN7find --set-root /SYS.tagpartnew (hd0,2) 0x0B 95674368 29358080partnew (hd0,0) 0x07 1302528 12580864root (hd0,2)makeactiveroot (hd0,0)chainloader /bootmgrboot#end WIN7#start WIM10title WIM10find --set-root /SYS.tagpartnew (hd0,2) 0x0B 95674368 29358080partnew (hd0,0) 0x0B 13885440 12580864root (hd0,0)makeactivechainloader /grldrboot#start WinToGOtitle WinToGOfind --set-root /SYS.tagpartnew (hd0,2) 0x0B 95674368 29358080partnew (hd0,0) 0x07 28565504 67106816root (hd0,2)makeactiveroot (hd0,0)chainloader /bootmgrboot#end WinToGOtitle Shutdownhalt

then my WIM10 menu.lst looks as follows

# 2014-05-16 - Clover boot7 added# 2014-05-18 - Clover hd0,1 added# 2014-05-19 - bugfix should be hd0,2 not hd0,1!# 2014-05-22a - support syslinux and clover# 2014-05-27 - add NTFS(win)+FAT32(blank) support for installing NTFS win via Clover only# 2015-03-07 - add FreeBSD menu entry (use xxx.imgPTNA5 and xxx. for FreeBSD memstick.ig file)# 2015-04-16 - new grldr + hotkey -A# 2015-06-17 - clover menu for NTFS+FAT32 changed# 2015-07-10 v0.51 - clover 32-bit added# 2015-08-20 - detect grub2 and syslinux in (hd0,2) partition and add menu entry, MBR.BIN addedset VER=0.56# get UUID of driveuuid () > nulset UUID=%?%#Backup Reserve MBR if it is grub4dos MBRcat --locate="Missing MBR" (hd0)30+1 > nul && dd if=(hd0)30+1 of=(hd0,0)/e2b/MBR.BIN > nulcat --locate="Missing MBR" (hd0)60+1 > nul && dd if=(hd0)60+1 of=(hd0,0)/e2b/MBR.BIN > nul# Detect grub2 bootloader in (hd0,2) partition #3parttype (hd0,2) > nulset P2=%@retval%if "%P2%"=="0" parttype (hd0,2) 0x83 > nul# grub2 - e.g. pmagicset CMD2=set CMD2T=if exist (hd0,2)/boot/grub/i386-pc/core.img set "CMD2=kernel (hd0,2)/boot/grub/i386-pc/core.img"if exist (hd0,2)/boot/grub/core.img set "CMD2=kernel (hd0,2)/boot/grub/core.img"if exist (hd0,2)/grub2/core.img set "CMD2=kernel (hd0,2)/grub2/core.img"if exist (hd0,2)/boot/grub2/i386-pc/core.img set "CMD2=kernel (hd0,2)/boot/grub2/i386-pc/core.img"# grub - e.g. bitdefenderif exist (hd0,2)/boot/grubi386.pc set "CMD2=kernel (hd0,2)/boot/grubi386.pc"# freeldrif exist (hd0,2)/freeldr.sys set "CMD2=kernel (hd0,2)/freeldr.sys"# for EasyRE payloadsif exist (hd0,2)/bootmgr if exist (hd0,2)/{EasyUSB} set "CMD2=kernel (hd0,2)/bootmgr"# Check if syslinux in ptn #3cat --locate="SYSLINUX" --length=10 --skip=0x2 (hd0,2)0+1 > nul && set "CMD2=chainloader (hd0,2)+1"if "%P2%"=="0" parttype (hd0,2) 0 > nulif exist CMD2 set "CMD2T=Boot to Partition 2"# --- HEADING, PAYLOAD and FOOTER TEXT -----# set CENTREHD to 1 to centre the heading and payload description or else comment outset CENTREHD=1#set CHEADING=\x20Easy2Boot CSM Menu (v%VER%) (UUID=%UUID%)#set CHELPTEXT=\x20     This menu has booted in MBR\\CSM Mode (not UEFI)                      (c) www.easy2boot.com\x20# ---cleartimeout 0default 1debug offpassword easy2boot/e2b/hotkey -A# backup PBRcat --locate="BOOT7" --length=10 --skip=0x58 ()+1 > nul || dd if=()+2 of=()/PBR.BIN > nul# this loads the thin unifont font for non-ASCII characters (e.g. Chinese) - to save menu load time, you can comment it out and remove the /e2b/unifont.hex.gz file#font /e2b/unifont.hex.gz# autonumber menu entries - use 0x0000 for no numberingwrite 0x8274 0x2001 > nul# ----- GRAPHICS MODE AND BACKGROUND BITMAP ----graphicsmode -1 800 600 && splashimage /e2b/csm.bmp > nulset E=# To adjust position, change P:XXXX in lines below#if exist /EFI/boot/bootia32.efi   set E=%E%echo -n -e    -P:2800 \\x24[0103]INFORMATION: x86 32-bit UEFI boot file \\\\EFI\\\\boot\\\\bootia32.efi present #if exist /EFI/boot/bootx64.efi    set E=%E% \necho -n -e -P:2900 \\x24[0103]INFORMATION: x86 64-bit UEFI boot file \\\\EFI\\\\boot\\\\bootx64.efi  present#if exist /EFI/boot/bootia64.efi   set E=%E% \necho -n -e -P:3000 \\x24[0103]INFORMATION: ITANIUM 64-bit UEFI boot file \\\\EFI\\\\boot\\\\bootia64.efi present#if exist /EFI/boot/bootARM.efi    set E=%E% \necho -n -e -P:3100 \\x24[0103]INFORMATION: ARM 32-bit UEFI boot file \\\\EFI\\\\boot\\\\bootARM.efi  present#if exist /EFI/boot/bootAA64.efi   set E=%E% \necho -n -e -P:3200 \\x24[0103]INFORMATION: ARM 64-bit UEFI boot file \\\\EFI\\\\boot\\\\bootAA64.efi present#ls /EFI > nul ||                  set E=\necho -n -e -P:2800 \\x24[0103]   INFORMATION: No \\\\EFI folder present (cannot UEFI boot)# -------- MENU COLOURS -------# Colour pairs are Text/Background - i.e cyan/blue = cyan text on blue background# Use black if a transparent background is required for menu highlight background - e.g. highlight=red/black# Valid colours are: black, blue, green, cyan, red, magenta, brown, light-gray, dark-gray, light-blue, light-green, light-cyan, light-red, light-magenta, yellow and white.#  normal    = normal menu text#  highlight = highlighted menu text when a menu entry is selected#  helptext  = the colour of the title help text shown just below the menu box#  standard  = the console background and text colours (e.g. when listing files)#  border    = the colour of the border of the menu boxcolor normal=white/black highlight=black/white helptext=white/black standard=white/black border=black/black# ----- MENU POSITION ---# wordspacing linespacing borderwidth tophelp numberofitemsinmenu topstart menuwidth rightstartposofmenu# tophelp=topstart+noitems for menuhelp text just under menu boxset wdspace=0set lnspace=0set topstart=7set rstart=14set noitems=13set menuw=67set bdwidth=0set tophelp=20/e2b/menusetting.gz   %wdspace% %lnspace% %bdwidth% %tophelp% %noitems% %topstart% %menuw% %rstart% && clear# --- HEADER --- # HCOLOUR sets the colour of the HEADING and FOOTER TEXT text # HCOLOUR=ABCD specifies the text colour  [BLINK|BRIGHT|BACKGROUND|FOREGROUND]# A=0/1 1 = BLINK text (does not work under VM)# B=0/1 1 = BRIGHT colour for foreground text# C=0-7 = BACKGROUND colour - transparent if graphics mode so has no effect!# D=0-7 = FOREGROUND menu text colour# Colours parameters are: 0=black/grey 1=blue, 2=green, 3=cyan, 4=red, 5=pink, 6=yellow/brown, 7=grey/white.# e.g. 0106 is non-blinking yellow text, 0006 is brown text, 0101 is light blue text# HEADINGset CHPAD=\x20 ;;    # PADDING for CHEADING and PAYLOAD - set to same as rstart-3set CHTOP=0100 ;;    # HEADING POSITIONset CHCOLOUR=0107 ;; # HEADING COLOUR# PAYLOAD DESCRIPTIONset CPAY_POS=0300 ;; # PAYLOAD NAME POSITION XXYYset CPAY_COL=0106 ;; # PAYLOAD NAME COLOUR# FOOTER HELP TEXTset CHBTM=3605 ;; # HELP TEXT BOTTOM POSITION XXYYset CFCOLOUR=0005 ;; # FOOTER COLOUR#------## use PAYLOAD variable to hold title of payload (MakePartImage will replace next line with the payload name)##set PAYLOAD= ;; ###################################################################################################################################################set CLRTOP=\x20                                                             \x20# This displays the heading, description and footer textif "%CENTREHD%"=="1" set CENTREHD=%menuw%if exist CENTREHD call /e2b/centrehd.g4b CHEADINGif exist CENTREHD call /e2b/centrehd.g4b PAYLOADwrite (md)0x220+2 !BAT\necho -n -P:0000 $[0122]%CLRTOP%\necho -n -P:%CHTOP% $[%CHCOLOUR%] %CHPAD%%CHEADING%\necho -n -P:%CPAY_POS% $[%CPAY_COL%]%CHPAD%%PAYLOAD%\necho -n -P:%CHBTM% $[%CFCOLOUR%]%CHELPTEXT%\n\0 > nul# add EFI boot file messagesecho -e %E% \0 >> (md)0x220+2initscript (md)0x220+2# --- MISC ----title Return To Main Menu\n find --set-root /SYS.tagpartnew (hd0,2) 0x0B 95674368 29358080partnew (hd0,0) 0 0 0partnew (hd0,1) 0 0 0partnew (hd0,3) 0 0 0root (hd0,2)makeactivechainloader /grldrboot# --- x64 UEFI BOOT using CLOVER ---iftitle [checkrange 2,3 is64bit && if exist /boot7  && if not exist (hd0,2)/EFI/boot/bootx64.efi  && if exist /EFI/boot/bootx64.efi && cat --locate="FAT32" --length=10 --skip=0x50 ()+1 > nul] Clover 64-bit UEFI Boot Menu (USB 2.0 ports only)\n Boot via UEFI (choose the UEFI boot option)\n EFI options are for MBR booting#cat --locate="SYSLINUX" --length=10 --skip=0x2 ()+1 > nul && pause PROBLEM: SYSLINUX DETECTED - Will not install Clover to PBR... && configfile /menu.lstset CL=0## boot7 is default boot filecat --locate="BOOT7" --length=10 --skip=0x58 ()+1 > nul && set /a CL=%CL%+1 > nulif "%CL%"=="1" echo Information: Clover is already installed to the PBRecho ffffffffff > (md)0x350+1dd if=(hd0,0)+1 of=(md)0x350+1 > nuldd if=()/clover/boot1f32alt7 of=(md)0x350+1 skip=87 seek=87 bs=1 > nuldd if=()/clover/boot1f32alt7 of=(md)0x350+1 count=3 bs=1 > nul#cat --hex (md)0x350+1 && pause if not "%CL%"=="1" dd if=(md)0x350+1 of=(hd0,0)+1 > nul && pause --wait=2 PBR has been updated with Clover boot code...chainloader /clover/boot0ss || chainloader /clover/boot0md || chainloader /clover/boot0afboot# User can press 2 for 3 for 32-bit UEFI, 6 for 64-bit UEFI or 1 for Chameleon - within 3 seconds - uses \bootx files in root# boot0md gives a boot0 message and is slower - boot0ss is silent with no messageiftitle [checkrange 2,3 is64bit && if exist /boot7 && if not exist /EFI/boot/bootx64.efi  && if exist (hd0,2)/EFI/boot/bootx64.efi && cat --locate="FAT32" --length=10 --skip=0x50 ()+1 > nul] Clover 64-bit UEFI Boot Menu (USB 2.0 ports only)\n Boot via UEFI (choose the UEFI boot option)\n EFI options are for MBR booting#cat --locate="SYSLINUX" --length=10 --skip=0x2 ()+1 > nul && pause PROBLEM: SYSLINUX DETECTED - Will not install Clover to PBR... && configfile /menu.lstset CL=0## boot7 is default boot filecat --locate="BOOT7" --length=10 --skip=0x58 ()+1 > nul && set /a CL=%CL%+1 > nulif "%CL%"=="1" echo Information: Clover is already installed to the PBRecho ffffffffff > (md)0x350+1dd if=(hd0,0)+1 of=(md)0x350+1 > nuldd if=()/clover/boot1f32alt7 of=(md)0x350+1 skip=87 seek=87 bs=1 > nuldd if=()/clover/boot1f32alt7 of=(md)0x350+1 count=3 bs=1 > nul#cat --hex (md)0x350+1 && pause if not "%CL%"=="1" dd if=(md)0x350+1 of=(hd0,0)+1 > nul && pause --wait=2 PBR has been updated with Clover boot code...chainloader /clover/boot0ss || chainloader /clover/boot0md || chainloader /clover/boot0afboot# IF PTN1(hd0,0)=NTFS  PTN3(hd0,2)=FAT32 iftitle [checkrange 2,3 is64bit && if exist (hd0,2)/boot7 && if exist (hd0,2)/EFI/boot/bootx64.efi && if exist /EFI/boot/bootx64.efi && cat --locate="NTFS" --length=10 --skip=0x2 (hd0,0)+1 > nul && cat --locate="FAT32"  --length=10 --skip=0x50 (hd0,2)+1 > nul] Clover 64-bit UEFI Boot (NTFS+FAT32) (USB 2.0 ports only)\n Boot via UEFI (choose the 'Boot UEFI internal' icon)\n Do not pick the Microsoft EFI options!set CL=0## boot7 is default boot filecat --locate="BOOT7" --length=10 --skip=0x58 (hd0,2)+1 > nul && set /a CL=%CL%+1 > nulif "%CL%"=="1" echo Information: Clover is already installed to the PBRecho ffffffffff > (md)0x350+1dd if=(hd0,2)+1 of=(md)0x350+1 > nuldd if=(hd0,2)/clover/boot1f32alt7 of=(md)0x350+1 skip=87 seek=87 bs=1 > nuldd if=(hd0,2)/clover/boot1f32alt7 of=(md)0x350+1 count=3 bs=1 > nulif not "%CL%"=="1" dd if=(md)0x350+1 of=(hd0,2)+1 > nul && pause --wait=2 PBR on (hd0,2) has been updated with Clover boot code...chainloader /clover/boot0ss || chainloader (hd0,2)/clover/boot0ss || chainloader /clover/boot0md || chainloader /clover/boot0afboot# --- 32-BIT UEFI BOOT using CLOVER ---iftitle [if exist /boot3  && if not exist (hd0,2)/EFI/boot/bootia32.efi  && if exist /EFI/boot/bootia32.efi && cat --locate="FAT32" --length=10 --skip=0x50 ()+1 > nul] Clover 32-bit UEFI Boot Menu (USB 2.0 ports only)\n Boot via UEFI (choose the UEFI boot option)\n EFI options are for MBR bootingset CL=0cat --locate="BOOT3" --length=10 --skip=0x58 ()+1 > nul && set /a CL=%CL%+1 > nulif "%CL%"=="1" echo Information: Clover is already installed to the PBRecho ffffffffff > (md)0x350+1dd if=(hd0,0)+1 of=(md)0x350+1 > nuldd if=()/clover/boot1f32alt7 of=(md)0x350+1 skip=87 seek=87 bs=1 > nuldd if=()/clover/boot1f32alt7 of=(md)0x350+1 count=3 bs=1 > nulcat --locatei=boot7 --replace=BOOT3 (md)0x350+1 > nulif not "%CL%"=="1" dd if=(md)0x350+1 of=(hd0,0)+1 > nul && pause --wait=2 PBR has been updated with Clover boot code...chainloader /clover/boot0ss || chainloader /clover/boot0md || chainloader /clover/boot0afbootiftitle [if exist /boot3 && if not exist /EFI/boot/bootia32.efi  && if exist (hd0,2)/EFI/boot/bootia32.efi && cat --locate="FAT32" --length=10 --skip=0x50 ()+1 > nul] Clover 32-bit UEFI Boot Menu (USB 2.0 ports only)\n Boot via UEFI (choose the UEFI boot option)\n EFI options are for MBR bootingset CL=0cat --locate="BOOT3" --length=10 --skip=0x58 ()+1 > nul && set /a CL=%CL%+1 > nulif "%CL%"=="1" echo Information: Clover is already installed to the PBRecho ffffffffff > (md)0x350+1dd if=(hd0,0)+1 of=(md)0x350+1 > nuldd if=()/clover/boot1f32alt7 of=(md)0x350+1 skip=87 seek=87 bs=1 > nuldd if=()/clover/boot1f32alt7 of=(md)0x350+1 count=3 bs=1 > nulcat --locatei=boot7 --replace=BOOT3 (md)0x350+1 > nulif not "%CL%"=="1" dd if=(md)0x350+1 of=(hd0,0)+1 > nul && pause --wait=2 PBR has been updated with Clover boot code...chainloader /clover/boot0ss || chainloader /clover/boot0md || chainloader /clover/boot0afboot# IF PTN1(hd0,0)=NTFS  PTN3(hd0,2)=FAT32 iftitle [if exist (hd0,2)/boot3 && if exist (hd0,2)/EFI/boot/bootia32.efi && if exist /EFI/boot/bootia32.efi && cat --locate="NTFS" --length=10 --skip=0x2 (hd0,0)+1 > nul && cat --locate="FAT32"  --length=10 --skip=0x50 (hd0,2)+1 > nul] Clover 32-bit UEFI Boot (NTFS+FAT32) (USB 2.0 ports only)\n Boot via UEFI (choose the 'Boot UEFI internal' icon)\n Do not pick the Microsoft EFI options!set CL=0cat --locate="BOOT7" --length=10 --skip=0x58 (hd0,2)+1 > nul && set /a CL=%CL%+1 > nulif "%CL%"=="1" echo Information: Clover is already installed to the PBRecho ffffffffff > (md)0x350+1dd if=(hd0,2)+1 of=(md)0x350+1 > nuldd if=(hd0,2)/clover/boot1f32alt7 of=(md)0x350+1 skip=87 seek=87 bs=1 > nuldd if=(hd0,2)/clover/boot1f32alt7 of=(md)0x350+1 count=3 bs=1 > nulcat --locatei=boot7 --replace=BOOT3 (md)0x350+1 > nulif not "%CL%"=="1" dd if=(md)0x350+1 of=(hd0,2)+1 > nul && pause --wait=2 PBR on (hd0,2) has been updated with Clover boot code...chainloader /clover/boot0ss || chainloader (hd0,2)/clover/boot0ss || chainloader /clover/boot0md || chainloader /clover/boot0afboot# FreeBSD partitioniftitle [if exist (hd0,2)/boot/boot1] Boot to FreeBSD on 3rd partition (MBR mode)\n Boot to FreeBSD partitionroot (hd0,2)chainloader (hd0,2)+1 || chainloader /boot/boot1# BOOTMGR on 3rd partitioniftitle [if exist (hd0,2)/bootmgr] Boot Windows on 3rd partition (MBR mode)\n Boot Windows using bootmgr on (hd0,2)root (hd0,2)chainloader /bootmgr

The above menu.lst on wim10 partition was taken from Steve Si's makepartimage tool that can be found at http://www.easy2boot.com/add-payload-files/makepartimage/ all I did is take the menu.lst from the partition the tool creates and removed the code that I don't need and left that which I do and added some extra code of my own.

 

Now when I insert my USB the grub4dos menu.lst, I have made using the method jaclaz has suggested, is loaded. When I select WIM10 it boots (hd0,0) with the menu.lst taken from the tool. I want it so that it auto selects the default, which is 1, and then boots the partition in UEFI mode as is needed which I can do by setting the timeout to 0 which is fine but when I am done and the USB is booted again it boots the WIM10 partition as it is set active and then loads its menu.lst then boots the partiton in UEFI mode. I do not want this. I want it to rather load the Return To Main Menu to be loaded so that I go back to my main menu. So my question is can I make the grub4dos partition menu.lst to something like

title Boot To First Hardrivefind --set-root /SYS.tagpartnew (hd0,2) 0x0B 95674368 29358080partnew (hd0,0) 0 0 0partnew (hd0,1) 0 0 0partnew (hd0,3) 0 0 0root (hd0,2)makeactiveroot (hd1,0)chainloader /bootmgrboot#start AVASTtitle AVASTfind --set-root /SYS.tagpartnew (hd0,2) 0x0B 95674368 29358080partnew (hd0,0) 0x07 26468352 2095104root (hd0,2)makeactiveroot (hd0,0)chainloader /bootmgrboot#end AVAST#start WIN7title WIN7find --set-root /SYS.tagpartnew (hd0,2) 0x0B 95674368 29358080partnew (hd0,0) 0x07 1302528 12580864root (hd0,2)makeactiveroot (hd0,0)chainloader /bootmgrboot#end WIN7#start WIM10title WIM10find --set-root /SYS.tagpartnew (hd0,2) 0x0B 95674368 29358080partnew (hd0,0) 0x0B 13885440 12580864root (hd0,0)makeactivechainloader /grldrload defaultboot#start WinToGOtitle WinToGOfind --set-root /SYS.tagpartnew (hd0,2) 0x0B 95674368 29358080partnew (hd0,0) 0x07 28565504 67106816root (hd0,2)makeactiveroot (hd0,0)chainloader /bootmgrboot#end WinToGOtitle Shutdownhalt

So that it automatically selects the entry 1 and loads the UEFI mode but on reboot the menu.lst on WIM10 partition will automatically load Return To Main Menu so I basically have only one main menu?

Link to comment
Share on other sites

I have still not at all clear the whole thing, but basically this is "wrong":

 

 

 

#start WIM10title WIM10find --set-root /SYS.tagpartnew (hd0,2) 0x0B 95674368 29358080partnew (hd0,0) 0x0B 13885440 12580864root (hd0,0)makeactivechainloader /grldrload defaultboot
there is no reason why you would want to chainload from grldr another grldr, you can load in the "same, initially loaded" grldr another menu, using the configfile command and or you can use the default command to change which menu entry is autoselected at boot.

There is no "load default" command that I can remember :unsure:

The "normal" way is to use the default (file)and the the default (command) and setdefault (command):

http://diddy.boot-land.net/grub4dos/files/menu.htm#default

jaclaz

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...