I try my best to detail my question. If it would run out of your patience, go to lastest paragraph.
I downloaded Ubuntu 13.04 from its official site and extracted files to a folder ubuntu\ on USB stick( Z: for example). So files are now in Z:\ubuntu\
Before that, I downloaded Syslinux 5.10( 6.00 has bugs) and used it to install boot code to USB stick with this command:
syslinux.exe --mbr --active --directory /boot/syslinux/ --install Z:
Then I copied chain.c32 and required libs to Z:\boot\syslinux and added to syslinux.cfg( unimportant part is ignored):
COM32 chain.c32
APPEND isolinux=/ubuntu/isolinux/isolinux.cfg
Syslinux booted successfully but failed to boot Ubuntu, saying:
Err: option 'maps' requires a sector'', but I didn't know what it meant.
Then I tried loading Ubuntu's isolinux configure using:
config /ubuntu/isolinux/isolinux.cfg /ubuntu
But only got message saying:
Loading gfxboot... Failed: No such file or directory
I tried again with:
config /ubuntu/isolinux/isolinux.cfg /ubuntu/isolinux/
And it said:
Failed to load COM32 file gfxboot.c32
But I could see LABELs with [TAB] Key:
boot:
live live-install check memtest hd mainmenu help
So I tried booting Ubuntu via command line:
boot: live
And it showed that:
Loading /casper/vmlinuz failed: No such file or directory
I think Syslinux recognizes Z:\ as root directory /, not Z:\ubuntu\, so it failed to load vmlinz. So I moved files to Z:\ and reboot. Though syslinux still failed to load gfxboot but I booted into Ubuntu successfully with
config /isolinux/isolinux.cfg /isolinux/
boot: live
I don't understand why it could not load gfxboot.c32 when it read isolinux configure correctly. Maybe syslinux I use and isolinux Ubuntu uses are not the same, and the bootcode and gfxboot are not compatible.
Syslinux Wiki mentions that CONFIG can restart the boot loader using a different configuration file and set new home directory using:
CONFIG /path/to/cfg/file/configfile.cfg /path/to/new/base/dir
I followed the guide but filed to let Syslinux set Z:\ubuntu\ as root directory. Maybe I misundertood this guide.
So my question is, how to put Ubuntu or other Operation System into a standalone folder and configure syslinux properly to set direcotry where Ubuntu or other OS is as root directory so that I could boot the OS successfully?