#create an ext2 file in the root of the E2B USB drive called x-rw
#when Xiaopan boots, use the Control Panel - Backup\Restore applet to change the location to partition 3 - e.g. sdb3/

iftitle [if exist $HOME$/XIAOPAN.iso] Xiaopan (with persistence)\n Boot using .mnu file with persistence\n Use Control Panel - Backup to change the backup volume to sdx3
if exist CD echo WARNING: Cannot use partnew command! && pause && configfile (bd)/menu.lst
set ISO=XIAOPAN.iso
set PER=x-rw
if "%E2BDEV%"=="" set E2BDEV=hd0 && pause E2BDEV forced to hd0!
#enable parttype output
debug 1
# make empty table entry in 3rd position in ptn table
parttype (%E2BDEV%,2) | set check=
debug off
set check=%check:~-5,4%
if "%check%"=="0x00" partnew (%E2BDEV%,2) 0 0 0
if not "%check%"=="0x00" echo WARNING: PTN TABLE 3 On %E2BDEV% IS ALREADY IN USE - PERSISTENCE MAY NOT WORK! && pause
debug 1
if not exist /%PER% echo WARNING: /%PER% persistence file not found! && pause
errorcheck off
if "%check%"=="0x00" partnew (%E2BDEV%,2) 0x0 /%PER%
errorcheck on
#map ptn 4 to ISO
partnew (%E2BDEV%,3) 0x0 $HOME$/%ISO%
map $HOME$/%ISO% (0xff)
map --hook
root (0xff)
chainloader (0xff)

