As I stated in my question I want to place Windows XP ISO into one of the partitions in my USB stick to run it at boot to install XP just in case. After searching for a while on the net I learned that it's not that easy. I needed to extract XP ISO into folder then apply winvblock driver and edit a few files in extracted folder, and then pack folder into bootable XP ISO again
In order to boot from CDs, it needs boot sectors to be detected by BIOS. A bootable CDROM actually contains an image of floppy disk. https://superuser.com/questions/476415/what-does-a-bootable-cdrom-usb-floppy-disk-contain-exactly
When you extract a bootable ISO file into a folder, you can't just reassamble it into a ISO file (
like mkisofs -o /tmp/cd.iso /tmp/directory/) and preserve boot functionality unless you apply a boot sector patch.
mkisofs helps apply that patch while it is creating "Bootable ISO Image" from folder. It's possible for both Windows and Linux.
For Windows XP you need to place bootsect.bin in root of folder then from root of folder in terminal run:
mkisofs -b bootsect.bin -no-emul-boot -boot-load-seg 1984 -boot-load-size 4 -iso-level 2 -J -l -D -N -joliet-long -relaxed-filenames -V "WINSP" -o ../winsp.iso .
That's all. You have a bootable XP.ISO
For Linux you need
boot.cat and issue command:
mkisofs -o output.iso -b isolinux isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table CD_root
Some time ago a guy asked similar question for Ubuntu here How can I create a bootable iso from an extracted Ubuntu 13.04 iso?
It's possible with syslinux http://www.syslinux.org/wiki/index.php/ISOLINUX
I tested my modified XP ISO in Virtualbox, it runs well.