Grub4dos Example Menus


The menu code below cannot just be cut and pasted into one large menu.lst file!

You need to just take the bits that you need!


EXAMPLES

The grub4dos menus and code snippets below should be copied into your own menu - DO NOT JUST COPY THIS WHOLE PAGE!

Please search this site for the relevant tutorials!

#check version of grub4dos is later than 01-02-2012
checkrange 20120201:-1 read 0x8278 || pause --wait=3 Please use grub4dos-0.4.5c-2012-02-01 or later! && exit 1

#reset key map
setkey

#change key map for UK keyboard
setkey
setkey at doublequote
setkey doublequote at
setkey tilde bar
setkey numbersign backslash

#French
setkey
setkey less backquote
setkey greater tilde
setkey ampersand 1
setkey 1 exclam
setkey tilde 2
setkey 2 at
setkey doublequote 3
setkey 3 numbersign
setkey quote 4
setkey 4 dollar
setkey parenleft 5
setkey 5 percent
setkey minus 6
setkey 6 caret
setkey backquote 7
setkey 7 ampersand
setkey underscore 8
setkey 8 asterisk
setkey backslash 9
setkey 9 parenleft
setkey at 0
setkey 0 parenright
setkey parenright minus
setkey numbersign underscore
:: no change for equal
:: no change for plus
setkey a q
setkey A Q
setkey z w
setkey Z W
setkey caret bracketleft
:: no equivalent for diaresis => we keep the US braceleft
setkey dollar bracketright
:: no equivalent for pound => we keep the US braceright
setkey q a
setkey Q A
setkey m semicolon
setkey M colon
setkey bracketleft quote
setkey percent doublequote
setkey asterisk backslash
setkey bracketright bar
setkey w z
setkey W Z
setkey comma m
setkey question M
setkey semicolon comma
setkey period less
setkey colon period
setkey slash greater
setkey exclam slash
setkey bar question

#Japan 106
setkey
setkey at bracketleft
setkey doublequote at
setkey ampersand caret
setkey quote ampersand
setkey parenleft asterisk
setkey parenright parenleft
setkey underscore parenright
setkey equal underscore
setkey plus colon
setkey colon quote
setkey asterisk doublequote
setkey bracketleft bracketright
setkey braceleft braceright
setkey bracketright backslash
setkey braceright bar
setkey backslash backquote
setkey tilde plus
setkey caret equal
setkey backquote braceleft
setkey bar tilde


# to set a german keyboard use these setkey commands before the first title command
setkey
setkey yz
setkey zy
setkey YZ
setkey ZY
setkey equal parenright
setkey parenright parenleft
setkey parenleft asterisk
setkey doublequote at
setkey plus bracket right
setkey minus slash
setkey slash ampersand
setkey ampersand percent
setkey percent caret
setkey underscore question
setkey question underscore
setkey semicolon less
setkey less number sign
setkey number sign backslash
setkey colon greater
setkey greater bar
setkey asterisk braceright

# set AZERTY ketyboard
setkey
setkey a q
setkey A Q
setkey z w
setkey Z W
setkey q a
setkey Q A
setkey m semicolon
setkey M colon
setkey w z
setkey W Z
setkey comma m
setkey question M
setkey semicolon comma
setkey period less
setkey colon period
setkey slash greater
setkey exclam slash
setkey dollar bracketright
setkey asterisk backslash
setkey percent doublequote
setkey ampersand 1
setkey 1 exclam
setkey tilde 2
setkey 2 at
setkey doublequote 3
setkey 3 numbersign
setkey quote 4
setkey 4 dollar
setkey parenleft 5
setkey 5 percent
setkey minus 6
setkey 6 caret
setkey backquote 7
setkey 7 ampersand
setkey underscore 8
setkey 8 asterisk
setkey caret 9
setkey 9 parenleft
setkey at 0
setkey 0 parenright
setkey parenright minus
setkey less backquote
setkey greater tilde
setkey numbersign braceright
setkey backslash question
setkey bracketright braceleft
setkey braceleft quote
setkey braceright underscore

#QWERTZ keyboard
setkey
setkey y z
setkey z y
setkey Y Z
setkey Z Y
setkey equal parenright
setkey parenright parenleft
setkey parenleft asterisk
setkey doublequote at
setkey backquote equal
setkey plus bracketright
setkey minus slash
setkey slash ampersand
setkey ampersand percent
setkey percent caret
setkey underscore question
setkey question underscore
setkey semicolon less
setkey less numbersign
setkey numbersign backslash
setkey colon greater
setkey greater bar
setkey asterisk braceright
setkey caret backquote
setkey backslash minus



# ensure not in debug=2 mode or gfxmenu will need two key presses!
debug 1
gfxmenu /message
color black/cyan yellow/cyan
timeout 1
default 0
# line below will ensure the gfxmenu is always loaded even after an error
configfile (bd)/menu.lst

# if booting from a USB Flash drive get the UUID like this
debug 1
uuid (bd) > (md)0x220+1
cat --skip=18 --length=9 (md)0x220+1 | set UUID=
# if booting from HDD use --length=16
echo UUID of boot device is %UUID%

# 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


#This entry sends an ESC character which can be used to exit from the GFXMenu back to the grub4dos text menu (or the user can just press ESC instead)
#The file esc.txt must exist and contain the ESC character (0x1b or 27 or 033 octal) - the esc.txt file is in Beta Downloads section if you want it!
title grub4dos menu
cat /esc.txt && clear

title List partitions
clear
cat (hd0,0)+1 > (md)800+1 && parttype (hd0,0) && echo Contents of (hd0,0): && ls (hd0,0)/ && echo && echo --------
cat (hd0,1)+1 > (md)800+1 && parttype (hd0,1) && echo Contents of (hd0,1): && ls (hd0,1)/ && echo && echo --------
cat (hd0,2)+1 > (md)800+1 && parttype (hd0,2) && echo Contents of (hd0,2): && ls (hd0,2)/ && echo && echo --------
cat (hd0,3)+1 > (md)800+1 && parttype (hd0,3) && echo Contents of (hd0,3): && ls (hd0,3)/ && echo && echo --------
cat (hd0,4)+1 > (md)800+1 && parttype (hd0,4) && echo Contents of (hd0,4): && ls (hd0,4)/ && echo && echo --------
cat (hd1,0)+1 > (md)800+1 && parttype (hd1,0) && echo Contents of (hd1,0): && ls (hd1,0)/ && echo && echo --------
cat (hd1,1)+1 > (md)800+1 && parttype (hd1,1) && echo Contents of (hd1,1): && ls (hd1,1)/ && echo && echo --------
cat (hd1,2)+1 > (md)800+1 && parttype (hd1,2) && echo Contents of (hd1,2): && ls (hd1,2)/ && echo && echo --------
cat (hd1,3)+1 > (md)800+1 && parttype (hd1,3) && echo Contents of (hd1,3): && ls (hd1,3)/ && echo && echo --------
cat (hd1,4)+1 > (md)800+1 && parttype (hd1,4) && echo Contents of (hd1,4): && ls (hd1,4)/ && echo && echo --------
echo
pause --wait=10 Please check available partitions...
configfile (bd)/menu.lst

title Reboot
reboot

title Switch Off
halt

#hotkey and autonumber example
color white/blue
write 0x8274 0x2001
## run hotkey once to enable hotkey.
/hotkey
## show this menu only if /ntldr can be found
iftitle [find /ntldr] ^Ctrl+F1 Press Ctrl+F1 to boot /ntldr
find --set-root /ntldr
chainloader /ntldr


# Check this CD/USB drive is not too old - see Tutorial #71 for details
# Usage: /checkdate.g4b <Release Year> <Release Month> <Release DayOfMonth> <ExpiresInDays> [<SILENT>]
/checkdate.g4b 2012 12 3 2
pause
if NOT "%CHECKDATE%"=="OK" reboot

#Boot using the original backup MBR sector (copied to LBA1 by grub4dos on install)
#This will boot the system as it would before grub4dos was installed
title Normal Windows Boot
rootnoverify (hd0)
chainloader (hd0)1+1

#this assumes you have booted from a USB drive and you want to boot from the hard disk
title Boot from 1st Hard Disk \nBoot from MBR of first hard disk
map (hd0) (hd1)
map (hd1) (hd0)
map --hook
chainloader (hd0)+1
rootnoverify (hd0)


title FreeDOS
find --set-root /kernel.sys
chainloader /kernel.sys

title MSDOS
find --set-root /io.sys
chainloader /io.sys

title FreeDOS (AS HDD)
map (hd0) (hd1)
map (hd1) (hd0)
map --hook
rootnoverify (hd1,0)
chainloader /kernel.sys

title FreeDOS (AS FLOPPY)
map (hd0,0)+1 (fd0)
map (hd0) (hd1)
map (hd1) (hd0)
map --hook
chainloader (fd0)/kernel.sys
rootnoverify (fd0)
map --floppies=1

title MS-DOS (AS HDD)
rootnoverify (hd0,0)
chainloader (hd0,0)/io.sys

title Always boot from USB to MS-DOS AS FLOPPY DISK A:
checkrange 0x80 read 0x8280 && map (hd0,0)+1 (fd0)
checkrange 0x80 read 0x8280 && map (hd1) (hd0)
checkrange 0x80 read 0x8280 && map --hook
ls (fd0)/io.sys && clear && pause --wait=1 /IO.SYS found on floppy disk
ls (fd0)/io.sys || pause --wait=3 /IO.SYS not found on floppy disk
ls (fd0)/io.sys && chainloader (fd0)/io.sys
ls (fd0)/io.sys && rootnoverify (fd0)
ls (fd0)/io.sys && map --floppies=1
ls (fd0)/io.sys && map --harddrives=1
clear
boot

title MS-DOS (AS FLOPPY) AND HDD as HDD0
map (hd0,0)+1 (fd0)
# map the first partition of the hard disk as a floppy disk
map (hd0) (hd32)
# map the UFD as a virtual cd
map (hd1) (hd0)
# map the real hard disk as hard disk 0
map --hook
# hook Int13 interrupts so all map changes take affect
chainloader (fd0)/io.sys
# load the io.sys code into memory from the floppy disk (now ufd is fd0)
rootnoverify (fd0)
# set the file root as the floppy disk
map --floppies=1
map --harddrives=1
# Tweak BIOS device numbers so DOS sees 1 floppy and 1 hd


title MS-DOS (AS FLOPPY) AND HDD as HDD0 (no comments)
map (hd0,0)+1 (fd0)
map (hd0) (hd32)
map (hd1) (hd0)
map --hook
chainloader (fd0)/io.sys
rootnoverify (fd0)
map --floppies=1
map --harddrives=1

#boot from floppy image with internal hdd as hd0 (no other hdds) (use ImDisk to create a large floppy .ima file)
title Install Win98\n Install Win98 using large .ima file
map /Win98_SE.ima (fd0)
map --hook
set A=
if exist (fd0)/IO.SYS set A=1
if exist (fd0)/KERNEL.SYS set A=1
if not exist A set /p A=ERROR: No DOS boot files found in .ima file! && chainloader /grldr
map (hd1) (hd0)
map --hook
#set just one HDD and one floppy
map --harddrives=1
map --floppies=1
root (fd0)
chainloader /IO.SYS || chainloader /KERNEL.SYS


#
http://www.partition-saving.com/
title savepart.iso
# map the iso file as a virtual cd
map /savepart.iso (0xff)
# hook the int 13 interrupt so the BIOS sees it as a CD
map --hook
# set the root path to the new virtual CD
root (0xff)
# boot from the CD
chainloader (0xff)

title spartbdk.img
# map the 1.44MB floppy image as fd0
map /spartbdk.img (fd0)
map --hook
root (fd0)
# load the freedos kernel.sys as the boot file
chainloader /kernel.sys

# Use SHIFT to boot linux in safe mode
title Run Linux\nPress SHIFT+ENTER for safe mode
/bios int=0x16 eax=0x00000200 > (md)0x300+1 && cat --skip=12 --length=2 (md)0x300+1 | set /a n=0x > nul
set /a n=%n% & 0x03 > nul && if %n%>=1 echo SHIFT PRESSED!
#LShift=01,RShift=02,CTRL=04,ALT=08,SCROLL=10,NUM=20,CAPS=40,INS=80
#set /a n=%n% & 0x04 > nul && if %n%>=1 echo CTRL PRESSED!
set sf=
if %n%>=1 set sf=acpi=off irqpoll noapic noapm nodma nomce nolapic nosmp
kernel /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed boot=casper %sf% splash
initrd /casper/initrd.img


title WinPe v2
map /bootmgr (rd)
chainloader (rd)+1
root ()

;Note: make sure the 'cheat code' fromusb is present and also the bootfromiso path to the iso file on the USB drive starts with a forward slash /
;The ISO filename needs to be 8.3 and is case sensitive too!
title PCLinuxOS LiveCD \n * Boot direct from ISO file
map --unhook
map --unmap=0:0xff
find --set-root --ignore-floppies /pclos.iso
map --heads=0 --sectors-per-track=0 /pclos.iso (0xff)
map --hook
root (0xff)
kernel (0xff)/isolinux/vmlinuz fromusb bootfromiso=/pclos.iso livecd=livecd root=/dev/rd/3 acpi=on vga=788 keyb=en vmalloc=256M edd=off
initrd (0xff)/isolinux/initrd.gz

title BackTrack 4 Final LiveCD (extracted ISO contents to bt4 folder)
find --set-root /bt4/boot/vmlinuz
kernel /bt4/boot/vmlinuz BOOT=/bt4/casper boot=/bt4/casper nopersistent rw quiet vga=0x315
initrd /bt4/boot/initrd.gz

title MEMTEST86+
find --set-root /mt410.iso
map /mt410.iso (hd32)
map --hook
root (hd32)
chainloader (hd32)

#This method of running memtest86+ works on more PCs than the previous one
title memtest.img (memtest.img obtained from ISO)
find --set-root /memtest.img
map /memtest.img (fd0)
map --hook
chainloader (fd0)+1
rootnoverify (fd0)
map --floppies=1

title memtest86+ (bin file)
find --set-root /memtest.bin
kernel /memtest.bin


# USB Boot -> Fat32 Formatted
title Norton Ghost 15 (hd32)
find --set-root /iso/Ghost15.iso
map /iso/Ghost15.iso (hd32)
map --hook
root (hd32)
chainloader /BOOTMGR


title Ultimate Boot CD (UBCD) v5.0 final\nthis is the 14 May 2010 edition,its an all in one Free Bootable CD for IT Pros, the cd consolidate as many diagnostic tools as possible into one bootable CD.
find --set-root /ubcd50.iso
map /ubcd50.iso (hd32)
map --hook
root (hd32)
chainloader (hd32)


title Ultimate Boot CD (UBCD) v5.11 \nthis is the August 2011 edition,its an all in one Free Bootable CD for IT Pros, the cd consolidate as many diagnostic tools as possible into one bootable CD.
find --set-root /ubcd511.iso
map /ubcd511.iso (hd32)
map --hook
root (hd32)
chainloader (hd32)

# only about 2MB is saved by using 7zip to compress the iso to a .gz file
title Hirens Boot CD 13.1 using firadisk \nBoot to Hirens Boot CD in RAM
find --set-root --ignore-floppies --ignore-cd /HirensBCD.13.1.iso.gz
map --mem /firadisk.gz (fd0)
map --mem /HirensBCD.13.1.iso.gz (0xff)
map --hook
root (0xff)
chainloader (0xff)


#iPXE boot - see the iPXE Tutorial for details
title ipxe
map /ISO/ipxe.iso (0xff) || map --mem /ISO/ipxe.iso (0xff)
map --hook
root (0xff)
chainloader (0xff)

# ---- GPARTED ---
title 1 GParted Live (0.8.1-3)
find --set-root --ignore-floppies /live/vmlinuz
kernel /live/vmlinuz boot=live config noswap noprompt ip=frommedia nosplash
initrd /live/initrd.img

title 2 GParted Live (0.8.1-3) ToRAM
find --set-root --ignore-floppies /live/vmlinuz
kernel /live/vmlinuz boot=live config noswap noprompt toram=filesystem.squashfs ip=frommedia nosplash
initrd /live/initrd.img

title 3 GParted Live (0.8.1-3) without framebuffer
find --set-root --ignore-floppies /live/vmlinuz
kernel /live/vmlinuz boot=live config noswap noprompt ip=frommedia nomodeset vga=normal nosplash
initrd /live/initrd.img

title 4 GParted Live (0.8.1-3) failsafe
find --set-root --ignore-floppies /live/vmlinuz
kernel /live/vmlinuz boot=live config noswap noprompt acpi=off irqpoll noapic noapm nodma nomce nolapic nosmp ip=frommedia nomodeset vga=normal nosplash
initrd /live/initrd.img

#Note: if using FAT filesystem, the findiso pathname is CaSeSeNsItIvE!
title gparted 11.0 live from ISO
find --set-root /gparted-live-0.11.0-10.iso
map /gparted-live-0.11.0-10.iso (0xff) || map --mem /gparted-live-0.11.0-10.iso (0xff)
map --hook
root (0xff)
kernel /live/vmlinuz boot=live config union=aufs noswap noprompt vga=788 ip=frommedia findiso= /gparted-live-0.11.0-10.iso toram=filesystem.squashfs
initrd /live/initrd.img

#Note: if using FAT filesystem, the findiso pathname is CaSeSeNsItIvE!
# http://sourceforge.net/projects/gparted/files/latest/download
title gparted 0.12.1-5 live from ISO
find --set-root /gparted-live-0.12.1-5.iso
map /gparted-live-0.12.1-5.iso (0xff) || map --mem /gparted-live-0.12.1-5.iso (0xff)
map --hook
root (0xff)
kernel /live/vmlinuz boot=live config ip=frommedia findiso=/gparted-live-0.12.1-5.iso
initrd /live/initrd.img
# for failsafe add ...
#noapic noapm nodma nomce nolapic nomodeset nosmp vga=normal

# -----

# http://hdt-project.org/wiki/hdt-0.5.0#Downloads - examine the hardware PCIID's etc. in a system (v small and quick!)
title HDT (Hardware Detection Tool\nhdt-project.org\nType MENU for a GUI menu
map /hdt-0.5.0.iso (0xff)
map --hook
root (0xff)
chainloader (0xff)

#You must first copy the /slax folder from the ISO file and place it on your USB pen
title slax 6.1.2
map /iso/slax-6.1.2.iso (0xff) || map --mem /iso/slax-6.1.2.iso (0xff)
map --hook
root (0xff)
kernel /boot/vmlinuz from=/iso/slax-6.1.2.iso ramdisk_size=6666 root=/dev/ram0 rw
initrd /boot/initrd.gz

title Kasperksy AV 2010 Rescue.iso
map /rescue/rescue.iso (0xff) || --mem /rescue/rescue.iso (0xff)
map --hook
root (0xff)
chainloader (0xff)

title BartPE (from \MININT)
find --set-root /minint/SETUPLDR.BIN
chainloader /minint/SETUPLDR.BIN

title SeaTools ISO
map /SeaToolsDOS223ALL.ISO (0xff)
map --hook
map (0xff)/seatools.ima (fd0)
map --hook
root (fd0)
chainloader /kernel.sys

# boot from the .iso file (160MB) or use 7Zip to compress it to a .gz file (68MB)
title BartPE ISO using firadisk \nBoot to BartPE in RAM
find --set-root --ignore-floppies --ignore-cd /Bartpe.iso
map --mem /firadisk.gz (fd0)
map --mem /Bartpe.iso (0xff)
map --hook
root (0xff)
chainloader (0xff)

title DSLinux ISO
find --set-root /dsl4410.iso
map /dsl4410.iso (hd32)
map --hook
root (hd32)
chainloader (hd32)

# boot knoppix from ISO file (no need to modify ISO with 6.7+)
# works with iso in root or subfolder (thanks to cdob from reboot.pro for workaround for subfolder!)
# ISO boot discussion at http://reboot.pro/16252/
# iso path and filename are Case Sensitive!!!
# Knoppix cheat codes listed at http://www.pendrivelinux.com/knoppix-cheatcodes/
# Set a unique variable (e.g. K1109) in each iftitle line
iftitle [if exist /_ISO/ ADRIANE-KNOPPIX_V6.7.1CD-2011-09-14-EN.iso set K1109=/_ISO/ ADRIANE-KNOPPIX_V6.7.1CD-2011-09-14-EN.iso ] Boot %K1109%
set ISO=%K1109%
ls %ISO% > nul || find --set-root --devices=hf %ISO%
map %ISO% (0xff) || echo %ISO% not contiguous - so need to load it all into memory... && map --mem %ISO% (0xff)
map --hook
root (0xff)
kernel /boot/isolinux/linux bootfrom=/./%ISO% noeject noprompt ramdisk_size=100000 lang=en vt.default_utf8=0 apm=power-off nomce libata.force=noncq hpsa.hpsa_allow_any=1 loglevel=1 tz=localtime
initrd /boot/isolinux/minirt.gz

iftitle [if exist /KNOPPIX_V7.0.4CD-2012-08-20-EN.iso] Boot KNOPPIX
set ISO=/KNOPPIX_V7.0.4CD-2012-08-20-EN.iso
ls %ISO% > nul || find --set-root --devices=hf %ISO%
map %ISO% (0xff) || echo %ISO% not contiguous - so need to load it all into memory... && map --mem %ISO% (0xff)
map --hook
root (0xff)
kernel /boot/isolinux/linux bootfrom=/./%ISO% noeject noprompt ramdisk_size=100000 lang=en vt.default_utf8=0 apm=power-off nomce libata.force=noncq hpsa.hpsa_allow_any=1 loglevel=1 tz=localtime
initrd /boot/isolinux/minirt.gz


title KNOPPIX\nAt boot prompt type - knoppix bootfrom=/dev/hda0/KNOPPIX155.iso
map /KNOPPIX511.iso (hd32) || map --mem /KNOPPIX511.iso (hd32)
map --hook
root (hd32)
chainloader (hd32)

title Knoppix 7
#http://www.knopper.net/knoppix-info/index-en.html
set lang=en
set ISOfile=/images/KNOPPIX_V7.0.5.iso
cat --length=0 %ISOfile% > nul || find --set-root --devices=hf %ISOfile%
map %ISOfile% (0xff)
map --hook
root (0xff)
kernel /boot/isolinux/linux bootfrom=/dev/*%ISOfile% noeject noprompt ramdisk_size=100000 lang=%lang% vt.default_utf8=0 apm=power-off nomce libata.force=noncq hpsa.hpsa_allow_any=1 loglevel=1 tz=localtime
initrd /boot/isolinux/minirt.gz


title KNOPPIX 6.2.1\nNote: Must use modified initrd.gz to boot from ISO - Note: version specific - does not work with 6.7.0!
#http://knol.google.com/k/yoshihide-nomura/how-to-boot-knoppix-directly-from-iso/2vzr3sm0dzndc/1#
#http://www.knoppix.net/wiki/Cheat_Codes
#http://archive.yoshimov.com/knoppix/initrd-mod-6.2.1.gz has modified initrd file
#iso file and modifed initrd placed in ISO folder in this example
find --set-root /iso/KNOPPIX_V6.2.1CD-2010-01-31-EN.iso
map /iso/KNOPPIX_V6.2.1CD-2010-01-31-EN.iso (hd32) || map --mem /iso/KNOPPIX_V6.2.1CD-2010-01-31-EN.iso (hd32)
map --hook
root (hd32)
echo "Loading kernel.."
kernel /boot/isolinux/linux ramdisk_size=100000 lang=en vt.default_utf8=0 apm=power-off vga=791 nomce noeject noprompt quiet loglevel=0 tz=localtime fromiso=iso/KNOPPIX_V6.2.1CD-2010-01-31-EN.iso edd=off --
echo "Loading modified initrd downloaded from http://archive.yoshimov.com/knoppix/initrd-mod-6.2.1.gz"
initrd (bd)/iso/initrd-mod-6.2.1.gz || initrd (hd0,0)/iso/initrd-6.2.1.gz

# -- PUPPY LINUX -----

#The following cheat codes have been tried with precise, slacko and tahr and none work!!
#iso_filename=%ISOSCAN% isofrom_system=%ISOSCAN% isoboot=%ISOSCAN% isoloop=%ISOSCAN% img_loop=%ISOSCAN%
#bootfromiso=%ISOSCAN% findiso=%ISOSCAN% fromiso=%ISOSCAN% from=%ISOSCAN%
#isofrom=%UUID%:%ISOSCAN% iso-scan/filename=%ISOSCAN% isofrom_device=/dev/disk/by-uuid/%UUID% isofrom_system=%ISOSCAN%
#iso-scan/filename=%ISOSCAN% isofrom_device=/dev/disk/by-uuid/%UUID% isofrom_system=%ISOSCAN%


#boot from ISO - sqfs file must be extracted to level1 folder (any name of folder - e.g. \fred)
#e.g. \xyzzy\puppy_precise_5.7.1.sfs and puppy will find it - does not work if level2 folder or below (e.g. \xyxxy\fred\xxx.sfs will not work)
#works for FAT32 or NTFS - name of .sfs file must be lower case (extract using 7zip on ISO file)
#many diferent .sfs files can be placed in the same folder for other versions too
title Puppy Precise boot from ISO
map /_ISO/Linux/precise-5.7.1.iso (0xff)
map --hook
root (0xff)
#pmedia can be (nothing) ='auto', or usbhd, satahd, idehd, scsihd, usbflash
kernel /vmlinuz pmedia= psavemark=1
initrd /initrd.gz



# Only the ISO file is required for this menu - 4th ptn on USB drive must be empty!
iftitle [if exist (bd)/_ISO/Linux/precise-5.4.3.iso] Puppy Precise 5.4.3\n Puppy with persistence
partnew (hd0,3) 0x00 (bd)/_ISO/Linux/precise-5.4.3.iso
map (bd)/_ISO/Linux/precise-5.4.3.iso (0xff)
map --hook
root (0xff)
kernel /vmlinuz pmedia=usbflash psavemark=1 fix=fsck
#You need to use pmedia=usbhd if you are booting from a USB HDD.
#kernel /vmlinuz pmedia=usbhd psavemark=1 fix=fsck
initrd /initrd.gz


# -- CLONEZILLA ---

title CLONEZILLA (wait 2-3 minutes and hit Enter twice!)
;long wait at splash screen but it works!
kernel /live/vmlinuz1 locale=us boot=live persistent
initrd /live/initrd1.img

title CLONEZILLA hd0<->hd1 (wait 2-3 minutes and hit Enter twice!)
;long wait at splash screen but it works!
map (hd0) (hd1)
map (hd1) (hd0)
kernel /live/vmlinuz1 locale=us boot=live persistent
initrd /live/initrd1.img

title Parted Magic /ISO/pmagic_2013_02_28.iso (booting the kernel)
map /ISO/pmagic_2013_02_28.iso (0xff)
map --hook
root (0xff)
kernel /pmagic/bzImage edd=off load_ramdisk=1 prompt_ramdisk=0 rw vga=normal sleep=10 loglevel=0 max_loop=256 vmalloc=384MiB keymap=us iso_filename=/ISO/pmagic_2013_02_28.iso
initrd /pmagic/initrd.img

title pmagic_2012_06_07.iso
#name must be in pmagic-yyyy_mm_dd.iso format and in root folder or will not find the .sqfs file
find --set-root /pmagic_2012_06_07.iso
map --heads=0 --sectors-per-track=0 /pmagic_2012_06_07.iso (0xff)
map --hook
root (0xff)
chainloader (0xff)

title Parted Magic 4.10 ISO
find --set-root /pmagic.iso
map /pmagic.iso (hd32)
map --hook
root (hd32)
kernel /pmagic/bzImage noapic load_ramdisk=1 prompt_ramdisk=0 rw vga=791 sleep=10 loglevel=0 keymap=uk iso_filename=/pmagic.iso
initrd /pmagic/initramfs
map --unmap=0:0xff

title Parted Magic 5.2 (direct memory mapping and booting the kernel)
find --set-root /pm52.iso
map --mem /pm52.iso (hd32)
map --hook
root (hd32)
kernel /pmagic/bzImage noapic load_ramdisk=1 prompt_ramdisk=0 rw vga=791 sleep=10 loglevel=0 keymap=us iso_filename=/pm52.iso
initrd /pmagic/initramfs
map --unmap=0:0xff

title Acronis True Image 2009 / 2013
find --set-root /acronis.iso
map /acronis.iso (hd32)
map --hook
root (hd32)
chainloader (hd32)

title Acronis Recovery 2013
kernel /Recovery\ Manager/kernel.dat quiet media_for_linux vga=ask
initrd /Recovery\ Manager/ramdisk.dat

title Windows Password reset
find --set-root /cd100627.iso
map /cd100627.iso (0xff)
map --hook
chainloader (0xff)

title OphCrack Password Cracker XP 2.3.1
find --set-root /ophcrack_xp/boot/bzImage
kernel /ophcrack_xp/boot/bzImage rw root=/dev/null vga=normal ophcrack=lowram lang=C kmap=uk screen=1024x768x16 autologin
initrd /ophcrack_xp/boot/rootfs.gz

title OphCrack Password Cracker Vista 2.3.1
find --set-root /ophcrack_vista/boot/bzImage
kernel /ophcrack_vista/boot/bzImage rw root=/dev/null vga=normal ophcrack=lowram lang=C kmap=uk screen=1024x768x16 autologin
initrd /ophcrack_vista/boot/rootfs.gz

#name must be in pmagic-x.y.iso format or will not find sqfs file
title PC CMOS Cleaner and Parted Magic 5.7 ISO
find --set-root /pmagic-5.7.iso
map --heads=0 --sectors-per-track=0 /pmagic-5.7.iso (hd32)
map --hook
root (hd32)
chainloader (hd32)

title Slitaz 4 RC1 Live
find --set-root /slitaz-4.0-RC1.iso
map --heads=0 --sectors-per-track=0 /slitaz-4.0-RC1.iso (0xff)
map --hook
root (0xff)
chainloader /boot/isolinux/isolinux.bin

title SliTaz Cooking (may be no kbd in GUI?)
find --set-root /slitaz-cooking.iso
map --heads=0 --sectors-per-track=0 /slitaz-cooking.iso (0xff)
map --hook
root (0xff)
kernel /boot/bzImage rw root=/dev/null
#vga=normal lang=C kmap=uk screen=1024x768x16 autologin
initrd /boot/rootfs.gz

title SliTaz 3.0
find --set-root /slitaz-3.0.iso
map --heads=0 --sectors-per-track=0 /slitaz-3.0.iso (0xff)
map --hook
root (0xff)
kernel /boot/bzImage rw root=/dev/null
#vga=normal lang=C kmap=uk screen=1024x768x16 autologin
initrd /boot/rootfs.gz

# - - - - - - - - - #

# GENERIC ANY LINUX BOOT FROM ISO TECHNIQUE!
# See Tutorial 93 for details

# This menu can be used for to boot any linux iso file
# It is especially useful if your boot drive is NTFS but linux does not understand NTFS once it boots and so cannot boot further
# WARNING: permanently alters the boot device's partition table (adds a 4th ptn entry)!
# Use with care as it will obliterate ptn 4 on the boot device if it already exists!

iftitle [if exist /tails-i386-0.15.iso] Tails (boot from ISO)
set ISO=tails-i386-0.15.iso
find --set-root %ISO%
parttype (hd0,3) | set check=
set check=%check:~-5,4%
if %check%==0x00 partnew (hd0,3) 0x00 %ISO%
if NOT %check%==0x00 echo ERROR: Partion Table entry 4 already exists! && pause --wait=3 && configfile /menu.lst
map /%ISO% (0xff)
echo -e \r\n
map --hook
root (0xff)
chainloader (0xff)

#some examples not using iftitle so they will always be listed even if the ISO file does not exist!

title raring-dvd-i386.iso\nEdubuntu 13.04 Alpha 1 Test Build
set ISO=/raring-dvd-i386.iso
find --set-root %ISO%
parttype (hd0,3) | set check=
set check=%check:~-5,4%
if %check%==0x00 partnew (hd0,3) 0x00 %ISO%
if NOT %check%==0x00 echo ERROR: Partion Table entry 4 already exists! && pause --wait=3 && configfile /menu.lst
map %ISO% (0xff)
map --hook
root (0xff)
chainloader (0xff)


title systemrescuecd-x86-3.1.2.iso\nSystemRescueCD
set ISO=/systemrescuecd-x86-3.1.2.iso
find --set-root %ISO%
parttype (hd0,3) | set check=
set check=%check:~-5,4%
if %check%==0x00 partnew (hd0,3) 0x00 %ISO%
if NOT %check%==0x00 echo ERROR: Partion Table entry 4 already exists! && pause --wait=3 && configfile /menu.lst
map %ISO% (0xff)
map --hook
root (0xff)
chainloader (0xff)

# - - - - - - - - END OF GENERIC ISO EXAMPLES - - - - - #


#load a gzipped floppy disk image (convert to .gz using gzip or 7Zip)

title MSDOS 6.22 using chainloader from gz file
find --set-root /dos622.ima.gz
map --mem /dos622.ima.gz (fd0)
map --hook
rootnoverify (fd0)
chainloader (fd0)+1

title PLD RescueCD - Linux RCDx86_298.iso\nhttp://rescuecd.pld-linux.org/
find --set-root /RCDx86_298.iso
map /RCDx86_298.iso (hd32)
map --hook
root (hd32)
chainloader (hd32)

# ActiveBootDisk (pe 3.1 based)
# extract the two files _bootDisk.ini and BOOTDISK.KEY from ISO and place in the root of the drive first!
title Active@ Boot Disk 6.5
map /ISO/ActiveBootDisk.ISO (0xff) || map --mem /ISO/ActiveBootDisk.ISO (0xff)
map --hook
root (0xff)
chainloader (0xff) || chainloader (0xff)/BOOTMGR



#Error 43: The BPB hidden_sectors should not be zero for a hard-disk partition boot sector
#See Wonko's post at http://reboot.pro/topic/16429-easy2boot-development-discussion/page-30#entry185771
# This error may be found when attempting to chainload to a partition - e.g. chainloader (hd0,1)+1
# The following code assumes partition 4 is empty/unused
set BOOTPTN=(hd0,1)
debug normal
parttype (hd0,3) | set check=
set check=%check:~-5,4%
#create new ptn4 (also fixes up the BPB hidden sectors in %BOOTPTN%)
if %check%==0x00 partnew (hd0,3) 0x00