Join GitHub today
How UNetbootin Works
UNetbootin's functioning is split up into 3 stages: downloading, extracting files, and installing the bootloader.
UNetbootin supports http and ftp as download sources. Usually, a redirector URL is used, or a regexp is used on directory listings on mirror sites, to ensure that the latest distribution version is downloaded. Resuming of downloads has not yet been implemented.
What occurs during this stage differs depending on the disk image type (ISO file or floppy disk image).
7-zip is used to extract files from the ISO file to the target drive. Heuristics based on file size and name are then used to locate kernel and initrd files; these are placed in /ubnkern and /ubninit. Boot configuration files (named syslinux.cfg, isolinux.cfg, extlinux.conf, or menu.lst) are then read to determine any boot options that need to be used and locations of other kernel and initrd files.
Floppy image files
The specified IMG file is copied to /ubninit, and memdisk is copied to /ubnkern. Upon bootup, memdisk will load the IMG file into memory, and boot from it.
Installing the Bootloader
What occurs during this stage differs depending on whether USB drive install mode or Hard Disk (frugal) install mode is used.
USB Drive install mode
For the Live USB creation mode, UNetbootin generates an appropriate syslinux config file in /syslinux.cfg, and makes your USB drive bootable using syslinux. On Linux, if extlinux is installed and the target USB drive is ext2 or ext3, extlinux is used instead; the config file is installed in /extlinux.conf. The partition to which it has been installed is also marked as active.
Hard Disk (frugal) install mode
On Windows, UNetbootin modifies boot.ini (on 2000/XP), or uses bcdedit (on Vista/7) to add a boot menu option titled UNetbootin. This loads the GRUB4DOS bootloader, which is installed at /ubnldr and /ubnldr.mbr, and this in turn reads boot menu entries from /unetbtin/menu.lst. The installation .exe file is copied to /unetbtin.exe, and this is added to autorun upon the next bootup. When run, this will uninstall UNetbootin by deleting the extracted files (which is recorded using /ubnfilel.txt and /ubnpathl.txt) and removing the UNetbootin boot menu entry.
On Linux, menu.lst (if using GRUB) or grub.cfg (if using GRUB2) is modified to add the UNetbootin entry. The existing config file is backed up to menu.lst.bak or grub.cfg.bak. When UNetbootin is run again, the uninstaller is run; this will delete the extracted files (which is recorded using /ubnfilel.txt and /ubnpathl.txt) and restore the backed-up boot configuration files.